Log record acquisition method and device, electronic equipment and storage medium

By obtaining and matching the attribute information and configuration files of the log object, the log record acquisition path is dynamically adjusted, which solves the problems of long-term, low flexibility and low real-time performance of the existing log record acquisition method, and realizes efficient, flexible and real-time log record acquisition.

CN119597608APending Publication Date: 2025-03-11LIANBAO (HANGZHOU) INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411810258.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-10
Publication Date
2025-03-11

AI Technical Summary

Technical Problem

The existing log record acquisition methods have problems such as long time, low flexibility and low real-time performance. Especially under the microservice architecture, the log styles of different business modules are not unified, resulting in high cost of post-maintenance and problem-solving.

Method used

By obtaining the log attribute information of the log object in the target project, determining the target log object based on the annotation information, and setting the target project configuration file based on the target user's demand information, matching information to determine the target record acquisition path, and finally inserting the logging logic into the path to obtain the demand log record.

Benefits of technology

It improves the real-time determination of target log objects and the flexibility and accuracy of target log acquisition paths, reduces the time to obtain required log records, and improves the accuracy and efficiency of logging acquisition.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119597608A_ABST
    Figure CN119597608A_ABST
Patent Text Reader

Abstract

The invention discloses a log record obtaining method and device, electronic equipment and a storage medium, and the method comprises the steps that log attribute information of a log object in a target project is obtained, and the log attribute information comprises annotation information; determining a target log object from the log objects based on the annotation information; setting a target project configuration file corresponding to the target project based on the target demand information of the target user; based on the target project configuration file and log attribute information corresponding to the target log object, performing information matching, and determining a target record acquisition path corresponding to the target log object; on the basis of the target project configuration file, log record logic is inserted into the target record obtaining path corresponding to the target log object, and the demand log record of the target log object is obtained.By means of the technical scheme, the real-time performance and flexibility of obtaining the demand log record are improved, the time for obtaining the demand log record is shortened, and the user experience is improved. And the accuracy of demand log recording is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software development, and in particular to a log record acquisition method, device, electronic device and storage medium. Background Art

[0002] In modern software development, the acquisition of log records is a crucial part. Logs are not only used to record the operating status of the system, but also for debugging, performance monitoring, and security auditing. Log records are an important means to ensure system maintainability and troubleshooting. However, with the increase in system complexity, different modules and functional components have different requirements for log records, and log confusion and non-standard problems frequently occur. Especially under the microservice architecture, the log styles of different business modules are not unified, resulting in high costs for later maintenance and troubleshooting. In addition, developers often need to spend a lot of extra energy on log configuration and monitoring, rather than focusing on the development of business functions.

[0003] Although the existing logging solutions support basic log output, they are obviously insufficient in terms of business scalability, customized log output, and fine-grained support for performance monitoring. Therefore, a new log record acquisition method is needed to solve the problems of long time consumption, low flexibility, and low real-time performance in log record acquisition. Summary of the invention

[0004] In view of this, the embodiments of the present invention provide a log record acquisition method, device, electronic device and storage medium to solve the technical problems existing in log record acquisition, such as long time consumption, low flexibility and low real-time performance.

[0005] One aspect of the present invention provides a log record acquisition method, the method comprising the following steps:

[0006] Obtain log attribute information of a log object in a target project, wherein the log attribute information includes annotation information of the log object;

[0007] Based on the annotation information, determining a target log object from the log objects;

[0008] Based on the target demand information of the target user, setting a target project configuration file corresponding to the target project;

[0009] Based on the target project configuration file and the log attribute information corresponding to the target log object, information matching is performed to determine the target record acquisition path corresponding to the target log object;

[0010] Based on the target project configuration file, a log record logic is inserted into the target record acquisition path corresponding to the target log object to obtain a required log record of the target log object.

[0011] Another aspect of the present invention provides a method and device for obtaining demand log records, the device comprising:

[0012] An information acquisition module, used to acquire log attribute information of a log object in a target project, wherein the log attribute information includes annotation information of the log object;

[0013] A first determination module, configured to determine a target log object from the log objects based on the annotation information;

[0014] A setting module, used to set a target project configuration file corresponding to the target project based on the target demand information of the target user;

[0015] A second determination module is used to match information based on the target project configuration file and the log attribute information corresponding to the target log object, and determine the target record acquisition path corresponding to the target log object;

[0016] The record acquisition module is used to insert log record logic into the target record acquisition path corresponding to the target log object based on the target project configuration file to obtain the required log record of the target log object.

[0017] Another aspect of the present invention provides an electronic device, comprising:

[0018] processor;

[0019] a memory for storing instructions executable by the processor;

[0020] The processor is configured to execute the instructions to implement any of the log record acquisition methods described above.

[0021] Yet another aspect of the present invention provides a computer-readable storage medium, which, when instructions in the storage medium are executed by a processor of an electronic device, enables the electronic device to execute any of the log record acquisition methods described above.

[0022] The present invention provides a log record acquisition method, device, electronic device and storage medium. The method acquires log attribute information of a log object in a target project and determines a target log object from the log object based on annotation information in the log attribute information. The method improves the real-time performance of determining the target log object and sets a target project configuration file corresponding to the target project based on target demand information of a target user. The method matches information based on the log attribute information corresponding to the target project configuration file and the target log object to determine a target record acquisition path corresponding to the target log object. The method dynamically adjusts the target project configuration file according to different target demand information of the target user, thereby improving the flexibility, accuracy and demand for determining the target record acquisition path. The method further inserts log record logic into the target record acquisition path corresponding to the target log object based on the target project configuration file to obtain a demand log record of the target log object, thereby improving the accuracy of obtaining the demand log record and reducing the time for obtaining the demand log record. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions and advantages in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0024] Figure 1 is a flow chart of a log record acquisition method provided according to an exemplary embodiment;

[0025] Figure 2 is a schematic diagram of a process for obtaining log attribute information provided according to an exemplary embodiment;

[0026] Figure 3 is a schematic diagram of a flow chart of determining a target record acquisition path provided according to an exemplary embodiment;

[0027] Figure 4 It is a flow chart of determining a target record acquisition path based on log attribute information corresponding to a target parsed file and a target log object according to an exemplary embodiment;

[0028] Figure 5 is a flow chart of obtaining a demand log record according to an exemplary embodiment;

[0029] Figure 6 A schematic diagram of a process for determining a required log record based on a log record format according to an exemplary embodiment;

[0030] Figure 7It is a structural diagram of a log record acquisition device provided according to an exemplary embodiment. DETAILED DESCRIPTION

[0031] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.

[0032] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or server that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0033] Figure 1 1 is a flow chart of a log record acquisition method provided according to an exemplary embodiment. The following uses a processor as an execution subject to introduce an embodiment of a log record acquisition method of the present application. Specifically, Figure 1 As shown, the method includes:

[0034] S101: Obtain log attribute information of a log object in a target project, wherein the log attribute information includes annotation information of the log object.

[0035] In a specific embodiment, the target project may be a project program running in the system; the log object may be a class or method in the target project; the log attribute information may be characteristic information of the log object. Specifically, the log attribute information may include annotation information and log name information of the log object. Specifically, the annotation information may be marking information of the log object, for example, special usage of the marked class in the annotation information of a class in the target project; specifically, during the application of the target project, the information acquisition method of the target project is called in real time to obtain the log attribute information of the log object in the target project.

[0036] Figure 2 is a flow chart of obtaining log attribute information according to an exemplary embodiment. Figure 2 As shown, the above method may also include:

[0037] S201: Obtaining an initial configuration file corresponding to the target project;

[0038] S203: When the target project is started, based on the initial configuration file, a program reflection mechanism is used to obtain log objects in the target project and log attribute information of the log objects.

[0039] In a specific embodiment, the initial configuration file can be a configuration information storage file corresponding to the target project. Optionally, the initial configuration file can be a configuration file directly corresponding to the target project, or it can be an initial configuration file corresponding to the target object in the target project. Specifically, the configuration information can include information such as log path, log format and log rule; optionally, the initial configuration file also includes dependency information and loading path corresponding to the target project. Specifically, the dependency information is used to represent the association information between the log object and the target project, and the loading path is the acquisition path of the log object when the target project is started; specifically, the Java reflection mechanism is referenced in the target project. Optionally, the Java reflection mechanism allows the project program to check and operate the internal structure of the class at runtime. Specifically, when the target project is started, the target project uses the dynamic class loading method to load the Jar package in the target project. Specifically, the target project will obtain the initial configuration file corresponding to the target project, and then dynamically load the log object corresponding to the target project based on the dependency information in the initial configuration file. Further, the log attribute information of the log object is obtained. Optionally, when the target project is started, the initial configuration file is parsed and the dependency information in the initial configuration file is obtained. Further, the obtained initial configuration file and log attribute information of the log object are stored.

[0040] In the above embodiment, the initial configuration file corresponding to the target project is obtained, and the log attribute information of the target object is obtained based on the initial configuration file, which improves the accuracy and pertinence of obtaining the log attribute information, and further improves the flexibility of obtaining the required log records.

[0041] S103: Determine a target log object from the log objects based on the annotation information.

[0042] In a specific embodiment, the target log object may be a log object that needs to be logged in the log objects of the target project; optionally, the target log object may be a log object containing specific annotations, and accordingly, the specific annotations of the log object may be customized by the target user, that is, the target user may specify the log object that needs to be recorded. Specifically, the target user adds a custom annotation, such as @Loggable, to the target object that needs to be monitored, indicating the log content that the processor needs to record. Optionally, the annotation may include meta-annotations and configuration parameter annotations, so that the log objects in the target project have different annotation information. Based on the annotation information of the log object, the log object that needs to be logged is screened, that is, it is determined as the target log object.

[0043] S105: Based on the target demand information of the target user, a target project configuration file corresponding to the target project is set.

[0044] In a specific embodiment, the target user may be any user who uses the target project; the target requirement information may be the target user's requirement information for log records; the target project configuration file may be a file storing target configuration information corresponding to the target project, and specifically, the target configuration information may include information such as log level, log output path, and log formatting mode; optionally, the remote target project configuration file may be read through an HTTP request, or the local target project configuration file may be read using a file I / O operation; optionally, the initial configuration file may also be read using the above method;

[0045] Specifically, the target demand information of the target user is obtained, and based on the requirements in the target demand information, the target project configuration file corresponding to the target project is set. Specifically, the processor maintains a connection with the configuration center through a long connection (such as HTTP's Server-SentEvents or WebSocket). Once the configuration changes, the configuration center will push an update notification to the terminal processor. After receiving the notification, the processor updates the local configuration, that is, updates the target configuration file. Specifically, based on the target demand information, the log level, log output path, log formatting mode, etc. corresponding to the target log object in the target project configuration file are set. Optionally, the log level, log output path, log formatting mode, etc. corresponding to other log objects in the target project configuration file can also be set. Specifically, other log objects can be log objects other than the target log object in the log objects corresponding to the target project configuration file.

[0046] S107: performing information matching based on the target project configuration file and the log attribute information corresponding to the target log object, and determining a target record acquisition path corresponding to the target log object.

[0047] In a specific embodiment, the target record acquisition path may be a path for acquiring log records of a target log object; specifically, the log output path in the target project configuration file and the log attribute information corresponding to the target log object are matched to determine the target record acquisition path corresponding to the target log object.

[0048] Figure 3 FIG. 1 is a flow chart of determining a target record acquisition path according to an exemplary embodiment. In an optional embodiment, Figure 3 As shown, the information matching based on the target project configuration file and the log attribute information corresponding to the target log object to determine the target record acquisition path corresponding to the target log object may include:

[0049] S301: Obtain target parsing format;

[0050] S303: Based on the target parsing format, use a parsing program to parse the target project configuration file to obtain a target parsing file;

[0051] S305: performing information matching based on the target parsing file and the log attribute information corresponding to the target log object, and determining a target record acquisition path corresponding to the target log object.

[0052] In a specific embodiment, the target parsing format can be a log format that can be recognized by the processor; specifically, a parsing program is introduced into the target project, and the target parsing format corresponding to the parsing program is obtained. Accordingly, based on the target parsing format, the introduced parsing program is used to perform format parsing on the target project configuration file, and further, a target parsing file is obtained. Accordingly, based on the log attribute information corresponding to the target parsing file and the target log object, information matching is performed to determine the target record acquisition path corresponding to the target log object. Optionally, the introduced parsing program can also be used to parse the initial configuration file, and then the initial configuration file is parsed into a file that can be recognized by the processor.

[0053] In the above embodiment, by setting a parsing program in the target project and using the parsing program to parse the target project configuration file based on the target parsing format to obtain a target parsing file, the convenience of program recognition is improved, thereby improving the accuracy and flexibility of information matching.

[0054] Figure 4The present invention is a flow chart of determining a target record acquisition path based on log attribute information corresponding to a target parsing file and a target log object according to an exemplary embodiment. In an optional embodiment, the target parsing file includes path keyword information; the log attribute information includes log name information; the target log object includes a correct target log object; Figure 4 As shown, the above-mentioned information matching based on the target parsing file and the log attribute information corresponding to the target log object to determine the target record acquisition path corresponding to the target log object may include:

[0055] S401: performing information matching based on the path keyword information and the log name information corresponding to the target log object to determine the correct target log object;

[0056] S403: Determine the log output path of the correct target log object in the target parsing file as the target record acquisition path corresponding to the correct target log object.

[0057] In a specific embodiment, the path keyword information may be keyword information of a target output path of a target log object corresponding to a target parsed file; optionally, the path keyword information may include information such as a package name, a class name, and a method name arranged in sequence; specifically, after parsing the target project configuration file, the log output path of the target log object corresponding to the target parsed file is obtained, and accordingly, the path keyword information of the log output path of the target log object is intercepted. Optionally, the path keyword information may be intercepted according to the prior art or a custom interception logic. Specifically, a custom method may be set and embedded in the target project to intercept the path keyword.

[0058] Specifically, the path keyword information obtained from the target parsing file and the log name information of the target log object are matched, and accordingly, an information matching result is obtained. Further, the target log object whose path keyword information and log name information are successfully matched as indicated by the information matching result is determined as the correct target log object, and the log output path corresponding to the correct target log object in the target parsing file is determined as the target record acquisition path of the correct target log object; optionally, the target log object whose path keyword information and log name information do not match as indicated by the information matching result is determined as an incorrect target log object, and a warning message is displayed to the target user, prompting the target user to modify the log output path corresponding to the incorrect target log object in the target project configuration file.

[0059] In the above embodiment, the correct target log object and the erroneous target log object are determined by matching the path keyword information with the log attribute information of the target log object, and the correct log object is corresponded to the log output path in the target parsing file to determine the target record acquisition path, thereby improving the accuracy and real-time performance of determining the target record acquisition path and reducing the time for determining the target record acquisition path. Furthermore, by determining the erroneous target log object and displaying warning information to the target user, a prompt is generated to the target user, thereby improving the rationality and rigor of the technical solution of the present application.

[0060] S109: Based on the target project configuration file, insert log record logic into the target record acquisition path corresponding to the target log object to obtain the required log record of the target log object.

[0061] In a specific embodiment, based on the target project configuration file, the log record logic is inserted into the target record acquisition path corresponding to the target log object, and the log record of the target log object is acquired, and accordingly, the required log record of the target log object is obtained.

[0062] Figure 5 is a flow chart of obtaining a demand log record according to an exemplary embodiment. In an optional embodiment, Figure 5 As shown, the above-mentioned inserting log record logic into the target record acquisition path corresponding to the target log object based on the target project configuration file to obtain the required log record of the target log object may include:

[0063] S501: Based on the target project configuration file, determine the cut point, connection point, notification and cut surface of the target record acquisition path using aspect-oriented programming technology;

[0064] S503: Based on the tangent points, connection points, notifications and aspects of the target record acquisition path, inserting log record logic into the target record acquisition path to obtain the required log record.

[0065] In a specific embodiment, based on parameter information such as the pointcut expression defined in the target project configuration file, aspect-oriented programming technology, namely AOP technology, is used to locate the pointcut of the target record acquisition path, that is, to determine the execution points that can be notified in the application, and then determine the connection points, notifications and aspects of the target record acquisition path. Before and after the target log object is called, the logging logic is dynamically inserted using the aspect. The parameters of the target log object can be recorded before the target log object is called, and the return value and execution result of the target log object can be recorded after the target log object is called, and then recorded as the demand log record.

[0066] In the above embodiment, based on parameter information such as the pointcut expression defined in the target project configuration file, aspect-oriented programming technology is used to determine the pointcut, aspect, connection point and aspect of the target record acquisition path, and the log record logic is inserted before and after the pointcut positioning of the target record acquisition path of the target log object, and then corresponding records are made before and after the target log object is called to obtain the required log record, which improves the accuracy and flexibility of obtaining the required log record and reduces the time of obtaining the required log record.

[0067] Figure 6 is a flow chart of determining a required log record based on a log record format according to an exemplary embodiment. In an optional embodiment, Figure 6 As shown, the above method may also include:

[0068] S601: Obtaining log record format;

[0069] S603: Based on the log record format, record the log record corresponding to the target log object to obtain the required log record, and monitor the required log record.

[0070] In a specific embodiment, the log record format can be a log format that can be recognized by the target project; optionally, the JSON format is selected as the log record format in this application, and accordingly, other formats can also be selected as the Japanese record format based on the needs of the target users; specifically, the parsing program can also provide the record format of the required log record, and accordingly, when the log records such as parameters, return values ​​and execution results corresponding to the target log object are obtained, the parsing program is used to convert the format of the obtained log records based on the log record format, and then the required log records are obtained, and the obtained required log records are monitored.

[0071] In the above embodiment, the log records of the target log object are recorded based on the log record format to obtain the required log records, which reduces the complexity of parsing and analysis, improves the readability of information, and improves the convenience of reading the required log records, thereby improving the wide application of the target project.

[0072] In an optional embodiment, the above method may further include:

[0073] In case there is a problem in monitoring the demand log record, an alarm message and a problem log are displayed to the target user.

[0074] In a specific embodiment, when the demand log record is obtained, the log demand record will be sent to the monitoring platform through the transmission protocol. Optionally, the transmission protocol can be the HTTP API transmission protocol or any other transmission protocol, and the monitoring platform can be a log management tool such as Elasticsearch and Splunk; accordingly, on the monitoring platform, a visualization tool is used to display and analyze the log data, and the system operation status and performance are monitored in real time. The optional visualization tool can be a tool such as Kibana. Furthermore, alarm information is set on the monitoring platform. When the monitoring platform detects that there is a problem with the demand log record, alarm information and problem log results are generated. Accordingly, the problem log results are used to indicate the problem log object. Further, the monitoring platform returns the alarm information and problem log results to the processor, and the terminal processor displays the alarm information and problem log object to the target user. The target user can modify the problem log object based on actual needs.

[0075] In the above embodiment, by monitoring the demand log records and displaying the alarm information and problem log results to the user when problems are detected in the log records, the user can intuitively view the problem, thereby improving the rationality of log record acquisition and the rigor of the solution, and further improving the security of the target project program.

[0076] It can be seen from the technical solutions provided by the above embodiments of the present application that the technical solution of the present application obtains the log attribute information of the log object in the target project according to the dependency information corresponding to the target project in the initial configuration file based on the program reflection mechanism and the dynamic class loading method in the startup phase of the target project, and determines the target log object from the log object based on the annotation information in the log attribute information, and sets the target project configuration file corresponding to the target project based on the target demand information of the target user. Further, based on the path keyword information in the target project configuration file and the log attribute information corresponding to the target log object, information matching is performed to determine the target record acquisition path corresponding to the target log object, and then based on the target project configuration file, the log record logic is inserted into the target record acquisition path corresponding to the target log object to obtain the required log record of the target log object, the target project configuration file is changed based on user needs, and the target record acquisition path is determined based on the target project configuration file, thereby realizing the acquisition of the required log record, improving the real-time and flexibility of obtaining the required log record, reducing the time for obtaining the required log record, and improving the accuracy of the required log record. Furthermore, the target project in the present application can be seamlessly integrated with the existing mainstream log framework and monitoring platform, supports rapid deployment and migration, can adapt to the needs of different environments, and improves the applicability of the project.

[0077] Figure 7is a structural diagram of a log record acquisition method and device provided according to an exemplary embodiment. The following uses a processor as an execution subject to introduce an embodiment of a log record acquisition device of the present application. Specifically, Figure 7 As shown, the device comprises:

[0078] An acquisition module 701 is used to acquire log attribute information of a log object in a target project, wherein the log attribute information includes annotation information of the log object;

[0079] A first determination module 703, configured to determine a target log object from the log objects based on the annotation information;

[0080] A setting module 705 is used to set a target project configuration file corresponding to the target project based on the target demand information of the target user;

[0081] The second determination module 707 is used to perform information matching based on the target project configuration file and the log attribute information corresponding to the target log object, and determine the target record acquisition path corresponding to the target log object;

[0082] The record acquisition module 709 is used to insert log record logic into the target record acquisition path corresponding to the target log object based on the target project configuration file, so as to obtain the required log record of the target log object.

[0083] In an optional embodiment, the record acquisition module 709 includes:

[0084] Aspect determination unit, used to determine the cut point, connection point, notification and aspect of the target record acquisition path based on the target project configuration file using aspect-oriented programming technology;

[0085] A recording unit is obtained, which is used to obtain the tangent point, connection point, notification and aspect of the path based on the target record, insert the logging logic into the monitoring method, and obtain the required log record.

[0086] In an optional embodiment, the record acquisition module 709 further includes:

[0087] A record format acquisition unit, used to acquire a log record format;

[0088] The monitoring unit is used to record the log record corresponding to the target log object based on the log record format, obtain the required log record, and monitor the required log record.

[0089] In an optional embodiment, the record acquisition module 709 further includes an alarm unit, which is used to:

[0090] In case there is a problem in monitoring the demand log record, an alarm message and a problem log are displayed to the target user.

[0091] In an optional embodiment, the acquisition module 701 includes:

[0092] An initial acquisition unit, used to acquire an initial configuration file corresponding to the target project;

[0093] The property acquisition unit is used to acquire the log object in the target project and the log property information of the log object based on the initial configuration file and using the program reflection mechanism when the target project is started.

[0094] In an optional embodiment, the second determining module 707 includes:

[0095] A parsing format acquisition unit, used to acquire a target parsing format;

[0096] A parsing unit, configured to parse the target project configuration file using a parsing program based on the target parsing format to obtain a target parsing file;

[0097] The path determination unit is used to perform information matching based on the target parsing file and the log attribute information corresponding to the target log object, and determine the target record acquisition path corresponding to the target log object.

[0098] In an optional embodiment, the target parsing file includes path keyword information; the log attribute information includes log name information; the target log object includes a correct target log object; and the path determination unit includes:

[0099] A correct object determination subunit, used to match information based on the path keyword information and the log name information corresponding to the target log object, and determine the correct target log object;

[0100] The output path determination subunit is used to determine the log output path of the correct target log object in the target parsing file as the target record acquisition path corresponding to the correct target log object.

[0101] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0102] In an exemplary embodiment, an electronic device is also provided, including: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement the log record acquisition method as in the embodiment of the present disclosure.

[0103] In an exemplary embodiment, a computer-readable storage medium is also provided. When instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the log record acquisition method in the embodiment of the present disclosure.

[0104] In an exemplary embodiment, a computer program product or a computer program is also provided, the computer program product or the computer program includes a computer instruction, the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer instruction from the computer-readable storage medium, and the processor executes the computer instruction, so that the computer device executes the log record acquisition method provided in the above various optional implementations.

[0105] It is understandable that in the specific implementation of this application, user-related data is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.

[0106] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0107] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.

[0108] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A log record acquisition method, characterized in that: The method comprises: Obtain log attribute information of a log object in a target project, wherein the log attribute information includes annotation information of the log object; Based on the annotation information, determining a target log object from the log objects; Based on the target demand information of the target user, setting a target project configuration file corresponding to the target project; Based on the target project configuration file and the log attribute information corresponding to the target log object, information matching is performed to determine the target record acquisition path corresponding to the target log object; Based on the target project configuration file, a log record logic is inserted into the target record acquisition path corresponding to the target log object to obtain a required log record of the target log object.

2. The method according to claim 1, characterized in that The inserting of log record logic into the target record acquisition path based on the target project configuration file to obtain the required log record of the target log object includes: Based on the target project configuration file, using aspect-oriented programming technology to determine the cut-off point, connection point, notification and aspect of the target record acquisition path; Based on the tangent points, connection points, notifications and aspects of the target record acquisition path, the logging logic is inserted into the monitoring method to obtain the required log record.

3. The method according to claim 2, characterized in that The method further comprises: Get the log record format; Based on the log record format, the log record corresponding to the target log object is recorded to obtain the required log record, and the required log record is monitored.

4. The method according to claim 3, characterized in that The method further comprises: In case there is a problem in monitoring the demand log record, an alarm message and a problem log are displayed to the target user.

5. The method according to claim 1, characterized in that The step of obtaining log attribute information of the log object in the target project includes: Obtaining an initial configuration file corresponding to the target project; When the target project is started, the log object in the target project and the log attribute information of the log object are obtained based on the initial configuration file and by using a program reflection mechanism.

6. The method according to claim 1, characterized in that The performing information matching based on the target project configuration file and the log attribute information corresponding to the target log object to determine the target record acquisition path corresponding to the target log object includes: Get the target parsing format; Based on the target parsing format, using a parsing program to parse the target project configuration file to obtain a target parsing file; Based on the target parsing file and the log attribute information corresponding to the target log object, information matching is performed to determine the target record acquisition path corresponding to the target log object.

7. The method according to claim 6, characterized in that The target parsing file includes path keyword information; the log attribute information includes log name information; the target log object includes a correct target log object; and the information matching based on the target parsing file and the log attribute information corresponding to the target log object to determine the target record acquisition path corresponding to the target log object includes: Based on the path keyword information and the log name information corresponding to the target log object, information matching is performed to determine the correct target log object; The log output path of the correct target log object in the target parsing file is determined as the target record acquisition path corresponding to the correct target log object.

8. A log record acquisition device, characterized in that: The device comprises: An acquisition module, used to acquire log attribute information of a log object in a target project, wherein the log attribute information includes annotation information of the log object; A first determination module, configured to determine a target log object from the log objects based on the annotation information; A setting module, used to set a target project configuration file corresponding to the target project based on the target demand information of the target user; A second determination module is used to match information based on the target project configuration file and the log attribute information corresponding to the target log object, and determine the target record acquisition path corresponding to the target log object; The record acquisition module is used to insert log record logic into the target record acquisition path corresponding to the target log object based on the target project configuration file to obtain the required log record of the target log object.

9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the log record acquisition method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the log record acquisition method as claimed in any one of claims 1 to 7.