CN110968493A - Method and system for analyzing and deducing running state of program based on running log - Google Patents

Method and system for analyzing and deducing running state of program based on running log Download PDF

Info

Publication number
CN110968493A
CN110968493A CN201911343620.4A CN201911343620A CN110968493A CN 110968493 A CN110968493 A CN 110968493A CN 201911343620 A CN201911343620 A CN 201911343620A CN 110968493 A CN110968493 A CN 110968493A
Authority
CN
China
Prior art keywords
log
program
running
thread
analyzing
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
Application number
CN201911343620.4A
Other languages
Chinese (zh)
Inventor
李春锋
杜洪亮
周华
胡军擎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Yingfang Software Co ltd
Original Assignee
Shanghai Yingfang Software Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Yingfang Software Co ltd filed Critical Shanghai Yingfang Software Co ltd
Priority to CN201911343620.4A priority Critical patent/CN110968493A/en
Publication of CN110968493A publication Critical patent/CN110968493A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording 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/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/32Monitoring with visual or acoustical indication of the functioning of the machine
    • G06F11/323Visualisation of programs or trace data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/865Monitoring of software

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Hardware Design (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a method and a system for analyzing and deducing the running state of a program based on a running log, wherein the method comprises the following steps: step S1, setting a program generation log rule, and in the program running process, generating a log rule according to the set program and recording a program running log, wherein the program generation log rule at least stipulates key parameters for recording the program running log; and step S2, analyzing key parameters recorded by each log of the program running log, and restoring running tracks of all threads of the program by using a visual dynamic deduction method in combination with actual source codes.

Description

Method and system for analyzing and deducing running state of program based on running log
Technical Field
The invention relates to the technical field of program running log analysis, in particular to a method and a system for analyzing and deducing the running state of a program based on a running log, wherein the method and the system are used for visually and dynamically deducing the running state of the program by automatically analyzing the running log of the program.
Background
In the high-tech era, people do not leave system software for work, life and entertainment, but any system needs to have the processes of research, development, testing, online operation and maintenance in the later period, and the problems of program abnormity and the like are inevitable in the process.
To solve this problem, it is necessary to invest a lot of time for developers to locate the problem and then solve the problem, and the first solution after any system problem is solved is to analyze the operation log.
The traditional log analysis mode is mainly to analyze the generated log file manually, and because the log record is a multi-thread discrete record, the manual analysis is troublesome and not clear, a plurality of different threads may generate the running log analysis at the same time, the analysis difficulty is relatively high, and generally developers corresponding to a software system can understand the whole process of the log record, so that the limitation is large, and the efficiency is low.
Disclosure of Invention
In order to overcome the defects of the prior art, the invention aims to provide a method and a system for analyzing and deducing the running state of a program based on a running log, which can greatly reduce the requirements on log analysts, can also quickly and automatically analyze where the last problem is, and greatly improve the efficiency of operation, maintenance and testing.
To achieve the above object, the present invention provides a method for analyzing and deducing the running state of a program based on a running log, which comprises the following steps:
step S1, setting a program generation log rule, and in the program running process, generating a log rule according to the set program and recording a program running log, wherein the program generation log rule at least stipulates key parameters for recording the program running log;
and step S2, analyzing key parameters recorded by each log of the program running log, and deducing the running tracks of all threads of the program by using a visual dynamic deduction method in combination with actual source codes.
Preferably, the key parameters include, but are not limited to, a date and time of execution, a thread number, a file where the source code is located, a line where the source code is located, and a custom message.
Preferably, during the program running, the date and time of the program running, the thread number, the file where the source code is located, the line where the source code is located and the self-defined message are recorded in the program running log.
Preferably, in step S2, the actual running trace is calculated by analyzing the key parameters recorded in each log of the program running log, taking the time parameter as the time axis and the thread number as the trace branch in combination with the actual source code of the program, and using the two parameters of the file where the source code is located and the line where the source code is located in combination with the actual source code.
Preferably, the step S2 further includes:
step S200, classifying all log records in the program running log according to thread numbers, and arranging the same threads together according to a time sequence;
step S201, generating a corresponding running track for each thread, analyzing each thread, recording and marking on a corresponding running track line according to the time sequence.
Preferably, in step S201, the running track of a program thread is represented by line segments with different colors, and the starting and ending positions of the line segments represent the starting time and the ending time of the thread.
Preferably, the line segment is marked with a code interface called by the corresponding thread of the log record at a certain point in time or some exception information thrown.
In order to achieve the above object, the present invention further provides a system for analyzing and deducing an operating status of a program based on an operation log, including:
the device comprises a log rule setting unit, a log rule setting unit and a log processing unit, wherein the log rule setting unit is used for setting a program generation log rule which is used for stipulating key parameters for recording program operation logs;
the log recording unit is used for generating a log rule according to a set program and recording a program running log when the program runs;
and the analysis deduction unit is used for deducing the running tracks of all threads of the program by analyzing the key parameters recorded by each log of the program running log and using a visual dynamic deduction method by combining actual source codes.
Preferably, the key parameters include, but are not limited to, a date and time of execution, a thread number, a file where the source code is located, a line where the source code is located, and a custom message.
Preferably, the analysis deduction unit further comprises:
the thread classification module is used for classifying all log records in the program running log according to thread numbers, and the same threads are arranged together according to a time sequence;
and the deduction recording module is used for generating a corresponding running track for each thread, analyzing each thread, and recording and marking on a corresponding running track line according to the time sequence.
Compared with the prior art, the method and the system for analyzing and deducing the program running state based on the running log only need to introduce the program running log, automatically and dynamically demonstrate the program running state according to the time sequence and the thread track, and finally solve the problem in which thread or step, thereby greatly helping developers, obviously finding out where the problem exists in later operation and maintenance, quickly positioning the range where the problem exists, and ensuring that the system is quickly repaired and used.
Drawings
FIG. 1 is a flowchart illustrating steps of a method for deriving a program operating status based on an operation log analysis according to the present invention;
FIG. 2 is a diagram illustrating a structure of 5 key parameters of a log rule according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating program execution paths and states for automatically pushing programs according to imported logs in an embodiment of the present invention;
fig. 4 is a system architecture diagram of a system for analyzing and deducing the running state of a program based on a running log according to the present invention.
Detailed Description
Other advantages and capabilities of the present invention will be readily apparent to those skilled in the art from the present disclosure by describing the embodiments of the present invention with specific embodiments thereof in conjunction with the accompanying drawings. The invention is capable of other and different embodiments and its several details are capable of modification in various other respects, all without departing from the spirit and scope of the present invention.
Fig. 1 is a flowchart illustrating steps of a method for analyzing and deducing the running status of a program based on a running log according to the present invention. As shown in fig. 1, the method for analyzing and deducing the running state of a program based on a running log of the present invention includes the following steps:
step S1 is to set a program generation log rule, and when recording the program execution log, generate a log rule according to the set program generation log rule to record the program execution log, where the program generation log rule specifies at least key parameters for recording the program execution log.
In the embodiment of the present invention, the key parameters include, but are not limited to, a date and time of operation, a thread number, a file where the source code is located, a line where the source code is located, and customized 5 key parameters of a message.
As shown in fig. 1, the format standard of the program execution log determined by the program generation log rule is as follows:
file where source code is located (source code line) < time of day > < thread number > < self-defined message
That is, during the running of the program, the date and time of the running of the program, the thread number, the file where the source code is located, the line where the source code is located, and the self-defined message are recorded in the program running log.
And step S2, analyzing key parameters recorded by each log of the program running log, and deducing the running tracks of all threads of the program by using a visual dynamic deduction method in combination with actual source codes. In the invention, each log is a node and is connected in series to form a running track straight line according to time sequence, specifically, the actual running track is calculated by analyzing the 5 key parameters of the program running log, combining the actual source code of the program, taking the time parameter as a time axis, taking the thread number as a track branch and combining two parameters of a file where the source code is located and a line where the source code is located with the actual source code.
For example, a row of logs written: [ 11/29/1915: 42:15] [5] filesend.c (710): startconnect server, which can automatically resolve:
time: 11/29/1915:42:15
Thread number: 5
Source file: filesend.c
Location in source file: line 710
Outputting a message: start connect server
Combined source file filesend.c
.........
708int try_connect_server(...)
709{
710printf_log("start connect server");
711if(connect(server)){
712printf_log("connect server error");
713return-1;
714}
715printf_log("connect succeed");
716return 0;
717}
...........
It can be deduced that the node where the current log executes is try _ connect _ server, and a plurality of such nodes are connected in series in a time axis to form a program running track.
Specifically, step S2 further includes:
step S200, classifying all log records in the program running log according to thread numbers, and arranging the same threads together according to a time sequence;
step S201, analyzing the log record corresponding to each thread, recording and marking on the running track line according to the time sequence. As shown in fig. 3, for example, the running track of a program thread may be represented by lines (colors not shown) with different colors in the figure, the abscissa is time, the starting and ending positions of a line segment represent the starting time and the ending time of the thread, and additionally, the line segment is marked with some log record of the code interface called by the thread at a certain time point or some prompt information thrown by the thread, such as: error [ insuffient disk space ].
Through the generated running track diagram, on one hand, the operations executed in the whole program running can be visually seen, the threads are still working at the last moment of the program error, and the operations are respectively done by the threads, so that the execution state of the program can be known in real time.
Fig. 4 is a system architecture diagram of a system for analyzing and deducing the running state of a program based on a running log according to the present invention. As shown in fig. 4, the system for analyzing and deriving the running state of a program based on a running log according to the present invention includes:
a log rule setting unit 401, configured to set a program generation log rule, where the program generation log rule is used to specify a key parameter for recording a program operation log.
In the embodiment of the present invention, the key parameters include, but are not limited to, a date and time of operation, a thread number, a file where the source code is located, a line where the source code is located, and customized 5 key parameters of a message.
In the specific embodiment of the present invention, the format standard of the program running log determined by the program generation log rule is as follows:
file where source code is located (source code line) < time of day > < thread number > < self-defined message
A log recording unit 402, configured to generate a log rule according to a set program and record a program running log during program running.
That is, during the running of the program, the date and time of the running of the program, the thread number, the file where the source code is located, the line where the source code is located, and the self-defined message are recorded in the program running log.
The analysis deduction unit 403 is configured to, by analyzing key parameters recorded in each log of the program running log, use a visual dynamic deduction method in combination with an actual source code to deduce running tracks of all threads of the program. In the present invention, each log is a node, and is connected in series to form a straight line of the running track according to the time sequence, specifically, the analysis and deduction unit 403 calculates the actual running track by analyzing the above 5 key parameters of the program running log, combining the program actual source code, taking the time parameter as the time axis, taking the thread number as the track branch, and combining the actual source code with the file where the source code is located and the two parameters of the line where the source code is located.
Specifically, the analysis deduction unit 403 further includes:
the thread classification module is used for classifying all log records in the program running log according to thread numbers, and the same threads are arranged together according to a time sequence;
and the deduction recording module is used for analyzing each thread, recording and marking on the running track line according to the time sequence. For example, the trace of a program thread may be represented by lines of different colors (colors not shown in the figure), the abscissa is time, the start and end positions of a line segment represent the start time and end time of the thread, and a log record of a code interface called by the thread at a certain time point or some exception information thrown by the thread is marked on the line segment.
Therefore, through the generated running track diagram, on one hand, the operations executed in the whole program running can be visually seen, the threads are still working at the last moment of the program error, and the respective operations are respectively done, so that the execution state of the program can be known in real time. .
Therefore, the method and the system for analyzing and deducing the program running state based on the running log only need to introduce the program running log, automatically and dynamically demonstrate the program running state according to the time sequence and the thread track, and finally solve the problem in which thread or step, thereby greatly helping developers, obviously finding out where the problem is in the later operation and maintenance, quickly positioning the range where the problem is in and ensuring the quick repair and use of the system.
The invention not only greatly reduces the requirements on the log analyst (the test and technical personnel and operation and maintenance personnel who have basic understanding on the functions of the software can use the log analyst), but also can quickly and automatically analyze where the final problem is. The efficiency is greatly improved for operation, maintenance and testing.
The foregoing embodiments are merely illustrative of the principles and utilities of the present invention and are not intended to limit the invention. Modifications and variations can be made to the above-described embodiments by those skilled in the art without departing from the spirit and scope of the present invention. Therefore, the scope of the invention should be determined from the following claims.

Claims (10)

1. A method for analyzing and deducing program running state based on running log comprises the following steps:
step S1, setting a program generation log rule, and in the program running process, generating a log rule according to the set program and recording a program running log, wherein the program generation log rule at least stipulates key parameters for recording the program running log;
and step S2, analyzing key parameters recorded by each log of the program running log, and deducing the running tracks of all threads of the program by using a visual dynamic deduction method in combination with actual source codes.
2. The method of claim 1, wherein the method comprises: the key parameters include, but are not limited to, date and time of execution, thread number, file where the source code is located, line where the source code is located, and custom messages.
3. The method of claim 1, wherein the method comprises: during the program running, the date and time of the program running, the thread number, the file where the source code is located, the line where the source code is located and the self-defined message are recorded in the program running log.
4. The method of claim 1, wherein the method comprises: in step S2, the actual running trace is calculated by analyzing the key parameters recorded in each log of the program running log, combining the actual source code of the program, taking the time parameter as the time axis, taking the thread number as the trace branch, and combining the two parameters of the file where the source code is located and the line where the source code is located with the actual source code.
5. The method of claim 4, wherein the step S2 further comprises:
step S200, classifying all log records in the program running log according to thread numbers, and arranging the same threads together according to a time sequence;
step S201, generating a corresponding running track for each thread, analyzing each thread, recording and marking on a corresponding running track line according to the time sequence.
6. The method of claim 5, wherein the method comprises: in step S201, a running track of a program thread is represented by line segments with different colors, and start and end positions of the line segments represent start and end times of the thread.
7. The method of claim 6, wherein the method for analyzing and deriving the operating status of the program based on the operation log comprises: and marking a code interface called by the corresponding thread of the log record at a certain time point or some thrown exception information on the line segment.
8. A system for analyzing the running state of a deduction program based on a running log, comprising:
the device comprises a log rule setting unit, a log rule setting unit and a log processing unit, wherein the log rule setting unit is used for setting a program generation log rule which is used for stipulating key parameters for recording program operation logs;
the log recording unit is used for generating a log rule according to a set program and recording a program running log when the program runs;
and the analysis deduction unit is used for deducing the running tracks of all threads of the program by analyzing the key parameters recorded by each log of the program running log and using a visual dynamic deduction method by combining actual source codes.
9. The system for deriving program operating status based on the analysis of the execution log as claimed in claim 8, wherein: the key parameters include, but are not limited to, date and time of execution, thread number, file where the source code is located, line where the source code is located, and custom messages.
10. The system for analyzing and deducing the running state of a program based on a running log as claimed in claim 8, wherein said analysis deduction unit further comprises:
the thread classification module is used for classifying all log records in the program running log according to thread numbers, and the same threads are arranged together according to a time sequence;
and the deduction recording module is used for generating a corresponding running track for each thread, analyzing each thread, and recording and marking on a corresponding running track line according to the time sequence.
CN201911343620.4A 2019-12-24 2019-12-24 Method and system for analyzing and deducing running state of program based on running log Pending CN110968493A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911343620.4A CN110968493A (en) 2019-12-24 2019-12-24 Method and system for analyzing and deducing running state of program based on running log

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911343620.4A CN110968493A (en) 2019-12-24 2019-12-24 Method and system for analyzing and deducing running state of program based on running log

Publications (1)

Publication Number Publication Date
CN110968493A true CN110968493A (en) 2020-04-07

Family

ID=70035985

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911343620.4A Pending CN110968493A (en) 2019-12-24 2019-12-24 Method and system for analyzing and deducing running state of program based on running log

Country Status (1)

Country Link
CN (1) CN110968493A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736978A (en) * 2020-07-29 2020-10-02 长沙微康信息科技有限公司 System diary data classification processing method and device and intelligent electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120054722A1 (en) * 2010-08-30 2012-03-01 Susumu Takeda Trace generating unit, system, and program of the same
CN103368756A (en) * 2012-03-29 2013-10-23 福建星网视易信息系统有限公司 A management system for monitoring the operation log of an embedded system
CN106339303A (en) * 2016-08-23 2017-01-18 浪潮电子信息产业股份有限公司 Method for analyzing abnormity of running log
CN108153643A (en) * 2016-12-02 2018-06-12 北京奇虎科技有限公司 Daily record monitoring system and method
CN109388537A (en) * 2018-08-31 2019-02-26 阿里巴巴集团控股有限公司 Operation information tracking, device and computer readable storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120054722A1 (en) * 2010-08-30 2012-03-01 Susumu Takeda Trace generating unit, system, and program of the same
CN103368756A (en) * 2012-03-29 2013-10-23 福建星网视易信息系统有限公司 A management system for monitoring the operation log of an embedded system
CN106339303A (en) * 2016-08-23 2017-01-18 浪潮电子信息产业股份有限公司 Method for analyzing abnormity of running log
CN108153643A (en) * 2016-12-02 2018-06-12 北京奇虎科技有限公司 Daily record monitoring system and method
CN109388537A (en) * 2018-08-31 2019-02-26 阿里巴巴集团控股有限公司 Operation information tracking, device and computer readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736978A (en) * 2020-07-29 2020-10-02 长沙微康信息科技有限公司 System diary data classification processing method and device and intelligent electronic equipment
CN111736978B (en) * 2020-07-29 2020-11-27 长沙微康信息科技有限公司 System diary data classification processing method and device and intelligent electronic equipment

Similar Documents

Publication Publication Date Title
CN110232024B (en) Software automation test framework and test method
CN109840207B (en) AutoSAR-based network management automation test system and test method
CN102184138B (en) Method and system for automatically reproducing and positioning software error
CN109388537B (en) Operation information tracking method and device and computer readable storage medium
CN105512036A (en) Test template for automatically generating test case according to preset rules and test method
CN106406858B (en) A kind of streaming statistical definition and operation method based on configuration file
CN110688313B (en) Fault injection method for software testing under VxWorks operating system
CN110704314B (en) Fault injection method for embedded software test
CN102495802A (en) Method and device for testing software system, and computer system
US20100251214A1 (en) Apparatus, system, and method for dynamic module flow analysis
CN110968493A (en) Method and system for analyzing and deducing running state of program based on running log
CN107622017A (en) A kind of analytic method of general automation software test
CN101398781B (en) System and method for rapidly diagnosing system software defect
CN112612697A (en) Software defect testing and positioning method and system based on byte code technology
CN110633199A (en) Testing apparatus, method, and medium for block chain supporting intelligent contract
CN117520184A (en) Test system for developing computer software
Prechelt Accelerating learning from experience: avoiding defects faster
CN115794639B (en) Visual test based on flow and visual simulation test system and method
CN117076296A (en) Control system, method, equipment and medium of network embedded equipment
US10579761B1 (en) Method and system for reconstructing a graph presentation of a previously executed verification test
CN115185825A (en) Interface test scheduling method and device
CN114879647A (en) ECU fault code test system, electronic controller and car
CN114610316A (en) Method and device for analyzing and controlling production line logs
CN113626288A (en) Fault processing method, system, device, storage medium and electronic equipment
CN112039690B (en) System data flow tracking and monitoring method and system

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20200407

RJ01 Rejection of invention patent application after publication