Generation method for running fault code detailed fault log
By using probe monitoring components and exception processing analysis components in distributed systems, combining Java Agent and reflection technology, fault information is captured and organized, and standardized logs are generated, the problem of inefficient fault processing in the existing technology is solved, and efficient and accurate fault processing is achieved.
Patent Information
- Application Number
- CN202411771224.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-04
- Publication Date
- 2025-03-25
AI Technical Summary
The prior art is difficult to dynamically capture the complete context information of the fault code in distributed systems, resulting in low fault processing efficiency and accuracy.
The probe monitoring component and exception processing analysis component are used to monitor and analyze the Java subject through Java Agent and reflection technology, capture and organize exception information, and generate standardized fault logs.
Real-time monitoring and detailed logging of distributed system failures is realized, the efficiency and accuracy of fault handling is improved, and the root cause of the problem can be quickly located.
Smart Images

Figure CN119690778A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of dynamic capture systems, and in particular to a method for generating a detailed fault log of a running fault code. Background Art
[0002] With the rapid development of modern information technology, the scale and complexity of software systems are increasing, resulting in an increased possibility of failures during system operation. In order to ensure the high availability and stability of the system, it is particularly important to capture and record fault information during system operation in a timely and accurate manner. Traditional fault handling methods often rely on developers to manually analyze log files or use simple monitoring tools to identify problems, which is not only inefficient but also difficult to fully cover all potential fault scenarios. Therefore, a method is needed to dynamically capture the context information of system operation fault codes and automatically generate detailed fault logs to improve the efficiency and accuracy of fault handling.
[0003] There are some fault diagnosis tools on the market that can help developers locate problems to a certain extent. However, these tools usually lack the ability to capture complete context information when the fault occurs, resulting in insufficient details for in-depth analysis and problem solving. Existing solutions often do not adapt well to distributed system environments, where the propagation and impact of faults may span multiple services and components.
[0004] The disadvantages of the pre-embedded log printing output strategy are:
[0005] Incomplete logging is a major problem. During the coding phase, if developers fail to set up enough logging points at key locations or fail to capture all possible exceptions, they will lack the necessary information in subsequent troubleshooting. In this case, even if the system fails or anomalies occur, due to the lack of detailed logging, it is difficult for developers and operation and maintenance personnel to accurately locate the root cause of the problem, thus affecting the efficiency of problem solving.
[0006] The difficulty in reproducing sporadic problems is also a significant disadvantage of traditional system troubleshooting methods. For some sporadic problems that are difficult to reproduce, relying solely on log analysis may not be able to completely solve the problem. Such problems are usually random and unpredictable, and it is difficult to capture all relevant information through simple log records. In the actual development process, due to various reasons (such as time constraints, heavy tasks, etc.), R&D personnel may not be able to cover everything, resulting in incomplete or unclear log records. In addition, different R&D personnel may have different levels of attention and habits for log records, which will also affect the quality and effectiveness of log records.
[0007] The disadvantages of real-time diagnosis strategy are:
[0008] When faced with such a huge amount of data, they often find it difficult to quickly and accurately locate the root cause of the problem. Information overload may lead to the omission or misjudgment of important information, which affects the efficiency and accuracy of problem troubleshooting. In addition, sporadic problems are usually sudden and unpredictable, which makes them difficult to detect and deal with in a timely manner through conventional monitoring methods. Although online real-time detection tools can provide continuous monitoring, they may not be able to capture these short-lived and randomly occurring problems in time. Therefore, this strategy may seem inadequate when solving sporadic problems.
[0009] This strategy is highly dependent on advanced online real-time detection tools. These tools are not omnipotent and have their own limitations and shortcomings. Once the tool itself has problems or performance degradation, it may affect the stability and reliability of the entire system.
[0010] Introducing online real-time detection tools may bring additional costs and resource consumption. These tools usually require professional technical support and maintenance to ensure their normal operation and maximum efficiency. At the same time, they may also occupy a large amount of system resources, such as CPU, memory, etc., thus affecting the overall performance of the system. Summary of the invention
[0011] In view of the above problems, the present invention is proposed to provide a method for generating a detailed fault log of an operation fault code that overcomes the above problems or at least partially solves the above problems.
[0012] According to one aspect of the present invention, a method for generating a detailed fault log of a running fault code is provided, the generating method comprising: a probe monitoring component and an exception handling analysis component;
[0013] The probe monitoring component uses Java agent and reflection technology to monitor the running Java body, and reads and temporarily stores the data before and after the logical operation of the service;
[0014] The exception handling analysis component relies on the information mirroring of the probe monitoring component to temporarily store data and analyze whether there are any exceptions in the system operation. If an exception is captured, the probe is used to organize the methods and parameter objects in the exception stage, and the superior methods and parameter objects after tracing, and generate standardized log information to output to the error log.
[0015] Optionally, the probe monitoring component specifically includes:
[0016] Before the service logic runs, the JavaAgent technology is used to scan the properties and methods of the target object and collect relevant information;
[0017] After the service logic runs, scan the target object again, compare the changes before and after, and obtain the mirror image of the data;
[0018] Using reflection technology, the internal properties and methods of the target object can be dynamically accessed and modified at runtime to monitor and control the target object.
[0019] Optionally, before the service logic is run, the properties and methods of the target object are scanned by JavaAgent technology to collect relevant information, specifically including:
[0020] Get the initial state of the object before the method is executed through JavaAgent technology;
[0021] JavaAgent is a technology that loads class bytecode when the JVM starts and modifies it at runtime, making it possible to dynamically monitor and modify Java programs;
[0022] By using the JavaAgent mechanism, custom monitoring logic can be added without modifying the original code.
[0023] Optionally, after the service logic is run, scanning the target object again, comparing the changes before and after the state, and obtaining the mirror image of the data specifically includes:
[0024] By comparing the data from the two scans, the changes in the state of the object can be calculated;
[0025] The changed data is mirror data, which records all changes in the object properties during the method execution.
[0026] Optionally, the use of reflection technology to dynamically access and modify internal properties and methods of the target object at runtime, and the monitoring and control of the target object specifically includes:
[0027] Reflection technology dynamically obtains the complete structural information of a class, including properties, methods, and constructors, when the program is running;
[0028] By calling the reflection API, creating objects, calling methods, and accessing fields, real-time monitoring and adjustments can be performed without stopping the target program.
[0029] Optionally, the information mirroring temporary storage data of the exception handling analysis component relying on the probe monitoring component specifically includes:
[0030] Continuously monitor the system's operating status and record the details of each method call through information mirroring temporary data;
[0031] When an exception occurs in the system, the probe will immediately capture the exception information. After capturing the exception, the probe will start the exception analysis mechanism to sort out the methods and parameter objects in the exception stage and their parent methods and parameter objects after tracing back to the source.
[0032] After the compilation is completed, the probe generates standardized log information;
[0033] The probe outputs standardized logging information to the error log.
[0034] Optionally, the temporarily stored data includes the name of the method, parameter objects and their values, and timestamp information of the method execution.
[0035] Optionally, the exception information generally includes the exception type, the exception message, and the location where the exception occurs.
[0036] The present invention provides a method for generating a detailed fault log of a running fault code, the generating method comprising: a probe monitoring component and an exception handling analysis component; the probe monitoring component uses java agent and reflection technology to monitor and process the running java body, and reads and temporarily stores the data before and after the logical operation of the service; the exception handling analysis component relies on the information mirroring temporary data of the probe monitoring component to analyze whether the system operation is abnormal. If the exception is captured, the probe is used to sort out the methods and parameter objects in the abnormal stage, and the superior methods and parameter objects after tracing, and generate standardized log information and output it to the error log. Relying on the probe monitoring component can effectively monitor and analyze whether the system operation is abnormal. When an abnormal situation is captured, the probe will respond and sort out the relevant information in time, generate standardized log information and output it to the error log.
[0037] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0039] Figure 1 A flow chart of a probe monitoring component provided by an embodiment of the present invention;
[0040] Figure 2 A flowchart of an abnormality analysis process provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0041] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0042] The terms "comprises" and "having" and any variations thereof in the description embodiments, claims and drawings of the present invention are intended to cover non-exclusive inclusions, for example, including a series of steps or units.
[0043] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments.
[0044] A method for generating a detailed fault log of a running fault code, comprising:
[0045] The first component is the probe monitoring component, and the second component is the exception handling and analysis component;
[0046] Probe monitoring component: This component uses Java probe technology, Java agent and reflection technology to monitor and process the running Java body, and mirror read and temporarily store data before and after the logical operation of the service.
[0047] Exception handling and analysis component: Rely on the information mirroring and temporary storage data of the probe monitoring component to analyze whether there are any exceptions in the system operation. If an exception is captured, the probe is used to organize the methods and parameter objects in the exception stage, and their superior methods and parameter objects after tracing, and generate standardized log information to output to the error log.
[0048] like Figure 1 As shown, the probe monitors the components:
[0049] Before the service logic runs, the JavaAgent technology is used to scan the properties and methods of the target object and collect relevant information. In this way, the initial state of the object before the method is executed is obtained. Java Agent is a technology that loads the class bytecode when the JVM starts and modifies it at runtime, which makes it possible to dynamically monitor and modify Java programs. Using the JavaAgent mechanism, custom monitoring logic can be added without modifying the original code.
[0050] After the service logic runs, the target object is scanned again to compare the changes in state before and after, so as to obtain the mirror image of the data. By comparing the data of the two scans before and after, the changes in the object state are calculated. These change data are mirror data, which records all changes in the object properties during the method execution process.
[0051] By using reflection technology, we can dynamically access and modify the internal properties and methods of the target object at runtime to monitor and control the target object. Reflection technology allows us to dynamically obtain the complete structural information of the class, including properties, methods, and constructors, while the program is running. By calling the reflection API, we can dynamically create objects, call methods, and access fields. This dynamic operation capability allows us to monitor and adjust the target program in real time without stopping it.
[0052] By combining JavaAgent and reflection technology, the component realizes efficient monitoring and dynamic control of Java applications, and enhances the visibility and management capabilities of the program running process. It not only helps to quickly discover and locate problems, but also provides important data support for system optimization.
[0053] like Figure 2 As shown, the exception handling analysis component:
[0054] The component will continuously monitor the running status of the system and record the details of each method call through the information mirror temporary data. The temporary data includes the name of the method, parameter objects and their values, and the timestamp of the method execution. Through detailed records, you can fully understand every step that the system goes through during operation.
[0055] When an exception occurs in the system, the probe will immediately capture the exception information. The exception information usually includes the exception type, exception message, and the location where the exception occurred. After capturing the exception, the probe will start the exception analysis mechanism to sort out the methods and parameter objects at the exception stage and their parent methods and parameter objects after tracing. This process helps developers quickly locate the root cause of the problem and take appropriate measures to deal with it.
[0056] After the compilation is completed, the probe will generate standardized log information. These log information contains detailed information about the exception, such as the time of occurrence, exception type, impact range, methods involved, and parameter objects. This standardized format facilitates subsequent log analysis and processing.
[0057] The probe will output these standardized log information to the error log. Error logs are usually independent of normal operation logs and are specifically used to record various abnormal situations that occur in the system. By centrally managing error logs, operation and maintenance personnel and developers can more easily perform troubleshooting and system optimization.
[0058] Through the above process, the dependent probe monitoring component can effectively monitor and analyze whether the system operation is abnormal. Once an abnormal situation is captured, the probe will respond in time and organize relevant information, generate standardized log information and output it to the error log. It helps the development team to quickly locate and solve problems, and can also provide strong support for the long-term maintenance and optimization of the system.
[0059] Beneficial effects:
[0060] 1. The present invention can automatically generate detailed and easy-to-understand fault logs by monitoring system status in real time and capturing key runtime data. This not only helps developers quickly locate the source of the problem, but also greatly shortens the troubleshooting and repair time.
[0061] 2. The present invention adopts non-intrusive monitoring technology to achieve real-time monitoring of the system without modifying the existing code. This technical means avoids the potential risks caused by adding monitoring code, while ensuring that the integrity and function of the software system are not affected.
[0062] The above specific implementation methods further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above are only specific implementation methods of the present invention and are not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A method for generating a detailed fault log of a running fault code, characterized in that: The generation method comprises: a probe monitoring component and an exception handling analysis component; The probe monitoring component uses Java agent and reflection technology to monitor the running Java body, and reads and temporarily stores the data before and after the logical operation of the service; The exception handling analysis component relies on the information mirroring of the probe monitoring component to temporarily store data and analyze whether there are any exceptions in the system operation. If an exception is captured, the probe is used to organize the methods and parameter objects in the exception stage, and the superior methods and parameter objects after tracing, and generate standardized log information to output to the error log.
2. A method for generating a detailed fault log of an operation fault code according to claim 1, characterized in that: The probe monitoring component specifically includes: Before the service logic runs, the JavaAgent technology is used to scan the properties and methods of the target object and collect relevant information; After the service logic runs, scan the target object again, compare the changes before and after, and obtain the mirror image of the data; Using reflection technology, the internal properties and methods of the target object can be dynamically accessed and modified at runtime to monitor and control the target object.
3. A method for generating a detailed fault log of an operation fault code according to claim 2, characterized in that: Before the service logic runs, the properties and methods of the target object are scanned by JavaAgent technology to collect relevant information, including: Get the initial state of the object before the method is executed through JavaAgent technology; JavaAgent is a technology that loads class bytecode when the JVM starts and modifies it at runtime, making it possible to dynamically monitor and modify Java programs; By using the JavaAgent mechanism, custom monitoring logic can be added without modifying the original code.
4. A method for generating a detailed fault log of an operation fault code according to claim 2, characterized in that: After the service logic is run, the target object is scanned again, and the changes in the states before and after are compared to obtain the mirror image of the data, which specifically includes: By comparing the data from the two scans, the changes in the state of the object can be calculated; The changed data is mirror data, which records all changes in the object properties during the method execution.
5. The method for generating a detailed fault log of an operation fault code according to claim 2, characterized in that: The use of reflection technology to dynamically access and modify the internal properties and methods of the target object at runtime, and the monitoring and control of the target object specifically includes: Reflection technology dynamically obtains the complete structural information of a class, including properties, methods, and constructors, when the program is running; By calling the reflection API, creating objects, calling methods, and accessing fields, real-time monitoring and adjustments can be performed without stopping the target program.
6. A method for generating a detailed fault log of an operation fault code according to claim 1, characterized in that: The information mirror temporary storage data of the abnormal processing analysis component that relies on the probe monitoring component specifically includes: Continuously monitor the system's operating status and record the details of each method call through information mirroring temporary data; When an exception occurs in the system, the probe will immediately capture the exception information. After capturing the exception, the probe will start the exception analysis mechanism to sort out the methods and parameter objects in the exception stage and their parent methods and parameter objects after tracing back to the source. After the compilation is completed, the probe generates standardized log information; The probe outputs standardized logging information to the error log.
7. A method for generating a detailed fault log of an operation fault code according to claim 6, characterized in that: The temporary data includes the method name, parameter objects and their values, and method execution timestamp information.
8. A method for generating a detailed fault log of an operation fault code according to claim 6, characterized in that: The exception information generally includes the exception type, the exception message, and the location where the exception occurs.