Log generation method and device, electronic equipment and computer readable storage medium
By accessing interceptor plug-in and log management service components in the application system, dynamically record and process business logs, the problem of coupling log printing code and business processing logic is solved, and the simplicity of code and the flexibility and accuracy of log generation are improved. .
Patent Information
- Application Number
- CN202310763422.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-26
- Publication Date
- 2024-12-27
AI Technical Summary
The prior art embeds log printing code in the business processing logic in the application system, resulting in the coupling of the log printing code with the business processing logic, increasing the development complexity and code mixing, and reducing the simplicity and readability of the code.
Access the interceptor plug-in in the application system, configure the method to be intercepted, the interceptor plug-in generates intercept logs at runtime, and sends them to the log management service component for processing, and dynamically updates the interceptor plug-in to realize the recording and management of business logs.
It reduces the repetitive log printing code writing during the development process, reduces the coupling between business log printing code and business processing logic, improves the simplicity and readability of the code, and improves the flexibility and accuracy of log generation.
Smart Images

Figure CN119201662A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer and Internet technology, and in particular to a log generation method and device, an electronic device, and a computer-readable storage medium. Background Art
[0002] The related technology mainly realizes printing each specific business log into a log file by adding log printing statements in the application system. However, the above method requires writing log printing code for each place where logs need to be printed during the development process, resulting in a lot of repetitive work.
[0003] In addition to adding a lot of repetitive work in the development process, the above method also couples the code for printing and recording logs with the business processing logic, causing the actual business processing logic code to be mixed with a lot of business-irrelevant code, reducing the simplicity and beauty of the code, and to a certain extent acting as a "distraction factor" to reduce the readability of the code. Summary of the invention
[0004] The purpose of the present disclosure is to provide a log generation method, device, electronic device and computer-readable storage medium, which can reduce the sporadic nature of log printing and business processing logic and improve the flexibility and accuracy of log printing.
[0005] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0006] An embodiment of the present disclosure provides a log generation method, comprising: connecting an interception plug-in in an application system, wherein the interception plug-in is configured with a method to be intercepted; when the application system runs the code corresponding to the method to be intercepted, the interception plug-in intercepts the code corresponding to the method to be intercepted to generate an interception log corresponding to the method to be intercepted; the interception plug-in sends the interception log to a log management service component so that the log management service component processes the interception log.
[0007] In some embodiments, the method further includes: the interception plug-in obtains the latest method to be intercepted according to a preset period; updates the method to be intercepted in the interception plug-in according to the latest method to be intercepted, so that the interception plug-in intercepts the method in the application system according to the updated method to be intercepted.
[0008] In some embodiments, the latest method to be intercepted includes a newly added interception method and a deleted interception method; wherein, updating the method to be intercepted in the interception plug-in according to the latest method to be intercepted includes: adding the newly added interception method to the method to be intercepted in the interception plug-in; deleting the deleted interception method from the method to be intercepted in the interception plug-in.
[0009] In some embodiments, accessing an interception plug-in in an application system includes: introducing the interception plug-in in the application system; configuring a path corresponding to the interception plug-in in an application startup command of the application system; and starting the application system to access the interception plug-in in the application system.
[0010] In some embodiments, the interception log corresponding to the method to be intercepted includes the corresponding method input parameters, method response or exception information during the execution of the method to be intercepted when the method to be intercepted is run in the application system.
[0011] In some embodiments, the method to be intercepted is in the target class of the application system, and the class to be intercepted is configured in the interception plug-in; wherein, when the application system runs the code corresponding to the method to be intercepted, the interception plug-in intercepts the code corresponding to the method to be intercepted to generate an interception log corresponding to the method to be intercepted, including: when the application system runs the code corresponding to the class to be intercepted, the interception plug-in intercepts the code corresponding to the class to be intercepted to generate an interception log corresponding to the class to be intercepted.
[0012] In some embodiments, the log management service component processes the interception log, including: the log management service component displays the application identification of the application system, the method name of the method to be intercepted, the interception start time, the interception end time, the method input parameters, and the method response exception information.
[0013] The embodiment of the present disclosure provides a log generating device, including: a plug-in insertion module, an interception module and a log generating module.
[0014] Among them, the plug-in insertion module is used to connect an interception plug-in in the application system, wherein the interception plug-in is configured with the method to be intercepted; the interception module can be used for the interception plug-in to intercept the code corresponding to the method to be intercepted when the application system runs the code corresponding to the method to be intercepted, so as to generate an interception log corresponding to the method to be intercepted; the log generation module can be used for the interception plug-in to send the interception log to the log management service component so that the log management service component can process the interception log.
[0015] An embodiment of the present disclosure provides an electronic device, which includes: a memory and a processor; the memory is used to store program instructions; the processor calls the program instructions stored in the memory to implement any of the log generation methods described above.
[0016] The embodiment of the present disclosure provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the log generation method as described in any one of the above items is implemented.
[0017] The embodiment of the present disclosure provides a computer program product or a computer program, which includes a computer instruction stored in a computer-readable storage medium. A processor of a 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 above-mentioned log generation method.
[0018] The log generation method, device, electronic device and computer-readable storage medium provided by the embodiments of the present disclosure, by connecting an interception plug-in configured with the method to be intercepted in the application system, so as to generate an interception log corresponding to the method to be intercepted when the application system triggers the method to be intercepted, thereby reducing the coupling between the Sunrise generation logic and the business logic, and improving the flexibility and accuracy of the log generation process by including the log to be intercepted in the interception plug-in.
[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0021] Figure 1 A schematic diagram showing an exemplary system architecture that can be applied to a log generation method or a log generation device according to an embodiment of the present disclosure is shown.
[0022] Figure 2 The figure is a flow chart of a log generating method according to an exemplary embodiment.
[0023] Figure 3 The figure is a flow chart of a log generating method according to an exemplary embodiment.
[0024] Figure 4 The figure is a flow chart of a log generating method according to an exemplary embodiment.
[0025] Figure 5 The figure is a flow chart of a log generating method according to an exemplary embodiment.
[0026] Figure 6 It is a framework diagram corresponding to a log generation method shown according to an exemplary embodiment.
[0027] Figure 7 The figure is a diagram showing an effect of configuring a page for an interception method according to an exemplary embodiment.
[0028] Figure 8 The figure is a page effect diagram of a log display according to an exemplary embodiment.
[0029] Fig. 9 The figure is a block diagram of a log generating device according to an exemplary embodiment.
[0030] Fig.10 A schematic diagram of the structure of an electronic device suitable for implementing the embodiments of the present disclosure is shown. DETAILED DESCRIPTION
[0031] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be comprehensive and complete and will fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0032] The features, structures or characteristics described in the present disclosure may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring the various aspects of the present disclosure.
[0033] The accompanying drawings are only schematic diagrams of the present disclosure, and the same reference numerals in the drawings represent the same or similar parts, so their repeated description will be omitted. Some block diagrams shown in the accompanying drawings do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0034] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and steps, nor must they be executed in the order described. For example, some steps can be decomposed, and some steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0035] In the description of the present application, unless otherwise specified, " / " means "or", for example, A / B can mean A or B. "And / or" in this article is only a kind of association relationship describing the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, "at least one" means one or more, and "plurality" means two or more. The words "first", "second", etc. do not limit the quantity and execution order, and the words "first", "second", etc. do not limit them to be different; the terms "comprising", "including" and "having" are used to express the meaning of open inclusion and mean that in addition to the listed elements / components / etc., there may be other elements / components / etc.
[0036] In order to more clearly understand the above-mentioned objects, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific implementation methods. It should be noted that the embodiments of the present application and the features in the embodiments can be combined with each other without conflict.
[0037] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.
[0038] For example, to count the usage of our products / services, we will aggregate, analyze and use the technically processed user data, and share the processed statistical information with third parties. We will use secure encryption technology and other methods to ensure that the recipient of the information cannot re-identify a specific individual.
[0039] In related technologies, if a company has an application system that provides a service interface to the outside world and connects with merchants through a system, it is usually necessary to record the original messages sent down by the merchants for review when needed. Whether it is a call between internal systems of the company or an internal operation of the system, it is necessary to record the request and response messages of certain key processing flows or service interfaces to assist in troubleshooting online problems.
[0040] Currently, most systems record business request input parameters and business logs by printing logs to log files in the application system. To print business logs in the application system, you need to embed the log printing statements into the business process code during system development, and then print the log content to be recorded to the log file.
[0041] In the application system, by adding log printing statements, each specific business log can be printed into the log file. During the development process, it is necessary to write log printing code for each place where logs need to be printed.
[0042] In addition to adding a lot of repetitive work in the development process, it also couples the code for printing and recording logs with the business processing logic, causing the actual business processing logic code to be mixed with a lot of business-irrelevant code, reducing the simplicity and beauty of the code, and to a certain extent acting as a "distraction factor" to reduce the readability of the code.
[0043] In order to solve the above technical problems, the present application provides the following embodiments.
[0044] The exemplary embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0045] Figure 1 A schematic diagram showing an exemplary system architecture that can be applied to a log generation method or a log generation device according to an embodiment of the present disclosure is shown.
[0046] like Figure 1 As shown, the system architecture 100 may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.
[0047] Users can use terminal devices 101, 102, 103 to interact with server 105 through network 104 to receive or send messages, etc. Terminal devices 101, 102, 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, desktop computers, wearable devices, virtual reality devices, smart homes, etc.
[0048] The server 105 may be a server that provides various services, such as a background management server that provides support for devices operated by users using the terminal devices 101, 102, and 103. The background management server may analyze and process the received request data, and feed back the processing results to the terminal device.
[0049] The server can be an independent physical server or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as basic cloud computing services such as big data and artificial intelligence platforms, etc. The present disclosure does not impose any restrictions on this.
[0050] The server 105 may, for example, connect an interception plug-in to the application system, wherein the interception plug-in is configured with the method to be intercepted; the server 105 may, for example, intercept the code corresponding to the method to be intercepted when the application system runs the code corresponding to the method to be intercepted, so as to generate an interception log corresponding to the method to be intercepted; the server 105 may, for example, have the interception plug-in send the interception log to the log management service component so that the log management service component processes the interception log.
[0051] It should be understood that Figure 1 The number of terminal devices, networks and servers in the figure is only for illustration. The server 105 may be a physical server or may be composed of multiple servers. According to actual needs, it may have any number of terminal devices, networks and servers.
[0052] Based on the above architecture, this application proposes the following log generation method.
[0053] Figure 2 is a flow chart of a log generation method according to an exemplary embodiment. The method provided by the embodiment of the present disclosure can be executed by any electronic device with computing processing capabilities. For example, the method can be executed by the above Figure 1 The server or terminal device in the embodiment may be executed, or the server and the terminal device may be executed together. In the following embodiments, the server is used as the execution subject for example, but the present disclosure is not limited to this.
[0054] Reference Figure 2 The log generation method provided by the embodiment of the present disclosure may include the following steps.
[0055] Step S202: inserting an interception plug-in into the application system, wherein the interception plug-in is configured with the method to be intercepted.
[0056] The above-mentioned application system can be any system, which can be an application system, a background server system, etc., and this application does not impose any restrictions on this.
[0057] The above interception plug-in can be an Agent interception plug-in
[0058] Among them, in the related technology, agent technology can be used to build an agent program (i.e., an agent interception plug-in) independent of the application program to assist in monitoring, running, or even replacing programs on other JVMs. It can be used to implement AOP (Aspect Oriented Programming) functions at the virtual machine level.
[0059] In some embodiments, the above-mentioned interception plug-in can be implemented through hook technology, and the application does not impose any restrictions on this.
[0060] The above-mentioned interception plug-in can be used to intercept methods, classes, etc. in the application system, and this application does not impose any restrictions on this.
[0061] Step S204, when the application system runs the code corresponding to the method to be intercepted, the interception plug-in intercepts the code corresponding to the method to be intercepted to generate an interception log corresponding to the method to be intercepted.
[0062] In some embodiments, the interception log corresponding to the method to be intercepted includes the corresponding method input parameters, method response or exception information during the execution of the method to be intercepted when the method to be intercepted is run in the application system.
[0063] Step S206: The interception plug-in sends the interception log to the log management service component so that the log management service component processes the interception log.
[0064] In some embodiments, the log management service component processes the interception log and may include: the log management service component displays the application identification of the application system, the method name of the method to be intercepted, the interception start time, the interception end time, the method input parameters, and the method response exception information.
[0065] In some embodiments, the method to be intercepted may be in a target class of the application system, and the interception plug-in may be configured with the class to be intercepted. Then, when the application system runs the code corresponding to the method to be intercepted, the interception plug-in intercepts the code corresponding to the method to be intercepted to generate an interception log corresponding to the method to be intercepted, which may include: when the application system runs the code corresponding to the class to be intercepted, the interception plug-in intercepts the code corresponding to the class to be intercepted to generate an interception log corresponding to the class to be intercepted.
[0066] The solution proposed in the present invention can reduce the repetitive work of writing printing log codes during the development process, solve the problem of coupling business log printing codes and business processing logic together, improve the simplicity and beauty of the code, and improve the readability of the code to a certain extent.
[0067] Figure 3 The figure is a flow chart of a log generating method according to an exemplary embodiment.
[0068] refer to Figure 3 , the above log generation method may include the following steps.
[0069] Step S302: inserting an interception plug-in into the application system, wherein the interception plug-in is configured with the method to be intercepted.
[0070] Step S304: the interception plug-in obtains the latest method to be intercepted according to a preset period.
[0071] In some embodiments, those skilled in the art can configure the latest method to be intercepted through the log management component as needed. The interception plug-in can obtain the latest interception method from the log management service component according to a preset period, and the interception plug-in can also pull the latest method to be intercepted from the log management component when the method to be intercepted in the log management component is updated. This application does not limit this.
[0072] Step S306, updating the method to be intercepted in the interception plug-in according to the latest method to be intercepted.
[0073] Step S308, when the application system runs the code corresponding to the method to be intercepted, the interception plug-in intercepts the code corresponding to the method to be intercepted to generate an interception log corresponding to the method to be intercepted.
[0074] Step S310: The interception plug-in sends the interception log to the log management service component so that the log management service component processes the interception log.
[0075] The solution proposed by the present invention is to realize the recording of business logs of business requests and business processing in a dynamic and configurable manner based on dynamic interception technology. This reduces the repetitive work of writing and printing log codes in the development process, solves the problem of coupling business log printing codes with business processing logic, improves the simplicity and beauty of the code, and improves the readability of the code to a certain extent.
[0076] Figure 4 The figure is a flow chart of a log generating method according to an exemplary embodiment.
[0077] refer to Figure 4 , the above log generation method may include the following steps.
[0078] In some embodiments, the latest method to be intercepted may include a newly added interception method and a deleted interception method.
[0079] Step S402: inserting an interception plug-in into the application system, wherein the interception plug-in is configured with the method to be intercepted.
[0080] Step S404: the interception plug-in obtains the latest method to be intercepted according to a preset period.
[0081] Step S406: Add a new interception method to the methods to be intercepted in the interception plug-in.
[0082] Step S408, deleting the interception method to be deleted from the methods to be intercepted in the interception plug-in.
[0083] Step S410, when the application system runs the code corresponding to the method to be intercepted, the interception plug-in intercepts the code corresponding to the method to be intercepted to generate an interception log corresponding to the method to be intercepted.
[0084] Step S412: The interception plug-in sends the interception log to the log management service component so that the log management service component processes the interception log.
[0085] Through the above method, the interception method in the interception plug-in can be configured dynamically and configurably, so that the business logs of business requests and business processing can be recorded dynamically and configurably. This reduces the repetitive work of writing printing log codes during the development process, solves the problem of coupling business log printing codes with business processing logic, improves the simplicity and beauty of the code, and improves the readability of the code to a certain extent.
[0086] Figure 5 The figure is a flow chart of a log generating method according to an exemplary embodiment.
[0087] refer to Figure 5 , the above log generation method may include the following steps.
[0088] Step S502: introducing an interception plug-in into the application system.
[0089] Step S504: configure the path corresponding to the interception plug-in in the application startup command of the application system.
[0090] Step S506, starting the application system to access the interception plug-in in the application system, wherein the interception plug-in is configured with the method to be intercepted.
[0091] Step S508, when the application system runs the code corresponding to the method to be intercepted, the interception plug-in intercepts the code corresponding to the method to be intercepted to generate an interception log corresponding to the method to be intercepted.
[0092] Step S510: The interception plug-in sends the interception log to the log management service component so that the log management service component processes the interception log.
[0093] Through the above method, an interception plug-in can be inserted into the application system, so that the interception plug-in can intercept the log information corresponding to the method to be intercepted when the application system runs the code corresponding to the method to be intercepted.
[0094] Figure 6 It is a framework diagram corresponding to a log generation method shown according to an exemplary embodiment.
[0095] In some embodiments, the above-mentioned log generation method can be implemented based on the Java language by connecting an Agent interception plug-in to the application system, configuring the method that needs to record business requests or logs, and intercepting the execution of the corresponding method in the application system, recording the input parameters, response, and exception information thrown during the execution of the method.
[0096] In some embodiments, the log generation method may include two parts, an Agent interception plug-in and a log management service component. When the application is connected to the Agent interception plug-in, the automatic interception of the business process execution method code can be realized by obtaining the configured method that needs to be intercepted, and the intercepted business log information is sent out through the message middleware. In the log management service component, the intercepted business log message is received and saved in the database, and then the business processing log can be viewed through the front-end page.
[0097] Among them, message middleware, also known as message queue, refers to the use of efficient and reliable message transmission mechanism for platform-independent data exchange and the integration of distributed systems based on data communication.
[0098] The log generation method provided in this embodiment firstly connects the Agent interception plug-in to the application system, introduces the Agent plug-in package to the application system, configures the Agent interception command in the application startup command, and then starts the application program to realize the connection of the Agent interception plug-in.
[0099] Then, define the method that the corresponding application system needs to intercept in the log management service component. The Agent interception plug-in will obtain the latest interception method definition every 1 minute. Trigger the business method code to be intercepted in the application system. The Agent plug-in automatically intercepts the business processing method execution code based on the definition of the configured interception method, and sends the intercepted log information through asynchronous tasks and the message middleware to send the business log message. The basic definition of the business log message can be as follows:
[0100] Fields illustrate appCode Application Coding appName Application Name traceId Log tracking flag methodName Method Name startTime Start time endTime End Time paramJson Method parameter responseJson Method Response exception Is the method execution abnormal? exStackTrace Exception stack information
[0101] The log management service component receives intercepted business log messages and saves them in the database. It also cleans up historical business log data regularly through scheduled tasks, and can decide how many days of online log data to keep based on the amount of business log data and actual needs.
[0102] The recorded business logs can then be viewed on the provided front-end management page.
[0103] On the interception method configuration management page, you can add the method definition to be intercepted, enable or disable method interception, and delete the interception method definition. The page effect is as follows Figure 7 shown.
[0104] On the business log viewing page, you can filter and query the logs you want to view by application, time, log tracking identifier, input keyword, and other conditions, and you can view the details of a business log. The page effect can be as follows Figure 8 shown.
[0105] The key point of this embodiment is to connect the Agent interception plug-in in the application system, configure the business method to be intercepted, and then run the corresponding business method in the application system to record and save the business request message and business method operation log.
[0106] Through the above method, the interception method in the interception plug-in can be configured dynamically and configurably, so that the business logs of business requests and business processing can be recorded dynamically and configurably. This reduces the repetitive work of writing printing log codes during the development process, solves the problem of coupling business log printing codes with business processing logic, improves the simplicity and beauty of the code, and improves the readability of the code to a certain extent.
[0107] Based on the same inventive concept, the present disclosure also provides a log generation device in the following embodiments. Since the principle of solving the problem in the device embodiment is similar to that in the above method embodiment, the implementation of the device embodiment can refer to the implementation of the above method embodiment, and the repeated parts will not be repeated.
[0108] Fig. 9 is a block diagram of a log generating device according to an exemplary embodiment. Fig. 9 The log generating device 900 provided in the embodiment of the present disclosure may include: a plug-in insertion module 901 , an interception module 902 , and a log generating module 903 .
[0109] Among them, the plug-in insertion module 901 can be used to connect an interception plug-in in the application system, wherein the interception plug-in is configured with the method to be intercepted; the interception module 902 can be used to intercept the code corresponding to the method to be intercepted when the application system runs the code corresponding to the method to be intercepted, so as to generate an interception log corresponding to the method to be intercepted; the log generation module 903 can be used for the interception plug-in to send the interception log to the log management service component so that the log management service component can process the interception log.
[0110] It should be noted that the above-mentioned plug-in insertion module 901, interception module 902 and log generation module 903 correspond to S202 to S206 in the method embodiment, and the examples and application scenarios implemented by the above-mentioned modules and corresponding steps are the same, but are not limited to the contents disclosed in the above-mentioned method embodiment. It should be noted that the above-mentioned modules as part of the device can be executed in a computer system such as a set of computer executable instructions.
[0111] In some embodiments, the log generating device 900 may further include: a latest method to be intercepted acquisition module and an interception method update module.
[0112] Among them, the latest method to be intercepted acquisition module can be used by the interception plug-in to obtain the latest method to be intercepted according to a preset period; the interception method update module can be used to update the method to be intercepted in the interception plug-in according to the latest method to be intercepted, so that the interception plug-in can intercept the method in the application system according to the updated method to be intercepted.
[0113] In some embodiments, the latest method to be intercepted includes a newly added interception method and a deleted interception method; wherein the interception method update module may include: a adding unit and a deleting unit.
[0114] Among them, the adding unit can be used to add a new interception method to the method to be intercepted in the interception plug-in; the deleting unit can be used to delete the deleted interception method from the method to be intercepted in the interception plug-in.
[0115] In some embodiments, the plug-in insertion module 901 may include: a plug-in introduction unit, a path configuration unit, and a startup unit.
[0116] Among them, the plug-in introduction unit can be used to introduce the interception plug-in into the application system; the path configuration unit can be used to configure the path corresponding to the interception plug-in in the application startup command of the application system; the startup unit can be used to start the application system to access the interception plug-in in the application system.
[0117] In some embodiments, the interception log corresponding to the method to be intercepted includes the corresponding method input parameters, method response or exception information during the execution of the method to be intercepted when the method to be intercepted is run in the application system.
[0118] In some embodiments, the method to be intercepted is in the target class of the application system, and the class to be intercepted is configured in the interception plug-in; wherein, the interception module 902 may include: a class interception unit.
[0119] Among them, the class interception unit can be used for the interception plug-in to intercept the code corresponding to the class to be intercepted when the application system runs the code corresponding to the class to be intercepted, so as to generate an interception log corresponding to the class to be intercepted.
[0120] In some embodiments, the log generation module 903 may include: a display unit.
[0121] Among them, the display unit can be used for the log management service component to display the application system's application identification, method name of the method to be intercepted, interception start time, interception end time, method input parameters, and method response exception information.
[0122] Since the functions of the device 900 have been described in detail in the corresponding method embodiments, the present disclosure will not elaborate on them here.
[0123] The modules and / or units involved in the embodiments described in the present application may be implemented by software or hardware. The modules and / or units described may also be arranged in a processor. The names of these modules and / or units do not, in certain circumstances, constitute limitations on the modules and / or units themselves.
[0124] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present application. In this regard, each box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the above-mentioned module, program segment or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0125] In addition, the above-mentioned figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above-mentioned figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0126] Fig.10 The structure diagram of the electronic device suitable for implementing the embodiment of the present disclosure is shown. It should be noted that: Fig.10 The electronic device 1000 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0127] like Fig.10As shown, the electronic device 1000 includes a central processing unit (CPU) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage part 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 are also stored. The CPU 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0128] The following components are connected to the I / O interface 1005: an input section 1006 including a keyboard, a mouse, etc.; an output section 1007 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 1008 including a hard disk, etc.; and a communication section 1009 including a network interface card such as a LAN card, a modem, etc. The communication section 1009 performs communication processing via a network such as the Internet. A drive 1010 is also connected to the I / O interface 1005 as needed. A removable medium 1011, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 1010 as needed, so that a computer program read therefrom is installed into the storage section 1008 as needed.
[0129] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part 1009, and / or installed from a removable medium 1011. When the computer program is executed by a central processing unit (CPU) 1001, the above-mentioned functions defined in the system of the present application are executed.
[0130] It should be noted that the computer-readable storage medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The computer-readable signal medium may also be any computer-readable storage medium other than a computer-readable storage medium that can send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable storage medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0131] As another aspect, the present application also provides a computer-readable storage medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed by a device, the device can realize functions including: connecting an interception plug-in in the application system, wherein the interception plug-in is configured with a method to be intercepted; when the application system runs the code corresponding to the method to be intercepted, the interception plug-in intercepts the code corresponding to the method to be intercepted to generate an interception log corresponding to the method to be intercepted; the interception plug-in sends the interception log to the log management service component so that the log management service component processes the interception log.
[0132] According to one aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the method provided in various optional implementations of the above-mentioned embodiments.
[0133] Through the description of the above implementation methods, it is easy for those skilled in the art to understand that the example implementation methods described here can be implemented by software, or by combining software with necessary hardware. Therefore, the technical solution of the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), including several instructions for a computing device (which can be a personal computer, a server, a mobile terminal, or a smart device, etc.) to execute the method according to the embodiment of the present disclosure.
[0134] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the disclosure disclosed herein. The present disclosure 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 technical means in the art that are not applied for by the present disclosure. The specification and examples are to be regarded as exemplary only, and the true scope and spirit of the present disclosure are indicated by the claims.
[0135] It should be understood that the present disclosure is not limited to the detailed structures, drawings or implementations shown herein, but rather the present disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.
Claims
1. A log generation method, characterized in that: include: Connecting an interception plug-in to the application system, wherein the interception plug-in is configured with a method to be intercepted; When the application system runs the code corresponding to the method to be intercepted, the interception plug-in intercepts the code corresponding to the method to be intercepted to generate an interception log corresponding to the method to be intercepted; The interception plug-in sends the interception log to the log management service component so that the log management service component processes the interception log.
2. The method according to claim 1, characterized in that: The method further comprises: The interception plug-in obtains the latest method to be intercepted according to a preset period; The method to be intercepted in the interception plug-in is updated according to the latest method to be intercepted, so that the interception plug-in intercepts the method in the application system according to the updated method to be intercepted.
3. The method according to claim 2, characterized in that: The latest method to be intercepted includes a newly added interception method and a deleted interception method; wherein, updating the method to be intercepted in the interception plug-in according to the latest method to be intercepted includes: Add the newly added interception method to the method to be intercepted in the interception plug-in; The deleted interception method is deleted from the method to be intercepted in the interception plug-in.
4. The method according to claim 1, characterized in that: Connect the interception plug-in to the application system, including: Introducing the interception plug-in into the application system; Configuring the path corresponding to the interception plug-in in the application startup command of the application system; The application system is started to access the interception plug-in in the application system.
5. The method according to claim 1, characterized in that: The interception log corresponding to the method to be intercepted includes the corresponding method input parameters, method response or exception information during the execution of the method to be intercepted when the method to be intercepted is run in the application system.
6. The method according to claim 1, characterized in that: The log management service component processes the interception log, including: The log management service component displays the application identification of the application system, the method name of the method to be intercepted, the interception start time, the interception end time, the method input parameters, and the method response exception information.
7. The method according to claim 1, characterized in that: The method to be intercepted is in the target class of the application system, and the interception plug-in is configured with the class to be intercepted; wherein, when the application system runs the code corresponding to the method to be intercepted, the interception plug-in intercepts the code corresponding to the method to be intercepted to generate an interception log corresponding to the method to be intercepted, including: When the application system runs the code corresponding to the class to be intercepted, the interception plug-in intercepts the code corresponding to the class to be intercepted to generate an interception log corresponding to the class to be intercepted.
8. A log generating device, characterized in that: include: A plug-in insertion module, used to access an interception plug-in in the application system, wherein the interception plug-in is configured with a method to be intercepted; An interception module, configured to cause the interception plug-in to intercept the code corresponding to the method to be intercepted when the application system runs the code corresponding to the method to be intercepted, so as to generate an interception log corresponding to the method to be intercepted; The log generation module is used for the interception plug-in to send the interception log to the log management service component so that the log management service component processes the interception log.
9. An electronic device, characterized in that: include: Memory; as well as A processor coupled to the memory, the processor being configured to execute the log generating method according to any one of claims 1 to 7 based on instructions stored in the memory.
10. A computer-readable storage medium having program instructions stored thereon, wherein the program instructions, when executed by a processor, implement the log generating method according to any one of claims 1 to 7.
