CN117472716A - Non-invasive application log acquisition method, device, equipment and storage medium - Google Patents
Non-invasive application log acquisition method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN117472716A CN117472716A CN202311480837.6A CN202311480837A CN117472716A CN 117472716 A CN117472716 A CN 117472716A CN 202311480837 A CN202311480837 A CN 202311480837A CN 117472716 A CN117472716 A CN 117472716A
- Authority
- CN
- China
- Prior art keywords
- log
- target interface
- target
- interface
- application program
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 88
- 230000008569 process Effects 0.000 claims abstract description 38
- 238000004806 packaging method and process Methods 0.000 claims abstract description 16
- 238000004590 computer program Methods 0.000 claims description 19
- 230000007246 mechanism Effects 0.000 claims description 4
- 238000005516 engineering process Methods 0.000 abstract description 4
- 238000010586 diagram Methods 0.000 description 10
- 230000015654 memory Effects 0.000 description 9
- 238000004891 communication Methods 0.000 description 8
- 230000006870 function Effects 0.000 description 8
- 238000012545 processing Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 4
- 238000012986 modification Methods 0.000 description 4
- 230000002085 persistent effect Effects 0.000 description 4
- 238000004458 analytical method Methods 0.000 description 3
- 238000011161 development Methods 0.000 description 3
- 230000003287 optical effect Effects 0.000 description 3
- 238000010276 construction Methods 0.000 description 2
- 230000014509 gene expression Effects 0.000 description 2
- 230000004044 response Effects 0.000 description 2
- 239000008186 active pharmaceutical agent Substances 0.000 description 1
- 238000007405 data analysis Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 239000000835 fiber Substances 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000000758 substrate Substances 0.000 description 1
- 230000009466 transformation Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/30—Monitoring
- G06F11/34—Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
- G06F11/3466—Performance evaluation by tracing or monitoring
- G06F11/3476—Data logging
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/1805—Append-only file systems, e.g. using logs or journals to store data
- G06F16/1815—Journaling file systems
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45533—Hypervisors; Virtual machine monitors
- G06F9/45558—Hypervisor-specific management and integration aspects
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- General Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Debugging And Monitoring (AREA)
Abstract
The present disclosure provides a non-invasive application log collection method, apparatus, device, storage medium and program product, which can be applied to the fields of computer technology and financial science and technology. The method comprises the following steps: acquiring a target interface in an application program, wherein the target interface is a target object for acquiring logs; setting a front-end call interceptor comprising log output logic, and packaging the front-end call interceptor into a file package plug-in; configuring parameters of a target interface in a file package plug-in, defining the target interface as a target object of a collection log, and enabling a front call interceptor to operate and use before the target interface is called; when the application program is started, the file package plug-in is loaded on a virtual machine process of the application program, and the log of the target interface is output according to log output logic.
Description
Technical Field
The present disclosure relates to the field of computer technology and financial technology, and in particular, to a non-invasive application log collection method, apparatus, device, medium, and program product.
Background
After long-time informatization construction, enterprises build a large number of business systems around business demands. These systems are complex and decentralized, not necessarily following the same development specifications, and at the later operation and maintenance, there are the following problems in terms of application logs: many business systems do not strictly follow development specifications during construction, and application logs are incomplete and unclear and have no analysis value; the output formats of application logs of the business systems are different, and automatic analysis is difficult to carry out after collection; according to the prior art log output scheme, a service system manually outputs a corresponding log in a development process according to the self requirement, and the log only meets the self analysis requirement of the service system and does not have data analysis value. If a certain type of log of each service system needs to be collected uniformly, each service system needs to be developed and modified by itself, not only the modification cost is generated, but also the problems of log missing and non-uniform format are generated due to the manual modification.
Disclosure of Invention
In view of the foregoing, the present disclosure provides a non-invasive application log collection method, apparatus, device, medium, and program product.
According to a first aspect of the present disclosure, there is provided a non-invasive application log collection method, including: acquiring a target interface in an application program, wherein the target interface is a target object for acquiring logs; setting a front-end call interceptor comprising log output logic, and packaging the front-end call interceptor into a file package plug-in; configuring parameters of the target interface in the file package plug-in, defining the target interface as a target object of an acquisition log, and enabling the pre-call interceptor to operate and use before the target interface is called; and when the application program is started, loading the file package plug-in to a virtual machine process of the application program, and outputting the log of the target interface according to the log output logic.
According to an embodiment of the present disclosure, the acquiring a target interface in an application program, where the target interface is a target object of an acquisition log includes: confirming a log target to be acquired, wherein the log target at least comprises an application program name, an interface name and an interface parameter; and identifying a target interface in at least one application program based on the log target, wherein the target interface comprises a plurality of interfaces in the same system, and the interfaces are respectively arranged in different application programs of the system.
According to an embodiment of the present disclosure, the acquiring a target interface in an application program, where the target interface is a target object of an acquisition log includes: confirming a log target to be acquired, wherein the log target at least comprises a system name, an application program name, an interface name and an interface parameter; identifying a target interface in an application of the plurality of systems based on the log target; wherein the target interface comprises at least one interface among different applications within different systems.
According to an embodiment of the disclosure, configuring parameters of the target interface in the file package plug-in, defining the target interface as a target object of an acquisition log, and enabling the pre-call interceptor to operate before the target interface is called includes: searching a corresponding target interface in the application program based on the parameters of the target interface configured in the file package plug-in; and in the running process of the application program, adding the pre-call interceptor in the call byte code of the target interface before the target interface is called through a JAVA Instrument mechanism.
According to an embodiment of the disclosure, when the application program is started, loading the package plug-in to a virtual machine process of the application program, and outputting the log of the target interface according to the log output logic includes: when a system to which the application program belongs is started, a Java Agent program is called to load the file package plug-in onto a Java virtual machine process of the system to which the application program belongs; before a method for calling the target interface in the JAVA virtual machine process is called, a front-end call interceptor in the file package plug-in is started, and the log of the target interface is output according to the log output logic.
According to an embodiment of the present disclosure, the method further comprises: and when the target interfaces are distributed in different systems, converting the logs of the target interfaces into corresponding log output formats preset by the systems.
A second aspect of the present disclosure provides a non-invasive application log collection device, comprising: the interface acquisition module is used for acquiring a target interface in the application program, wherein the target interface is a target object for acquiring logs; the interceptor setting module is used for setting a front-end call interceptor comprising log output logic and packaging the front-end call interceptor into a file package plug-in; the plug-in configuration module is used for configuring parameters of the target interface in the file package plug-in, defining the target interface as a target object for collecting logs, and enabling the front call interceptor to be operated and used before the target interface is called; and the plug-in loading module is used for loading the file package plug-in to a virtual machine process of the application program when the application program is started, and outputting the log of the target interface according to the log output logic.
A third aspect of the present disclosure provides an electronic device, comprising: one or more processors; and a storage device for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method described above.
A fourth aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above-described method.
A fifth aspect of the present disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the above method.
According to the non-invasive application log acquisition method, device, equipment, medium and program product provided by the disclosure, a pre-call interceptor is added in a call byte code of a target interface by acquiring the target interface in an application program, log output logic is written in the call interceptor, the call byte code added with the pre-call interceptor and the log output logic is packaged into a file package plug-in, the file package plug-in is started in the running process of the application program, and the log of the target interface is output according to the log output logic. Because the preposed call interceptor is added in the call byte code of the target interface, and the log output logic is written in the call interceptor, the method at least partially solves the problem that the log output function is dynamically added to the system by a non-invasive means on the basis of not changing the original system code, and can add the log output on the appointed key api, thereby realizing the technical effect of non-invasive application log acquisition.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be more apparent from the following description of embodiments of the disclosure with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an application scenario diagram of a non-invasive application log collection method, apparatus, device, medium and program product according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a flow chart of a non-intrusive log collector method according to a second embodiment of the disclosure;
FIG. 3 schematically illustrates a block diagram of a non-invasive application log collection device according to a fifth embodiment of the present disclosure;
fig. 4 schematically shows a block diagram of an electronic device adapted to implement a non-invasive application log collection method according to a sixth embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that the description is only exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. In addition, in the following description, descriptions of well-known structures and techniques are omitted so as not to unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and/or the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It should be noted that the terms used herein should be construed to have meanings consistent with the context of the present specification and should not be construed in an idealized or overly formal manner.
Where expressions like at least one of "A, B and C, etc. are used, the expressions should generally be interpreted in accordance with the meaning as commonly understood by those skilled in the art (e.g.," a system having at least one of A, B and C "shall include, but not be limited to, a system having a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
In the technical scheme of the disclosure, the related data (such as including but not limited to personal information of a user) are collected, stored, used, processed, transmitted, provided, disclosed, applied and the like, all conform to the regulations of related laws and regulations, necessary security measures are adopted, and the public welcome is not violated.
The embodiment of the disclosure provides a non-invasive application log acquisition method, which is used for acquiring a target interface in an application program, wherein the target interface is a target object for acquiring logs; setting a front-end call interceptor comprising log output logic, and packaging the front-end call interceptor into a file package plug-in; configuring parameters of a target interface in a file package plug-in, defining the target interface as a target object of a collection log, and enabling a front call interceptor to operate and use before the target interface is called; when the application program is started, the file package plug-in is loaded on a virtual machine process of the application program, and the log of the target interface is output according to log output logic. By adding the front call interceptor in the call byte code of the target interface, the log output logic is written in the call interceptor without changing the original system code, the transformation cost is not generated, the log of the target interface is not changed, and the non-invasive log output is realized.
Fig. 1 schematically illustrates an application scenario diagram of a non-invasive application log collection method, apparatus, device, medium and program product according to an embodiment of the present disclosure.
As shown in fig. 1, an application scenario 100 according to this embodiment may perform non-invasive collection of an application log of a system. The network 104 is a medium used to provide a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 through the network 104 using at least one of the first terminal device 101, the second terminal device 102, the third terminal device 103, to receive or send messages, etc. Various communication client applications, such as a shopping class application, a web browser application, a search class application, an instant messaging tool, a mailbox client, social platform software, etc. (by way of example only) may be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103.
The first terminal device 101, the second terminal device 102, the third terminal device 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 105 may be a server providing various services, such as a background management server (by way of example only) providing support for websites browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103. The background management server may analyze and process the received data such as the user request, and feed back the processing result (e.g., the web page, information, or data obtained or generated according to the user request) to the terminal device.
It should be noted that, the non-invasive application log collection method provided in the embodiments of the present disclosure may be generally performed by the server 105. Accordingly, the non-invasive application log collection device provided by the embodiments of the present disclosure may be generally disposed in the server 105. The non-invasive application log collection method provided by the embodiments of the present disclosure may also be performed by a server or a server cluster that is different from the server 105 and is capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and/or the server 105. Accordingly, the non-invasive application log collection apparatus provided by the embodiments of the present disclosure may also be provided in a server or a server cluster that is different from the server 105 and is capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and/or the server 105.
It should be understood that the number of terminal devices, networks and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
The non-invasive application log collection method of the disclosed embodiment will be described in detail with reference to fig. 2 based on the scenario described in fig. 1.
Fig. 2 schematically illustrates a flow chart of a non-invasive log collector method according to a second embodiment of the disclosure.
As shown in fig. 2, the non-invasive log collection method of this embodiment includes operations S210 to S240.
In operation S210, a target interface in the application is acquired, the target interface being a target object of the acquisition log.
In the embodiment of the disclosure, the target interface needs to be determined according to different types of collected logs, and the collected log types are determined according to requirements, so that the target object to be found is the target interface corresponding to the log types in the application program framework. For example, if the sql log is to be collected, the target object to be found is a persistent layer framework corresponding target interface or a database driver corresponding target interface; if the front-end call log is to be acquired, the target object to be found is a target interface corresponding to the MVC framework layer.
In operation S220, a front-end call interceptor including log output logic is set, and the front-end call interceptor is packaged as a package plug-in.
In the embodiment of the disclosure, the collected log types are different, and the target interfaces are different, so that the call byte codes of the target interfaces and the log output logic written in the pre-call interceptor should be modified correspondingly according to the collected log types. For example, acquiring an sql log, acquiring a target interface corresponding to a persistent layer frame or a target interface corresponding to a database driver, adding a front call interceptor in a call byte code of the target interface corresponding to the persistent layer frame or the target interface corresponding to the database driver, and writing log output logic; acquiring the front-end call log, acquiring a target interface corresponding to the MVC frame layer, adding a front-end call interceptor in a call byte code of the target interface corresponding to the MVC frame layer, and writing log output logic.
The pre-call interceptor is packaged, so that the pre-call interceptor can be used as a plug-in to be applied to a plurality of different application scenes, multiplexing of functions is realized, and a developer can conveniently apply the pre-call interceptor to a target interface to acquire wanted data.
In operation S230, parameters of the target interface are configured in the package plug-in, and the target interface is defined as a target object of the collection log, so that the pre-call interceptor is used before the target interface is called.
In this embodiment, the file package plug-in is configured, so that the file package plug-in can be automatically and accurately inserted into the target interface, and data corresponding to the parameters can be acquired from the target interface.
In operation S240, when the application program is started, the package plug-in is loaded onto a virtual machine process of the application program, and a log of the target interface is output according to the log output logic.
According to the method provided by the embodiment of the disclosure, a target interface to be acquired is determined according to different types of acquisition logs, a pre-call interceptor is written in call byte codes of the target interface before the target interface is called, the call byte codes added with the pre-call interceptor and log output logic are packaged into a file package plug-in, and when a system to which an application program belongs is started, a call agent program loads the file package plug-in to a JAVA virtual machine process of the system to which the application program belongs; when the target interface is called in the JAVA virtual machine process, the log of the target interface is output according to the log output logic.
Specifically, if log collection is to be performed on all items of an enterprise, a pre-call interceptor can be added to a log object for each request call time and consuming time, a log output logic can be written in the pre-call interceptor, url, a request parameter, a return parameter, a request time, a response time and the like of a target interface are output according to a fixed format each time of request and response, the call byte codes added with the pre-call interceptor and the log output logic are packaged into a file package plug-in, when a service system is restarted, the file package plug-in is loaded onto a JAVA virtual machine process of a system to which an application belongs by a call agent program when the service system is started, then a service system of the enterprise outputs a call log in the log according to the requirements, and the enterprise performs unified collection processing on the log, so that non-invasive application log collection can be performed under the condition that the service system code of the enterprise is not changed.
The target interface may include multiple interfaces within the same system, where the multiple interfaces are located in different applications of the system. The three embodiments of the present disclosure are described in detail in the case where the target interface is a plurality of interfaces within the same system.
Specifically, operations S311 to S315 are included.
In operation S311, the log object to be collected is confirmed, and the log object at least includes an application program name, an interface name and an interface parameter.
In operation S312, a target interface in at least one application is identified based on the log target.
In operation S313, a front-end call interceptor including log output logic is set, and the front-end call interceptor is packaged as a package plug-in.
In operation S314, parameters of a target interface are configured in the package insert, and the target interface is defined as a target object of the acquisition log.
Specifically, based on parameters of a configuration target interface in a file package plug-in, searching a corresponding target interface in an application program; and in the running process of the application program, adding a pre-call interceptor in the call byte code of the target interface before the target interface is called through a JAVA Instrument mechanism. Through a Java Instrument mechanism, the calling byte codes of key APIs of an application system can be dynamically modified in a running state (without modifying the application system, and a front calling interceptor is added before the method is called.
In operation S315, when the application is started, the package plug-in is loaded onto the virtual machine process of the application, and the log of the target interface is output according to the log output logic. The method specifically comprises the step of calling a Java Agent program to load a file package plug-in onto a Java virtual machine process of a system to which an application program belongs when the system to which the application program belongs is started. Before a method for calling a target interface in a JAVA virtual machine process is called, a front-end call interceptor in a file package plug-in is started, and a log of the target interface is output according to log output logic.
Specifically, if the sql log collection and the front-end call log collection are to be performed on the business system of the enterprise at the same time, firstly, the sql log and the log targets of the front-end call log are confirmed, wherein the log targets at least comprise an application program name, an interface name and an interface parameter. Based on a log target, identifying a target interface in at least one application program, wherein the target interface comprises an sql log target interface and a front-end call log target interface in the same business system of an enterprise, the sql log target interface is a target interface corresponding to an sql log persistent layer frame or a target interface corresponding to an sql log database driver, and the front-end call log target interface is a target interface corresponding to a front-end call log MVC frame layer. And starting an inserted code service, writing a front call interceptor for outputting the sql log in a call byte code of the sql log target interface before the sql log target interface and the front call log target interface are called in the running process of an application program, and packaging the front call interceptor added with the output sql log and the call byte code of log output logic into a file package plug-in A. And writing a front-end call interceptor for outputting the front-end call log in the call byte codes of the front-end call log target interface, packaging the front-end call interceptor added with the front-end call log and the call byte codes of the log output logic into a file package plug-in B, and respectively loading the file package plug-in A and the file package plug-in B onto JAVA virtual machine processes of the system to which the application program belongs by the call agent program when the system to which the application program belongs is started. When the sql log target interface and the front-end call log target interface are called in the JAVA virtual machine process, the sql log and the front-end call log are output according to log output logic.
The target interface may also include at least one interface among different applications within different systems. The four embodiments of the present disclosure are described in detail with respect to the case where the target interfaces are located in different systems.
The specific operations include S411 to S415.
In operation S411, the log object to be collected is confirmed, and the log object at least includes a system name, an application program name, an interface name and an interface parameter.
In operation S412, a target interface in an application of the plurality of systems is identified based on the log targets.
In operation S413, a front-end call interceptor including log output logic is set, and the front-end call interceptor is packaged as a package plug-in.
In operation S314, parameters of a target interface are configured in the package insert, and the target interface is defined as a target object of the acquisition log.
The method specifically comprises the steps of starting an inserted code service, and writing a pre-call interceptor in a call byte code of a target interface in the running process of an application program and before the target interface is called.
In operation S415, the package plug-in is started during the running of the application program, and the log of the target interface is output according to the log output logic. Specifically, when the system to which the application program belongs is started, the proxy program is called to load the file package plug-in to the JAVA virtual machine process of the system to which the application program belongs. When the target interface is called in the JAVA virtual machine process, the log of the target interface is output according to the log output logic.
In accordance with an embodiment of the present disclosure, operation S412 further includes converting the log of the target interface into a corresponding system-predetermined log output format when the target interface is distributed in a different system.
Specifically, if front-end call log collection is to be performed on an a system and a B system of an enterprise at the same time, firstly, in the a system, a log target of the front-end call log is confirmed, wherein the log target at least comprises a system name, an application program name, an interface name and an interface parameter. Based on the log object, identifying object interfaces in application programs of a plurality of systems, wherein the object interfaces comprise front-end call log object interfaces of the A system, and the front-end call log object interfaces are object interfaces corresponding to front-end call log MVC frame layers. And starting an inserted code service, writing a front-end call interceptor for outputting the front-end call log in a call byte code of the front-end call log target interface in the running process of the application program before the front-end call log target interface is called, and packaging the front-end call interceptor added with the front-end call log output and the call byte code of the log output logic into a file package plug-in. And when the A system to which the application program belongs is started, calling the agent program to load the file package plug-in to the JAVA virtual machine process of the A system to which the application program belongs. When the front-end call log target interface is called in the JAVA virtual machine process, the front-end call log of the A system is output according to log output logic. When front-end call log collection is carried out on the enterprise B system, when the B system to which the application program belongs is started, an agent program is called to load a file package plug-in of the A system to a JAVA virtual machine process of the B system to which the application program belongs. When the front-end call log target interface is called in the JAVA virtual machine process, the front-end call log of the B system is output according to log output logic.
Based on the non-invasive application log acquisition method, the disclosure also provides a non-invasive application log acquisition device. The device will be described in detail below in connection with fig. 3.
Fig. 3 schematically shows a block diagram of a non-invasive application log collection device according to a fifth embodiment of the present disclosure.
As shown in fig. 3, the non-invasive application log collection apparatus 300 of this embodiment includes an interface acquisition module 301, an interceptor setting module 302, a plug-in packaging module 303, and a plug-in loading module 304.
The interface acquisition module 301 is configured to acquire a target interface in an application program, where the target interface is a target object of an acquisition log. In an embodiment, the interface obtaining module 301 may be configured to perform the operation S210 described above, which is not described herein.
The interceptor setup module 302 is configured to set a pre-call interceptor that includes log output logic, and encapsulate the pre-call interceptor into a file package plug-in. In an embodiment, the interceptor configuration module 302 may be configured to perform the operation S220 described above, which is not described herein.
And the plug-in packaging module 303 is configured to configure parameters of a target interface in the file package plug-in, define the target interface as a target object of the acquisition log, and enable the pre-call interceptor to be used before the target interface is called. In an embodiment, the plug-in packaging module 303 may be configured to perform the operation S230 described above, which is not described herein.
The plug-in loading module 304 is configured to load the package plug-in to a virtual machine process of the application program when the application program is started, and output a log of the target interface according to log output logic. In an embodiment, the plug-in loading module 304 may be used to perform the operation S240 described above, which is not described herein.
According to an embodiment of the present disclosure, any of the plurality of modules of the interface acquisition module 301, the interceptor setting module 302, the plug-in packaging module 303, and the plug-in loading module 304 may be combined in one module to be implemented, or any of the plurality of modules may be split into a plurality of modules. Alternatively, at least some of the functionality of one or more of the modules may be combined with at least some of the functionality of other modules and implemented in one module. According to embodiments of the present disclosure, at least one of the interface acquisition module 301, interceptor setup module 320, plug-in packaging module 303, and plug-in loading module 304 may be implemented at least in part as hardware circuitry, such as a Field Programmable Gate Array (FPGA), programmable Logic Array (PLA), system-on-chip, system-on-substrate, system-on-package, application Specific Integrated Circuit (ASIC), or in hardware or firmware, such as any other reasonable manner of integrating or packaging the circuitry, or in any one of or a suitable combination of three of software, hardware, and firmware. Alternatively, at least one of the interface acquisition module 301, the interceptor setup module 320, the plug-in packaging module 303, and the plug-in loading module 304 may be at least partially implemented as a computer program module, which when executed, may perform the corresponding functions.
Fig. 4 schematically shows a block diagram of an electronic device adapted to implement a non-invasive application log collection method according to a sixth embodiment of the present disclosure.
As shown in fig. 4, an electronic device 400 according to an embodiment of the present disclosure includes a processor 401 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 402 or a program loaded from a storage section 408 into a Random Access Memory (RAM) 403. The processor 401 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or an associated chipset and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), or the like. Processor 401 may also include on-board memory for caching purposes. Processor 401 may include a single processing unit or multiple processing units for performing different actions of the method flows in accordance with embodiments of the disclosure.
In the RAM 403, various programs and data necessary for the operation of the electronic device 400 are stored. The processor 401, the ROM 402, and the RAM 403 are connected to each other by a bus 404. The processor 401 performs various operations of the method flow according to the embodiment of the present disclosure by executing programs in the ROM 402 and/or the RAM 403. Note that the program may be stored in one or more memories other than the ROM 402 and the RAM 403. The processor 401 may also perform various operations of the method flow according to the embodiments of the present disclosure by executing programs stored in the one or more memories.
According to an embodiment of the present disclosure, electronic device 400 may also include an input/output (I/O) interface 405, with input/output (I/O) interface 405 also connected to bus 404. Electronic device 400 may also include one or more of the following components connected to I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output portion 407 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage section 408 including a hard disk or the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. The drive 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is installed on the drive 410 as needed, so that a computer program read therefrom is installed into the storage section 408 as needed.
The present disclosure also provides a computer-readable storage medium that may be embodied in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the apparatus/device/system. The computer-readable storage medium carries one or more programs which, when executed, implement methods in accordance with embodiments of the present disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example, but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, the computer-readable storage medium may include ROM 402 and/or RAM 403 and/or one or more memories other than ROM 402 and RAM 403 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the methods shown in the flowcharts. The program code, when executed in a computer system, causes the computer system to implement the non-invasive log collection method provided by embodiments of the present disclosure.
The above-described functions defined in the system/apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 401. The systems, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
In one embodiment, the computer program may be based on a tangible storage medium such as an optical storage device, a magnetic storage device, or the like. In another embodiment, the computer program may also be transmitted, distributed over a network medium in the form of signals, downloaded and installed via the communication portion 409, and/or installed from the removable medium 411. The computer program may include program code that may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 409 and/or installed from the removable medium 411. The above-described functions defined in the system of the embodiments of the present disclosure are performed when the computer program is executed by the processor 401. The systems, devices, apparatus, modules, units, etc. described above may be implemented by computer program modules according to embodiments of the disclosure.
According to embodiments of the present disclosure, program code for performing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, such computer programs may be implemented in high-level procedural and/or object-oriented programming languages, and/or assembly/machine languages. Programming languages include, but are not limited to, such as Java, c++, python, "C" or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that the features recited in the various embodiments of the disclosure and/or in the claims may be provided in a variety of combinations and/or combinations, even if such combinations or combinations are not explicitly recited in the disclosure. In particular, the features recited in the various embodiments of the present disclosure and/or the claims may be variously combined and/or combined without departing from the spirit and teachings of the present disclosure. All such combinations and/or combinations fall within the scope of the present disclosure.
The embodiments of the present disclosure are described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the embodiments cannot be used advantageously in combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be made by those skilled in the art without departing from the scope of the disclosure, and such alternatives and modifications are intended to fall within the scope of the disclosure.
Claims (10)
1. A method for collecting non-invasive application logs, comprising:
acquiring a target interface in an application program, wherein the target interface is a target object for acquiring logs;
setting a front-end call interceptor comprising log output logic, and packaging the front-end call interceptor into a file package plug-in;
configuring parameters of the target interface in the file package plug-in, defining the target interface as a target object of an acquisition log, and enabling the pre-call interceptor to operate and use before the target interface is called;
and when the application program is started, loading the file package plug-in to a virtual machine process of the application program, and outputting the log of the target interface according to the log output logic.
2. The method of claim 1, wherein the obtaining a target interface in the application, the target interface being a target object of an acquisition log comprises:
confirming a log target to be acquired, wherein the log target at least comprises an application program name, an interface name and an interface parameter;
and identifying a target interface in at least one application program based on the log target, wherein the target interface comprises a plurality of interfaces in the same system, and the interfaces are respectively arranged in different application programs of the system.
3. The method of claim 1, wherein the obtaining a target interface in the application, the target interface being a target object of an acquisition log comprises:
confirming a log target to be acquired, wherein the log target at least comprises a system name, an application program name, an interface name and an interface parameter;
identifying a target interface in an application of the plurality of systems based on the log target;
wherein the target interface comprises at least one interface among different applications within different systems.
4. The method of claim 1, wherein configuring parameters of the target interface within the package plug-in, defining the target interface as a target object of an acquisition log, causing the pre-call interceptor to run before the target interface is invoked comprises:
searching a corresponding target interface in the application program based on the parameters of the target interface configured in the file package plug-in;
and in the running process of the application program, adding the pre-call interceptor in the call byte code of the target interface before the target interface is called through a JAVA Instrument mechanism.
5. The method of claim 1, wherein loading the package plug-in to a virtual machine process of the application at the start-up of the application, outputting the log of the target interface according to the log output logic comprises:
when a system to which the application program belongs is started, a Java Agent program is called to load the file package plug-in onto a Java virtual machine process of the system to which the application program belongs;
before a method for calling the target interface in the JAVA virtual machine process is called, a front-end call interceptor in the file package plug-in is started, and the log of the target interface is output according to the log output logic.
6. A method according to claim 3, characterized in that the method further comprises:
and when the target interfaces are distributed in different systems, converting the logs of the target interfaces into corresponding log output formats preset by the systems.
7. A non-invasive application log collection device, comprising:
the interface acquisition module is used for acquiring a target interface in the application program, wherein the target interface is a target object for acquiring logs;
the interceptor setting module is used for setting a front-end call interceptor comprising log output logic and packaging the front-end call interceptor into a file package plug-in;
the plug-in configuration module is used for configuring parameters of the target interface in the file package plug-in, defining the target interface as a target object for collecting logs, and enabling the front call interceptor to be operated and used before the target interface is called;
and the plug-in loading module is used for loading the file package plug-in to a virtual machine process of the application program when the application program is started, and outputting the log of the target interface according to the log output logic.
8. An electronic device, comprising:
one or more processors;
storage means for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-6.
9. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method according to any of claims 1-6.
10. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311480837.6A CN117472716A (en) | 2023-11-08 | 2023-11-08 | Non-invasive application log acquisition method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311480837.6A CN117472716A (en) | 2023-11-08 | 2023-11-08 | Non-invasive application log acquisition method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN117472716A true CN117472716A (en) | 2024-01-30 |
Family
ID=89632646
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311480837.6A Pending CN117472716A (en) | 2023-11-08 | 2023-11-08 | Non-invasive application log acquisition method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN117472716A (en) |
-
2023
- 2023-11-08 CN CN202311480837.6A patent/CN117472716A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109582317B (en) | Method and apparatus for debugging hosted applications | |
CN111666293A (en) | Database access method and device | |
CN113505302A (en) | Method, device and system for supporting dynamic acquisition of buried point data and electronic equipment | |
CN115357761A (en) | Link tracking method and device, electronic equipment and storage medium | |
CN115982491A (en) | Page updating method and device, electronic equipment and computer readable storage medium | |
CN110928571A (en) | Business program development method and device | |
CN111125503B (en) | Method and apparatus for generating information | |
CN114116509A (en) | Program analysis method, program analysis device, electronic device, and storage medium | |
CN109981546B (en) | Method and device for acquiring remote call relation between application modules | |
CN110764769B (en) | Method and device for processing user request | |
CN112395098B (en) | Application program interface calling method and device, storage medium and electronic equipment | |
CN111414154A (en) | Method and device for front-end development, electronic equipment and storage medium | |
CN110825622A (en) | Software testing method, device, equipment and computer readable medium | |
CN115934537A (en) | Interface test tool generation method, device, equipment, medium and product | |
CN112506781B (en) | Test monitoring method, device, electronic equipment, storage medium and program product | |
CN112783903B (en) | Method and device for generating update log | |
CN114780361A (en) | Log generation method, device, computer system and readable storage medium | |
CN117472716A (en) | Non-invasive application log acquisition method, device, equipment and storage medium | |
CN113448578A (en) | Page data processing method, processing system, electronic device and readable storage medium | |
CN113760262A (en) | Task processing method, device, computer system and computer readable storage medium | |
CN113760274A (en) | Front-end component logic injection method and device | |
CN118210778A (en) | Database operation method, apparatus, device, storage medium, and program product | |
CN113051090A (en) | Interface processing method and device, interface calling method and device, system and medium | |
CN116541029A (en) | Method and device for generating application program installation package, electronic equipment and storage medium | |
CN115421873A (en) | Dictionary construction method, and file evaluation method, device and equipment based on dictionary |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |