CN113687973B - Control method, equipment and medium for log dynamic output - Google Patents

Control method, equipment and medium for log dynamic output Download PDF

Info

Publication number
CN113687973B
CN113687973B CN202111004801.1A CN202111004801A CN113687973B CN 113687973 B CN113687973 B CN 113687973B CN 202111004801 A CN202111004801 A CN 202111004801A CN 113687973 B CN113687973 B CN 113687973B
Authority
CN
China
Prior art keywords
instance object
matching
log
attribute
output
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202111004801.1A
Other languages
Chinese (zh)
Other versions
CN113687973A (en
Inventor
赵洋
孟珂
赵海兴
李照川
罗超
徐克龙
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Original Assignee
Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chaozhou Zhuoshu Big Data Industry Development Co Ltd filed Critical Chaozhou Zhuoshu Big Data Industry Development Co Ltd
Priority to CN202111004801.1A priority Critical patent/CN113687973B/en
Publication of CN113687973A publication Critical patent/CN113687973A/en
Application granted granted Critical
Publication of CN113687973B publication Critical patent/CN113687973B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0766Error or fault reporting or storing
    • G06F11/0775Content or structure details of the error report, e.g. specific table structure, specific error fields
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0766Error or fault reporting or storing
    • G06F11/0781Error filtering or prioritizing based on a policy defined by the user or on a policy defined by a hardware/software module, e.g. according to a severity level
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/33Intelligent editors

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • Quality & Reliability (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a control method, equipment and medium for log dynamic output, wherein the method comprises the following steps: determining a program function interface and acquiring an instance object through the program function interface; carrying out reflection processing on the instance object to obtain an internal structure of the instance object; and matching the internal structure with the corresponding matching condition in the class data source, and determining whether the instance object outputs a log through the program function interface according to the matching result. The log is dynamically output and controlled, so that the log output is more flexible and convenient, redundant codes and repeated work caused by the log control under special conditions are greatly reduced, the log is completely output according to the output conditions required by a developer, the output of useless logs is reduced, the waste of server resources is reduced, in addition, the internal structure of an instance object is acquired in a reflection mode, the codes are more flexible, and the application expandability is greatly improved.

Description

Control method, equipment and medium for log dynamic output
Technical Field
The application relates to the technical field of Internet, in particular to a control method, equipment and medium for log dynamic output.
Background
With the rapid development of global internet technology, various internet products or systems are layered endlessly, and various development languages are widely used and developed at the same time. In an internet product or system, log records are an indispensable part in program operation, almost every internet product or system has a log system, every development language also has own log frames and modules, and the log is particularly important for the effect of the internet product or system.
However, internet products or systems are very resource-consuming to log in certain scenarios where special parameters such as large fields need to be recorded due to the high throughput of users. However, the existing log output method is difficult to control the log output in a targeted manner, so it is very important to propose a dynamic log control method.
Disclosure of Invention
In order to solve the problem that in the prior art, targeted dynamic control cannot be achieved for log output, the application provides a method, equipment and medium for controlling log dynamic output, which comprise the following steps:
In one aspect, the application provides a control method for log dynamic output, which comprises the following steps: determining a program function interface and acquiring an instance object through the program function interface; carrying out reflection processing on the instance object to obtain the internal structure of the instance object; and matching the internal structure with corresponding matching conditions in the class data source, and determining whether the instance object outputs a log through the program function interface according to a matching result.
In one example, before determining a program function interface and obtaining an instance object through the program function interface, the method further comprises: determining the name of a matching object class needing to control log output; acquiring a plurality of attribute names contained in the matching object class name, and selecting from the attribute names to obtain the matching attribute names needing to be controlled to be output by the log; acquiring a plurality of attribute values contained in the matching attribute names, and selecting from the attribute values to control the matching attribute values output by the log; determining constraint conditions corresponding to the matching attribute values, wherein the types of the constraint conditions at least comprise: a log output permission type and a log output prohibition type; and adding the class name, the matching attribute value and the constraint condition of the matching object to a class data source to serve as the matching condition of the class data source and the instance object.
In one example, the matching the internal structure with the corresponding matching condition in the class data source, and determining whether the instance object outputs a log through the program function interface according to the matching result specifically includes: acquiring an instance object class name through the internal structure, and judging whether a matching object class name identical to the instance object class name exists in a class data source or not; if not, determining whether the instance object outputs a log according to a pre-stored code; if so, acquiring an instance object attribute name and a plurality of instance object attribute values contained under the instance object attribute name through the internal structure; querying a matching attribute value matched with the instance object attribute value and a constraint condition corresponding to the matching attribute value through the class data source; and obtaining a calculation result according to the constraint condition and a pre-stored first algorithm, wherein the calculation result is used for determining whether the instance object outputs a log through the program function interface.
In one example, after obtaining the calculation result according to the constraint condition and the pre-stored first algorithm, the method further includes: determining that the number of the attribute names of the instance object is not less than two; and determining to obtain a plurality of calculation results, and controlling the program function interface to output or not output the log of the instance object according to a pre-stored second algorithm and the plurality of calculation results.
In one example, before obtaining, by the internal structure, an instance object attribute name and a plurality of instance object attribute values contained under the instance object attribute name, the method includes: determining that the private attribute access rights exist in the internal structure; and acquiring the private attribute access rights through a pre-stored operation algorithm.
In one example, the obtaining, through the internal structure, an instance object attribute name and a plurality of instance object attribute values contained under the instance object attribute name specifically includes: acquiring an attribute extraction algorithm corresponding to the internal structure; and running the attribute extraction algorithm to obtain an instance object attribute name and a plurality of instance object attribute values contained under the instance object attribute name.
In one example, the reflecting processing is performed on the instance object to obtain an internal structure of the instance object, which specifically includes: adding a JAVA reflection algorithm on the program function interface, wherein the JAVA reflection algorithm is used for carrying out real-time reflection processing on the instance object; acquiring a byte code file of the instance object through the JAVA reflection algorithm, and writing the byte code file into a class name file which is created in advance in a memory; and obtaining the internal structure of the instance object.
In one example, the method further comprises: determining that an output log exists at the program function interface; and storing the log into a corresponding log file according to the level of the log.
In another aspect, the present application provides a control device for log dynamic output, including: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the following instructions: determining a program function interface and acquiring an instance object through the program function interface; carrying out reflection processing on the instance object to obtain the internal structure of the instance object; and matching the internal structure with corresponding matching conditions in the class data source, and determining whether the instance object outputs a log through the program function interface according to a matching result.
In another aspect, the present application provides a non-volatile computer storage medium storing computer-executable instructions configured to: determining a program function interface and acquiring an instance object through the program function interface; carrying out reflection processing on the instance object to obtain the internal structure of the instance object; and matching the internal structure with corresponding matching conditions in the class data source, and determining whether the instance object outputs a log through the program function interface according to a matching result.
The control method, the device and the medium for log dynamic output provided by the application have the following beneficial effects: through carrying out dynamic output control on the log, log output is more flexible and convenient, redundant codes and repeated work caused by log control under special conditions are greatly reduced, the log is completely output according to the output conditions required by a developer, and the output of useless log is reduced, so that the waste of server resources is reduced. In addition, the internal structure of the instance object is acquired in a reflection mode, so that codes are more flexible, and the expandability of the application is greatly improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 is a flow chart of a method for controlling log dynamic output according to an embodiment of the present application;
fig. 2 is a schematic diagram of a control device for log dynamic output in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to specific embodiments of the present application and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
Fig. 1 is a flow chart of a control method for log dynamic output on a server side according to one or more embodiments of the present disclosure. The method can be applied to different business fields, such as the internet financial business field, the electric business field, the instant messaging business field, the game business field, the public business field and the like. The process may be performed by a computing device in the corresponding domain (e.g., an intelligent customer service server or an intelligent mobile terminal corresponding to the payment service, etc.), and certain input parameters or intermediate results in the process allow for manual intervention adjustments to help improve accuracy.
Firstly, it should be noted that, the control method for log dynamic output according to the present application is stored in a corresponding system or server, and a user may log on the system or server through a corresponding terminal, where the terminal types include, but are not limited to: a mobile phone, a tablet computer, a personal computer or other hardware equipment with corresponding processing and communication functions. In addition, the user can log in the corresponding system arranged in the terminal through APP or WEB login and the like, and execute the corresponding scheme by carrying out calculation processing through a processor in the terminal or combining a processing result sent by a server through a communication mode with a remote server, so as to realize dynamic output control of the log.
The following describes in detail the technical solutions provided by the embodiments of the present application with reference to the accompanying drawings.
As shown in fig. 1, a method for controlling log dynamic output provided by an embodiment of the present application includes:
s101: and determining a program function interface and acquiring an instance object through the program function interface.
In particular, the system needs to determine a program function interface implementing the present solution, where the program function interface is capable of executing corresponding instance objects, where the instance objects are illustrated by taking the running code or the execution code of the program as an example.
The program function interface can encapsulate the output function of the log through the corresponding strategy given to the program function interface, wherein the output function comprises the level of the log, the format of the log, the parameters of the log, error information and the like, and the program function interface receives the instance object associated with the log to determine whether the log corresponding to the instance object needs to be output.
In addition, the system also needs to configure matching conditions with the instance object for the class data source before the program function interface will be determined and the instance object obtained through the program function interface.
The class data source is connected with the program function interface and is used for providing corresponding screening rules, and when the system receives the instance object through the program function interface, whether the instance object needs to output a log or not can be determined by comparing the instance object with the class data source.
The matching conditions for configuring the class data source and the instance object specifically comprise: first, the class name of the matched object for controlling log output needs to be determined, and the class name is used for indicating that all objects belonging to the class name need to be log-controlled and output.
Further, the system can acquire a plurality of attribute names contained in the class names of the matched objects, each class name of each object contains a plurality of attribute names, and when one or a plurality of attribute names need log control output, the system can select the matched attribute names from the plurality of attribute names, and the log control output needs to be controlled.
Each attribute name contains a plurality of attribute values, and when one or a plurality of attribute values need to be output by log control, the system can select from the attribute values and needs to control the matching attribute values of log output.
After the matching attribute value is determined, log control output is necessarily performed on the matching attribute value, and corresponding constraint conditions are required to be configured for the matching attribute value, wherein the types of the constraint conditions at least comprise: and a log output permission type and a log output prohibition type. For example, when a certain instance object includes a certain matching attribute value and the constraint condition corresponding to the matching attribute value is a log output prohibition type, log output is not performed for the instance object.
The system adds the class name, the matching attribute value and the constraint condition of the matching object to the class data source to serve as the matching condition of the class data source and the instance object.
S102: and carrying out reflection processing on the instance object to obtain the internal structure of the instance object.
Specifically, the system adds a JAVA reflection algorithm on the program function interface, where the JAVA reflection algorithm is used to perform real-time reflection processing on the instance object. In the embodiment of the application, the JAVA reflection algorithm is realized based on the JAVA reflection technology.
Further, the system can acquire the byte code file of the instance object through a JAVA reflection algorithm, and write the byte code file into a class name file which is created in advance in the memory, so as to obtain the internal structure of the instance object.
The internal structure may reflect class names, attribute names, and attribute values for instance objects.
S103: and matching the internal structure with corresponding matching conditions in the class data source, and determining whether the instance object outputs a log through the program function interface according to a matching result.
Specifically, the system obtains the class name of the instance object through the internal structure of the instance object, and judges whether the class names exist in the class data source and match the same class name of the instance object.
If the log output control does not exist, the instance object is not required to be subjected to log output control, and whether the instance object outputs the log or not can be determined according to the pre-stored codes, for example, whether the instance object needs to output the log or not is determined by judging the grade of the instance object.
If so, the instance object is required to be subjected to log output control. And acquiring the attribute names of the instance objects and the attribute values of the plurality of instance objects contained under the attribute names of the instance objects through the internal structure. Then, inquiring the matching attribute value matched with the attribute value of the instance object through the class data source and the constraint condition corresponding to the matching attribute value.
It should be noted that, the attribute values of the instance object may correspond to a plurality of matching attribute values, and further correspond to a plurality of constraint conditions, and because of different constraint conditions, the instance object may exist in a situation of allowing log output and prohibiting log output at the same time, so that to solve such a problem, a corresponding algorithm needs to be introduced.
The system pre-stores a corresponding algorithm (referred to herein as a first algorithm) that is useful in handling multiple constraints, and the first algorithm is introduced to solve the above problem, and can determine whether the instance object needs to output a log according to a corresponding priority rule, or a manner in which several constraint conditions are ignored when they exist simultaneously. Specifically, the system obtains a calculation result according to the constraint condition and a pre-stored first algorithm, wherein the calculation result is used for determining whether the instance object outputs a log through the program function interface.
Furthermore, the above case is only for the case where the instance object attribute values belong to the same instance object attribute name. When the number of the attribute names of the instance object is not less than two, the number of the attribute names matched with the attribute names of the instance object is not less than two.
In order to solve the problem, the application introduces a corresponding algorithm (referred to herein as a second algorithm) for processing multiple calculation results, and the basic logic of the second algorithm may be the same as that of the first algorithm. Specifically, the control program function interface outputs or does not output a log of the instance object according to a pre-stored second algorithm and a plurality of calculation results.
In one embodiment, before the system obtains the attribute names of the instance objects through the internal structure and the attribute values of the plurality of instance objects contained under the attribute names of the instance objects, the system can also determine that the internal structure has private attribute access rights, and at this time, the system can obtain the private attribute access rights through a pre-stored operation algorithm, and then obtain the attribute names of the instance objects and the attribute values of the instance objects through the internal structure.
In one embodiment, the system obtains the attribute names of the instance objects and a plurality of attribute values of the instance objects contained under the attribute names of the instance objects through an internal structure, and specifically comprises: the system acquires an attribute extraction algorithm corresponding to the internal structure, and acquires an instance object attribute name and a plurality of instance object attribute values contained under the instance object attribute name according to the attribute extraction algorithm.
In one embodiment, the system may further determine that an output log exists at the program function interface, and further store the log into a corresponding log file according to a level of the log, so as to implement classification management on the log, where the log level at least includes: DEBUG, INFO, WARN, ERROR, FATAL, etc.
In one embodiment, as shown in fig. 2, the embodiment of the present application further provides a control device for log dynamic output, including:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the following instructions:
determining a program function interface and acquiring an instance object through the program function interface;
carrying out reflection processing on the instance object to obtain the internal structure of the instance object;
and matching the internal structure with corresponding matching conditions in the class data source, and determining whether the instance object outputs a log through the program function interface according to a matching result.
In one embodiment, the present application also provides a non-volatile computer storage medium storing computer-executable instructions configured to:
determining a program function interface and acquiring an instance object through the program function interface;
carrying out reflection processing on the instance object to obtain the internal structure of the instance object;
and matching the internal structure with corresponding matching conditions in the class data source, and determining whether the instance object outputs a log through the program function interface according to a matching result.
The log is dynamically output and controlled, so that the log output is more flexible and convenient, redundant codes and repeated work caused by the log control under special conditions are greatly reduced, the log is completely output according to the output conditions required by a developer, the output of useless logs is reduced, the waste of server resources is reduced, in addition, the internal structure of an instance object is acquired in a reflection mode, the codes are more flexible, and the application expandability is greatly improved.
The embodiments of the present application are described in a progressive manner, and the same and similar parts of the embodiments are all referred to each other, and each embodiment is mainly described in the differences from the other embodiments. In particular, for the apparatus and medium embodiments, the description is relatively simple, as it is substantially similar to the method embodiments, with reference to the section of the method embodiments being relevant.
The devices and media provided in the embodiments of the present application are in one-to-one correspondence with the methods, so that the devices and media also have similar beneficial technical effects as the corresponding methods, and since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media are not repeated here.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (7)

1. A method for controlling log dynamic output, comprising:
determining a program function interface and acquiring an instance object through the program function interface;
carrying out reflection processing on the instance object to obtain the internal structure of the instance object;
Matching the internal structure with corresponding matching conditions in a class data source, and determining whether the instance object outputs a log through the program function interface according to a matching result;
before determining the program function interface and acquiring the instance object through the program function interface, the method further comprises:
determining the name of a matching object class needing to control log output;
acquiring a plurality of attribute names contained in the matching object class name, and selecting from the attribute names to obtain the matching attribute names needing to be controlled to be output by the log;
acquiring a plurality of attribute values contained in the matching attribute names, and selecting from the attribute values to control the matching attribute values output by the log;
Determining constraint conditions corresponding to the matching attribute values, wherein the types of the constraint conditions at least comprise: a log output permission type and a log output prohibition type;
Adding the class name, the matching attribute value and the constraint condition of the matching object to a class data source to serve as a matching condition of the class data source and an instance object;
Matching the internal structure with a corresponding matching condition in a class data source, and determining whether the instance object outputs a log through the program function interface according to a matching result, wherein the method specifically comprises the following steps:
acquiring an instance object class name through the internal structure, and judging whether a matching object class name identical to the instance object class name exists in a class data source or not;
If not, determining whether the instance object outputs a log according to a pre-stored code;
If so, acquiring an instance object attribute name and a plurality of instance object attribute values contained under the instance object attribute name through the internal structure; querying a matching attribute value matched with the instance object attribute value and a constraint condition corresponding to the matching attribute value through the class data source; obtaining a calculation result according to the constraint condition and a pre-stored first algorithm, wherein the calculation result is used for determining whether the instance object outputs a log through the program function interface;
After obtaining the calculation result according to the constraint condition and a pre-stored first algorithm, the method further comprises:
determining that the number of the attribute names of the instance object is not less than two;
and determining to obtain a plurality of calculation results, and controlling the program function interface to output or not output the log of the instance object according to a pre-stored second algorithm and the plurality of calculation results.
2. The method for controlling log dynamic output according to claim 1, wherein before obtaining an instance object attribute name and a plurality of instance object attribute values contained under the instance object attribute name through the internal structure, the method comprises:
Determining that the private attribute access rights exist in the internal structure;
And acquiring the private attribute access rights through a pre-stored operation algorithm.
3. The method for controlling log dynamic output according to claim 1, wherein obtaining, through the internal structure, an instance object attribute name and a plurality of instance object attribute values contained under the instance object attribute name specifically comprises:
acquiring an attribute extraction algorithm corresponding to the internal structure;
And running the attribute extraction algorithm to obtain an instance object attribute name and a plurality of instance object attribute values contained under the instance object attribute name.
4. The method for controlling log dynamic output according to claim 1, wherein the reflecting process is performed on the instance object to obtain an internal structure of the instance object, and the method specifically comprises:
Adding a JAVA reflection algorithm on the program function interface, wherein the JAVA reflection algorithm is used for carrying out real-time reflection processing on the instance object;
Acquiring a byte code file of the instance object through the JAVA reflection algorithm, and writing the byte code file into a class name file which is created in advance in a memory;
and obtaining the internal structure of the instance object.
5. The method for controlling log dynamic output according to claim 1, further comprising:
determining that an output log exists at the program function interface;
and storing the log into a corresponding log file according to the level of the log.
6. A control device for log dynamic output, comprising:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform the following instructions:
determining a program function interface and acquiring an instance object through the program function interface;
carrying out reflection processing on the instance object to obtain the internal structure of the instance object;
Matching the internal structure with corresponding matching conditions in a class data source, and determining whether the instance object outputs a log through the program function interface according to a matching result;
Before determining the program function interface and acquiring the instance object through the program function interface, the method further comprises the following steps:
determining the name of a matching object class needing to control log output;
acquiring a plurality of attribute names contained in the matching object class name, and selecting from the attribute names to obtain the matching attribute names needing to be controlled to be output by the log;
acquiring a plurality of attribute values contained in the matching attribute names, and selecting from the attribute values to control the matching attribute values output by the log;
Determining constraint conditions corresponding to the matching attribute values, wherein the types of the constraint conditions at least comprise: a log output permission type and a log output prohibition type;
Adding the class name, the matching attribute value and the constraint condition of the matching object to a class data source to serve as a matching condition of the class data source and an instance object;
Matching the internal structure with a corresponding matching condition in a class data source, and determining whether the instance object outputs a log through the program function interface according to a matching result, wherein the method specifically comprises the following steps:
acquiring an instance object class name through the internal structure, and judging whether a matching object class name identical to the instance object class name exists in a class data source or not;
If not, determining whether the instance object outputs a log according to a pre-stored code;
If so, acquiring an instance object attribute name and a plurality of instance object attribute values contained under the instance object attribute name through the internal structure; querying a matching attribute value matched with the instance object attribute value and a constraint condition corresponding to the matching attribute value through the class data source; obtaining a calculation result according to the constraint condition and a pre-stored first algorithm, wherein the calculation result is used for determining whether the instance object outputs a log through the program function interface;
according to the constraint condition and a pre-stored first algorithm, after obtaining a calculation result, the method further comprises the following steps:
determining that the number of the attribute names of the instance object is not less than two;
and determining to obtain a plurality of calculation results, and controlling the program function interface to output or not output the log of the instance object according to a pre-stored second algorithm and the plurality of calculation results.
7. A non-transitory computer storage medium storing computer-executable instructions, the computer-executable instructions configured to:
determining a program function interface and acquiring an instance object through the program function interface;
carrying out reflection processing on the instance object to obtain the internal structure of the instance object;
Matching the internal structure with corresponding matching conditions in a class data source, and determining whether the instance object outputs a log through the program function interface according to a matching result;
Before determining the program function interface and acquiring the instance object through the program function interface, the method further comprises the following steps:
determining the name of a matching object class needing to control log output;
acquiring a plurality of attribute names contained in the matching object class name, and selecting from the attribute names to obtain the matching attribute names needing to be controlled to be output by the log;
acquiring a plurality of attribute values contained in the matching attribute names, and selecting from the attribute values to control the matching attribute values output by the log;
Determining constraint conditions corresponding to the matching attribute values, wherein the types of the constraint conditions at least comprise: a log output permission type and a log output prohibition type;
Adding the class name, the matching attribute value and the constraint condition of the matching object to a class data source to serve as a matching condition of the class data source and an instance object;
Matching the internal structure with a corresponding matching condition in a class data source, and determining whether the instance object outputs a log through the program function interface according to a matching result, wherein the method specifically comprises the following steps:
acquiring an instance object class name through the internal structure, and judging whether a matching object class name identical to the instance object class name exists in a class data source or not;
If not, determining whether the instance object outputs a log according to a pre-stored code;
If so, acquiring an instance object attribute name and a plurality of instance object attribute values contained under the instance object attribute name through the internal structure; querying a matching attribute value matched with the instance object attribute value and a constraint condition corresponding to the matching attribute value through the class data source; obtaining a calculation result according to the constraint condition and a pre-stored first algorithm, wherein the calculation result is used for determining whether the instance object outputs a log through the program function interface;
according to the constraint condition and a pre-stored first algorithm, after obtaining a calculation result, the method further comprises the following steps:
determining that the number of the attribute names of the instance object is not less than two;
and determining to obtain a plurality of calculation results, and controlling the program function interface to output or not output the log of the instance object according to a pre-stored second algorithm and the plurality of calculation results.
CN202111004801.1A 2021-08-30 2021-08-30 Control method, equipment and medium for log dynamic output Active CN113687973B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111004801.1A CN113687973B (en) 2021-08-30 2021-08-30 Control method, equipment and medium for log dynamic output

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111004801.1A CN113687973B (en) 2021-08-30 2021-08-30 Control method, equipment and medium for log dynamic output

Publications (2)

Publication Number Publication Date
CN113687973A CN113687973A (en) 2021-11-23
CN113687973B true CN113687973B (en) 2024-06-25

Family

ID=78584037

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111004801.1A Active CN113687973B (en) 2021-08-30 2021-08-30 Control method, equipment and medium for log dynamic output

Country Status (1)

Country Link
CN (1) CN113687973B (en)

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9800455B1 (en) * 2012-02-08 2017-10-24 Amazon Technologies, Inc. Log monitoring system
US11556396B2 (en) * 2015-05-08 2023-01-17 Seth Lytle Structure linked native query database management system and methods
CN105488412A (en) * 2015-06-19 2016-04-13 哈尔滨安天科技股份有限公司 Malicious code detection method and system based on android terminal log
US10474381B2 (en) * 2017-03-29 2019-11-12 The Travelers Indemnity Company Multi-server system resource manager
CN111488439B (en) * 2020-03-18 2023-04-18 杭州迪普科技股份有限公司 System and method for saving and analyzing log data
CN111881012A (en) * 2020-08-10 2020-11-03 深圳大势智能科技有限公司 Log recording method, device, equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
Performance of Polar Code MIMO Systems with Matched-Filter Detector and Interference Cancellation;Yuto Hama 等;IEEE;20200227;1-6 *
基于混合人工免疫算法的流程挖掘事件日志融合方法;徐杨;袁峰;林琪;汤德佑;李东;;软件学报;20170324(02);176-196 *

Also Published As

Publication number Publication date
CN113687973A (en) 2021-11-23

Similar Documents

Publication Publication Date Title
CN106897205B (en) Test data generation method and device
CN106990960B (en) Code deployment method and device
CN113079200A (en) Data processing method, device and system
CN110704037A (en) Rule engine implementation method and device
CN115129716A (en) Data management method, equipment and storage medium for industrial big data
CN111400681A (en) Data permission processing method, device and equipment
CN114091099A (en) Authority hierarchical control method, equipment and storage medium for business system
CN108874379B (en) Page processing method and device
CN111240987B (en) Method and device for detecting migration program, electronic equipment and computer readable storage medium
CN113687973B (en) Control method, equipment and medium for log dynamic output
CN111131474A (en) Method, device and medium for managing user protocol based on block chain
CN111435327B (en) Log record processing method, device and system
CN110928941A (en) Data fragment extraction method and device
CN111435495A (en) Service processing method, device and equipment
CN113282541B (en) File calling method and device and electronic equipment
CN114791884A (en) Test environment construction method and device, storage medium and electronic equipment
CN107436728B (en) Rule analysis result storage method, rule backtracking method and device
CN110969461B (en) Method and device for processing public number information, storage medium and processor
CN110554867B (en) Application processing method and device
CN106844056B (en) Hadoop big data platform multi-tenant job management method and system
CN112749159A (en) Form generation method and device, electronic equipment and storage medium
CN111324368A (en) Data sharing method and server
CN112540835B (en) Method and device for operating hybrid machine learning model and related equipment
CN110851750B (en) Data acquisition method and device
CN107479899B (en) File processing method and device, storage medium and processor

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant