CN112035311B - Program logic monitoring method and device - Google Patents

Program logic monitoring method and device Download PDF

Info

Publication number
CN112035311B
CN112035311B CN201910480119.6A CN201910480119A CN112035311B CN 112035311 B CN112035311 B CN 112035311B CN 201910480119 A CN201910480119 A CN 201910480119A CN 112035311 B CN112035311 B CN 112035311B
Authority
CN
China
Prior art keywords
preset
information
log
logic
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.)
Active
Application number
CN201910480119.6A
Other languages
Chinese (zh)
Other versions
CN112035311A (en
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910480119.6A priority Critical patent/CN112035311B/en
Publication of CN112035311A publication Critical patent/CN112035311A/en
Application granted granted Critical
Publication of CN112035311B publication Critical patent/CN112035311B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • H04L67/025Protocols based on web technology, e.g. hypertext transfer protocol [HTTP] for remote control or remote monitoring of applications
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Medical Informatics (AREA)
  • General Health & Medical Sciences (AREA)
  • Mathematical Physics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a program logic monitoring method and a device, wherein the program logic monitoring method comprises the following steps: when a target application program is executed to a preset position, generating log information of the preset position according to a preset error log function corresponding to the preset position; the log information is sent to a server, so that the server determines a logic abnormal position in a target application program according to the log information, and an information collection instruction corresponding to the logic abnormal position is generated; the information collection instruction is used for indicating to collect information associated with the logical anomaly location; receiving an information collection instruction sent by a server, and collecting target information according to the information collection instruction; and sending the target information to the server so that the server determines the logic errors in the target application program according to the target information. The invention realizes the real-time monitoring of the application program logic, discovers the logic errors existing in the application program in time, and ensures the life cycle of the application program.

Description

Program logic monitoring method and device
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and apparatus for monitoring program logic.
Background
With the rapid development of internet communication technology, more and more applications are installed in a terminal, and logic errors in logic codes for implementing each application often determine the life cycle of the application, for example, an application frequently appearing abnormal or even crashed in operation, and due to poor user experience effect, the application can be abandoned by a user soon, so that the life cycle of the application is greatly shortened.
In the related art, the detection of logic errors in an application program is generally performed after a large amount of feedback information of the operation errors of the application program is received, and the problem of poor real-time performance of logic error monitoring in the application program exists, so that the abnormal problem cannot be effectively controlled before the abnormal problem of the large-scale burst of the application program occurs, and the life cycle of the application program is further affected.
Disclosure of Invention
In order to solve the problems in the prior art, the embodiment of the invention provides a program logic monitoring method and device. The technical scheme is as follows:
In one aspect, a program logic monitoring method is provided, the method comprising:
when a target application program is executed to a preset position, generating log information of the preset position according to a preset error log function corresponding to the preset position;
The log information is sent to a server, so that the server determines a logic abnormal position in the target application program according to the log information, and an information collection instruction corresponding to the logic abnormal position is generated; the information collection instruction is used for indicating to collect information associated with the logical anomaly location;
receiving the information collection instruction sent by the server, and collecting target information according to the information collection instruction;
And sending the target information to a server so that the server determines the logic errors in the target application program according to the target information.
In another aspect, a program logic monitoring method is provided, the method comprising:
Receiving log information sent by at least one client; the log information is generated according to a preset error log function corresponding to a preset position when the target application program of the at least one client executes to the preset position;
Determining a logic abnormal position in the target application program according to the log information;
Generating an information collection instruction corresponding to the logic abnormal position; the information collection instruction is used for indicating to collect information associated with the logical anomaly location;
The information collection instruction is sent to the at least one client, so that the at least one client can collect target information according to the information collection instruction and send the target information to a server;
And determining the logic errors existing in the target application program according to the target information.
In another aspect, a program logic monitoring method is provided, the method comprising:
When a target application program is executed to a preset position, the client generates log information of the preset position according to a preset error log function corresponding to the preset position; the log information is sent to a server;
The server receives log information sent by at least one client; determining a logic abnormal position in the target application program according to the log information; generating an information collection instruction corresponding to the logic abnormal position; the information collection instruction is used for indicating to collect information associated with the logical anomaly location; transmitting the information collection instruction to the at least one client;
The client receives an information collection instruction sent by the server, and collects target information according to the information collection instruction; the target information is sent to a server;
and the server determines the logic errors in the target application program according to the target information returned by the at least one client.
In another aspect, there is provided a program logic monitoring apparatus, the apparatus comprising:
The log generation module is used for generating log information of a preset position according to a preset error log function corresponding to the preset position when the target application program is executed to the preset position;
the first sending module is used for sending the log information to a server so that the server can determine the logic abnormal position in the target application program according to the log information and generate an information collection instruction corresponding to the logic abnormal position; the information collection instruction is used for indicating to collect information associated with the logical anomaly location;
the target information collection module is used for receiving the information collection instruction sent by the server and collecting target information according to the information collection instruction;
And the second sending module is used for sending the target information to a server so that the server can determine the logic errors in the target application program according to the target information.
Optionally, the log generation module includes:
The third determining module is used for calling a preset error log function corresponding to the preset position and determining the position identification of the preset position through the preset error log function;
a fourth determining module, configured to determine a log level of the log information according to an error level of the preset error log function;
and the generation sub-module is used for generating log information of the preset position according to the position identification of the preset position and the log level.
Optionally, the third determining module includes:
The first acquisition module is used for acquiring the file name of the file where the target application program is located and a preset output character string corresponding to the preset position;
A fifth determining module, configured to determine the file name and a binary number corresponding to the preset output string;
And the operation module is used for carrying out exclusive OR operation on the binary number of the file name and the binary number of the preset output character string to obtain the position identification of the preset position.
Optionally, the apparatus further includes:
The storage module is used for storing the log information into a preset shared storage section of the memory;
The second acquisition module is used for acquiring the log information with the log level being a preset level in the preset shared storage section, and taking the log information with the log level being the preset level as the log information to be sent to the server.
Optionally, the storage module includes:
a fifth determining module, configured to determine a data size of the log information;
A sixth determining module, configured to determine a memory offset position in the preset shared storage segment that matches the data size;
and the writing module is used for writing the log information into the memory offset position.
Optionally, the apparatus further includes:
and the creation module is used for responding to the starting of the target application program and creating the preset shared storage segment in the memory.
In another aspect, there is provided a program logic monitoring apparatus, the apparatus comprising:
The first receiving module is used for receiving log information sent by at least one client; the log information is generated according to a preset error log function corresponding to a preset position when the target application program of the at least one client executes to the preset position;
The first determining module is used for determining the logic abnormal position in the target application program according to the log information;
The collection instruction generation module is used for generating an information collection instruction corresponding to the logic abnormal position; the information collection instruction is used for indicating to collect information associated with the logical anomaly location;
The third sending module is used for sending the information collection instruction to the at least one client so that the at least one client can collect target information according to the information collection instruction and send the target information to a server;
and the second determining module is used for determining the logic errors existing in the target application program according to the target information.
Optionally, the first determining module includes:
a seventh determining module, configured to determine, according to the location identifiers of the preset locations in the log information, a total number of log information corresponding to each location identifier;
The judging module is used for judging whether the total quantity of the log information corresponding to each position mark meets a preset condition or not;
and the eighth determining module is used for determining that the preset position corresponding to the position identifier is a logic abnormal position when the judging result is yes.
Optionally, the information collection instruction includes an instruction for collecting log information and/or an instruction for collecting a memory dump; correspondingly, the second determining module includes:
a ninth determining module, configured to determine log information in which a logical error exists in the collected log information;
A tenth determining module, configured to determine, according to the location identifier in the log information with the logic error, a location where the logic error exists in the target application program; and/or the number of the groups of groups,
An eleventh determining module is configured to determine a stack of log information corresponding to the logical error in the collected memory dump.
In another aspect, a program logic monitoring system is provided, the system comprising a monitoring server and at least one client,
The at least one client is used for generating log information of a preset position according to a preset error log function corresponding to the preset position when the target application program is executed to the preset position; the log information is sent to a server; receiving an information collection instruction sent by the server, and collecting target information according to the information collection instruction; the target information is sent to a server;
The monitoring server is used for receiving log information sent by the at least one client; determining a logic abnormal position in the target application program according to the log information; generating an information collection instruction corresponding to the logic abnormal position; the information collection instruction is used for indicating to collect information associated with the logical anomaly location; transmitting the information collection instruction to the at least one client; and determining logic errors in the target application program according to the target information returned by the at least one client.
In another aspect, a terminal is provided, including a processor and a memory, where at least one instruction, at least one program, a code set, or an instruction set is stored in the memory, where the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the program logic monitoring method on the client side.
In another aspect, a monitoring server is provided, including a processor and a memory, where at least one instruction, at least one program, a code set, or an instruction set is stored in the memory, where the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the foregoing method for monitoring program logic on a server side.
In another aspect, a computer readable storage medium having stored therein at least one instruction, at least one program, code set, or instruction set loaded and executed by a processor to implement a program logic monitoring method as described above is provided.
According to the embodiment of the invention, when the target application program is executed to the preset position, the log information of the preset position is generated according to the preset error log generation function corresponding to the preset position and is sent to the server, so that the server can determine the logic abnormal position in the target application program according to the log information, generate the information collection instruction corresponding to the logic abnormal position, collect the target information associated with the logic abnormal position after receiving the information collection instruction and send the target information to the server, and the server determines the logic error existing in the target application program based on the target information, thereby realizing the real-time monitoring of the application program logic, timely finding the logic error existing in the application program, effectively controlling the problem before the large-scale explosion of the application program is carried out, ensuring the stability of the application program, improving the experience effect of a user and ensuring the life cycle of the application program.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a block diagram of a program logic monitoring system according to an embodiment of the present invention;
FIG. 2 is a flowchart of a program logic monitoring method according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method for generating log information of a preset location according to a preset error log function corresponding to the preset location according to an embodiment of the present invention;
FIG. 4 is a flowchart illustrating another method for monitoring program logic according to an embodiment of the present invention;
FIG. 5 is a flowchart of a method for storing the log information in a predetermined shared memory segment of a memory according to an embodiment of the present invention;
FIG. 6 is a flowchart illustrating another method for monitoring program logic according to an embodiment of the present invention;
FIG. 7 is a diagram of a stack for locating log information in a memory dump corresponding to the presence of a logical error according to an embodiment of the present invention;
FIG. 8 is a timing diagram of a program logic monitoring method according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of a program logic monitoring device according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of another program logic monitoring device according to an embodiment of the present invention;
Fig. 11 is a schematic structural diagram of a terminal according to an embodiment of the present invention;
fig. 12 is a schematic structural diagram of a server according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present invention and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the invention described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Referring to fig. 1, which shows a system architecture diagram of program logic monitoring according to an embodiment of the present invention, as shown in fig. 1, a program logic monitoring system includes a monitoring server 110 and at least one client 120 connected to the monitoring server 110, where the at least one client 120 may establish a communication connection with the monitoring server 110 through a wired network or a wireless network.
The client 120 may include a smart phone, a desktop computer, a tablet computer, a notebook computer, a digital assistant, a smart wearable device, or other types of terminal devices, or may include software running in the terminal device, where the software may be an application program in the terminal device for implementing monitoring of an application program running in the terminal device, such as a computer manager, and so on.
The monitoring server 110 may comprise a single independently operating server, or a distributed server, or a server cluster consisting of a plurality of servers.
In the following, a program logic monitoring method of the present invention is described, and fig. 2 is a schematic flow chart of a program logic monitoring method provided in an embodiment of the present invention, where the method may be applied to a client side in the system architecture shown in fig. 1. It is noted that the present specification provides method operational steps as described in the examples or flowcharts, but may include more or fewer operational steps based on conventional or non-inventive labor. The order of steps recited in the embodiments is merely one way of performing the order of steps and does not represent a unique order of execution. In actual system or product execution, the methods illustrated in the embodiments or figures may be performed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment). As shown in fig. 2, the method may include:
s201, when a target application program is executed to a preset position, generating log information of the preset position according to a preset error log function corresponding to the preset position.
In the embodiment of the present disclosure, a preset error log function may be set at a preset position in a code of a target application during a code development process, and when logic of the code is executed to a position including the preset error log function, a client may generate log information corresponding to the preset position according to the preset error log function. In practical application, the preset position and the preset error log function corresponding to the preset position can be set according to practical needs, and the logic branch of the application program can be generally selected as the preset position.
To distinguish between levels of logical errors, the preset error log function of embodiments of the present disclosure may include a function corresponding to a plurality of error levels. In a specific embodiment, the default error log function from high to low error level may include the following 7 error level functions: the method comprises the steps of a FATAL ERROR log function L_FATAL (), a general ERROR log function L_ERROR (), a warning log function L_WARN (), a warning log function L_WARN_CODE (), an information log function L_INFO (), a detailed log function L_TRACE (), and a debugging log function L_DEBUG (), wherein the debugging log function L_DEBUG () is only used in a debugging stage of a development function, and an application program after normal release does not use the function any more. The FATAL ERROR log function l_fault () and the general ERROR log function l_error () belong to the FATAL ERROR log function, so that when the preset position is an important logical branch of the application program, the preset ERROR log function corresponding to the preset position can be set as the FATAL ERROR log function l_fault () or the general ERROR log function l_error ().
In this embodiment of the present disclosure, the generating the log information of the preset location according to the preset error log function corresponding to the preset location may use a method shown in fig. 3, and the method may include:
S301, calling a preset error log function corresponding to the preset position, and determining the position identification of the preset position through the preset error log function.
In the present embodiment, the location identifier is used to uniquely identify the logical location of the target application, i.e., a location in the code of the target application may be uniquely determined by the location identifier.
If … else …, as shown below, when the logic of the code executes into the else branch, it indicates that a logic ERROR has occurred, at which point l_error () is called, and the location identification of the location is determined by l_error ().
Specifically, when the location identifier of the preset location is determined through the preset error log function, a file name of a file where the target application program is located and a preset output character string corresponding to the preset location may be obtained; determining the file name and the binary number corresponding to the preset output character string; and performing exclusive OR operation on the binary number of the file name and the binary number of the preset output character string to obtain the position identification of the preset position. The preset output character strings can be set by a developer according to actual needs in the code development process, and generally, different preset output character strings are set at different preset positions. For example, a predetermined ERROR log function l_error (101, _t ("test aerror,% d,% lf,% d,% p\n"), 1, dtest,2, this) is set at a predetermined position, where "test aerror,% d,% lf,% d,% p\n" is a predetermined output string.
In practical application, the location identification is not limited to the character string based on the file name and the preset output character string, but may also be based on the character string of the file name and the function name, and the line number of the output line of the file name and the log. Because of the position identification determined based on the character strings of the file names and the function names, when a plurality of logic errors exist in one function, the specific position of the logic error cannot be distinguished; and based on the file name and the position identification determined by the line number of the log output line, when the iteration of the code version is faster, the line number of the code also changes continuously, so that different position identifications can appear in the same logic error, and the timely discovery is not facilitated. Therefore, in the embodiment of the present disclosure, it is preferable that the location identifier is determined based on the file name and the preset output string, and the location identifier determined by the method may uniquely identify the logical error location of the application program, that is, the location identifier determined by the method corresponds to the location where the logical error occurs one by one, so as to ensure the accuracy of the logical error location located subsequently.
S303, determining the log level of the log information according to the error level of the preset error log function.
According to the embodiment of the specification, the log level of the log information is determined based on the error level of the preset error log function, so that the log level can be used for representing the error level of the logic error at the preset position corresponding to the log information. For example, the log level may be FATAL, ERROR, WARN, INFO, etc.
S305, generating log information of the preset position according to the position identification of the preset position and the log level.
In this embodiment of the present disclosure, the log information of the preset position includes a position identifier of the preset position and a log level corresponding to the log information.
In practical application, the log information may further include other content, and a structure body of the preset error log function may be set according to actual needs, so that the log information including other content except the location identifier of the preset location and the log level may be output through the structure body.
In a specific embodiment, the structure of the preset error log function may be set as:
struct CBodyData6710{//struct of Recorddata
unsigned int m_uiLogCrc;//
unsigned int m_uiErrorCode;//
int m_iErrorLevel;//
std::string m_strModule;//
std::string m_strFileName;//
std::string m_strFormat;//
};
When the preset error log function of the structure body is called, the output content of the function comprises: the location identifier, the error code, the log level, the error module, the file name and the preset output character string are included in the log information generated according to the output of the preset error log function. It should be understood that the above-described preset error log function is only one example and is not limiting of the present invention.
In practical application, the generated log information may be stored, and then the stored log information is sent to the server. In consideration of the processing load of the server, the log information corresponding to the preset log level may be sent to the server, for example, the log information corresponding to the log level of the total or ERROR may be sent to the server, and the log information of the remaining log levels is not sent to the server.
And S203, the log information is sent to a server, so that the server determines the logic abnormal position in the target application program according to the log information, and an information collection instruction corresponding to the logic abnormal position is generated.
In an embodiment of the present disclosure, the information collection instruction is configured to instruct collection of information associated with the logical anomaly location. The associated information may include log information and a memory dump corresponding to a preset context of the logical anomaly location, and the information gathering instructions may include instructions to gather the log information and/or instructions to gather the memory dump, respectively. The preset context may be set according to actual requirements, for example, may be set to collect log information and memory dump corresponding to 5 or 10 rows before and after the logic exception position.
The specific manner in which the server determines the location of the logical anomaly in the target application based on the log information will be described in detail below.
S205, receiving the information collection instruction sent by the server, and collecting target information according to the information collection instruction.
Specifically, the target information is information associated with a logical anomaly location. In practical applications, the client can identify whether to collect the instruction of log information or collect the instruction of memory dump by defining the information collection instruction name and the corresponding value. For example, it may be defined that when the received information collection instruction is CrcAction _log and the value of CrcAction _log is not 0, log information is collected, and the client may collect Log information corresponding to a preset context of a logical anomaly location; defining that when the received information collection instruction is CrcAction _dump and the value of CrcAction _dump is not 0, it indicates that the memory Dump is collected, and the client can collect the memory Dump corresponding to the preset context of the logical anomaly location. In a specific embodiment, the form of the information gathering instruction may be expressed as follows:
enum{CrcAction_None=0,CrcAction_Log=1,CrcAction_Dump=2}
s207, the target information is sent to a server, so that the server determines a logic error existing in the target application program according to the target information.
After the target information is collected, the client may send the target information to the server, for example, when the client is a computer manager, the target information may be uploaded to the server through qmuplink. Exe of the computer manager, and the server may determine a logic error existing in the target application program through analysis processing of the target information. Wherein, the server determines the logic error existing in the target application program according to the target information, which will be described in detail below.
According to the technical scheme, the embodiment of the invention realizes automatic real-time monitoring of the application program under the condition that a user does not feel the situation, particularly the real-time monitoring of important logic branches, so that logic errors in the application program can be found in time, further, the problem can be effectively controlled before the application program bursts out of an abnormal problem on a large scale, the stability and the life cycle of the application program are ensured, the experience effect of the user is improved, and the communication cost with the user is reduced.
In the prior art, when log information is stored, the log information is generally stored in an external hardware device such as a disk, the log information is required to be written into the external hardware device, the information in the external hardware device can be read after the writing is completely executed, namely, the writing and the reading can not be synchronously performed, and the log information can not be read in the writing, so that the log information can not be timely sent to a server, the real-time performance of program logic monitoring is poor, and the load of the disk is increased when the log information is stored in the external hardware device such as the disk.
In view of this, another program logic monitoring method is provided in the embodiment of the present invention, and the method may be applied to the client in fig. 1, as shown in fig. 4, and the method may include:
s401, in response to the starting of the target application program, a preset shared memory segment is created in the memory.
In this embodiment of the present disclosure, the client may monitor for the start of the application, and when it is monitored that there is a start of the target application, create a preset shared memory segment in the memory in response to the start of the target application, where the preset shared memory segment allows multiple threads of the target application to access it simultaneously. The size of the preset shared memory segment can be set according to actual requirements, for example, can be set to 20M.
In practical applications, the program logic monitoring method of the embodiment of the present invention may be implemented in qmlogex.dll, so that, for other modules to use, the interface may be exported GetQMLogEx in qmlogex.dll, and the external module calls LoadLibrary to load qmlogex.dll, and then calls GetProcAddress to obtain GetQMLogEx interface (i.e. a pointer to TheShareLogger object, theShareLogger is a single object). In addition, the management function can be implemented in CShareLogger classes, CShareLogger classes inherit IQMLogEx interfaces, CQMLogCtrl, CShareLogFile and CQMLogMonitor are aggregation relations between the three classes and CShareLogger, and the aggregation relations respectively correspond to m_logctrl and m_ SHAREFILE, M _ LogMonitor member variables in the class CShareLogger. The Init function of the three classes CQMLogCtrl, CShareLogFile and CQMLogMonitor is called inside the Init function of CShareLogger, and the three classes are initialized. Within the Init function of class CQMLogCtrl, a preset shared memory segment is created by calling OpenFileMapping, createFileMapping and MapViewOfFile.
S403, when the target application program is executed to a preset position, generating log information of the preset position according to a preset error log function corresponding to the preset position.
Specifically, the details of this step may be referred to the details of the corresponding steps in the method embodiment shown in fig. 2, which are not described herein.
And S405, storing the log information into a preset shared storage section of a memory.
In this embodiment of the present disclosure, the method shown in fig. 5 may be used to store the log information into a preset shared memory segment of the memory, where the method may include:
S501, determining the data size of the log information.
For example, the determined log information has a data size of 5K, 2K, etc
S503, determining a memory offset position matched with the data size in the preset shared storage segment.
In this embodiment of the present disclosure, before writing the log information into the preset shared memory segment, a memory offset amount matching the data size of the log information may be first divided in the preset shared memory segment, so as to determine a memory offset position, where the memory offset position is a section of memory for storing the log information obtained by offsetting a certain amount in the preset shared memory segment with respect to the occupied memory position. In practice, the memory offset location may be determined by calling InterlockedCompareExchange functions.
S505, writing the log information into the memory offset position.
Specifically, the log information is written into the memory offset position, so that the log information is stored into the preset shared memory segment.
According to the embodiment of the invention, the writing of the log information is realized based on the memory offset in the preset shared memory segment, so that the synchronization of writing and reading of the preset shared memory segment is allowed, namely, the log information is written in a certain memory offset position and the log information of other memory positions in the preset shared memory segment is allowed to be read, the written log information can be timely sent to a server, the real-time performance of program logic monitoring is greatly enhanced, and no load is caused to external hardware equipment. In addition, even under the condition of a plurality of threads, the exception caused by simultaneous writing of multiple threads does not occur, and the writing performance is improved.
S407, acquiring the log information with the log level being the preset level in the preset shared storage section, and taking the log information with the log level being the preset level as the log information to be sent to the server.
In the embodiment of the present disclosure, considering the load of the server, only the log information with the log level of the preset shared memory segment being the preset level is sent to the server, so that the processing capacity of the server can be reduced, and the processing efficiency of the server can be improved. The preset level may be set to include one or more ERROR levels according to actual needs, and generally, the ERROR level belonging to the serious ERROR may be determined as the preset level, for example, the preset level may be set to be the foregoing fault, ERROR.
S409, the log information is sent to a server, so that the server determines a logic abnormal position in the target application program according to the log information, and an information collection instruction corresponding to the logic abnormal position is generated;
Specifically, the information collection instruction is configured to instruct collection of information associated with the logical anomaly location.
S411, receiving the information collection instruction sent by the server, and collecting target information according to the information collection instruction.
S413, the target information is sent to a server, so that the server determines a logic error existing in the target application program according to the target information.
The details of step S409 to step S413 may be referred to the content of the corresponding portion of the method embodiment shown in fig. 2, and are not described herein.
In practical application, when the target application program exits, the client may clear the preset shared memory segment in response to the exit of the target application program, and then release the memory of the preset shared memory segment, that is, the preset shared memory segment corresponding to the target application program is eliminated at this time.
According to the technical scheme, the embodiment of the invention realizes automatic real-time monitoring of the application program under the condition that a user does not feel the situation, particularly the real-time monitoring of important logic branches, so that logic errors in the application program can be found in time, further, the problem can be effectively controlled before the application program bursts out of an abnormal problem on a large scale, the stability and the life cycle of the application program are ensured, the experience effect of the user is improved, and the communication cost with the user is reduced.
In addition, based on the writing and reading of the log information realized by the shared storage section, cross-module, cross-process and cross-Session are supported, so that the reading and writing of the log information are almost free from delay, the real-time performance of program logic monitoring is ensured, and no load is caused to a disk.
Referring to fig. 6, a flowchart of another program logic monitoring method according to an embodiment of the present invention is shown, and the method may be applied to the server of fig. 1, as shown in fig. 6, and the method may include:
S601, receiving log information sent by at least one client.
The log information is generated according to a preset error log function corresponding to a preset position when the target application program is executed to the preset position by the at least one client.
In the embodiment of the present disclosure, the log information may include a location identifier of the preset location and a log level corresponding to the log information. In practical application, the log information may further include other content, and a structure body of the preset error log function may be set according to actual needs, so that the log information including other content except the location identifier of the preset location and the log level may be output through the structure body.
Specifically, the generation of the log information for the preset location in the client may refer to the content of the corresponding portion of the method embodiment shown in fig. 2 and fig. 6, which is not described herein.
S603, determining the logic abnormal position in the target application program according to the log information.
In this embodiment of the present disclosure, after receiving log information of a target application program uploaded by a plurality of clients, the server may determine log information having the same location identifier according to the location identifiers in the log information, so as to determine the total number of log information corresponding to each location identifier.
The server judges whether the total quantity of the log information corresponding to each position identifier meets the preset condition, and if the judging result is that the total quantity of the log information corresponding to each position identifier meets the preset condition, the preset position corresponding to the corresponding position identifier can be determined to be a logic abnormal position.
In practical application, the preset conditions can be set according to practical requirements. In a specific embodiment, the preset condition may be that the average value of the log information corresponding to the location identifier in the preset history period is not exceeded, and the preset history period may be set according to the need, for example, the previous week, the previous three days, or the like, that is, whenAnd when the total number N i of the log information corresponding to the position identification i meets the preset condition.
In another specific embodiment, the preset condition may be that the average value of the amount of log information corresponding to the location identifier does not increase by more than a preset increase rate with respect to the preset history period, that is, when,
Indicating that the total number N i of log information corresponding to the position identifier i meets a preset condition.
Wherein,The average value of the log information quantity corresponding to the position mark i in the preset historical time period is represented; the p% represents a preset increase rate, and may be set according to actual demands, for example, 50%.
S605, generating an information collection instruction corresponding to the logic abnormal position; the information collection instruction is to instruct collection of information associated with the logical anomaly location.
In this embodiment of the present disclosure, the associated information may include log information and a memory dump corresponding to a preset context of the logical anomaly location, and the information collecting instruction may include an instruction to collect log information and/or an instruction to collect a memory dump. The preset context may be set according to actual requirements, for example, may be set to collect log information and memory dump corresponding to 5 or 10 rows before and after the logic exception position.
In practical applications, the information collection instruction corresponding to the logical exception position may be generated by defining the information collection instruction name and the corresponding value, and in a specific embodiment, the information collection instruction may be expressed as: enum { CrcAction _none=0, crcaction_log=1, crcaction_dump=2 }, wherein the values of CrcAction _log and CrcAction _dump are not 0, indicating the need to collect Log information and collect memory Dump; if CrcAction _log is 0, it indicates that no Log information needs to be collected, and if CrcAction _dump is 0, it indicates that no memory Dump needs to be collected.
S607, the information collection instruction is sent to the at least one client, so that the at least one client can collect target information according to the information collection instruction, and the target information is sent to a server.
S609, determining the logic error existing in the target application program according to the target information.
Specifically, for the collected log information, the server may determine that the collected log information has a logical error, and determine, according to the location identifier in the log information having the logical error, the location where the logical error has been found in the target application program. In practical application, a log analysis tool can be used for real-time log reading and analysis, and in the log analysis process, filtering analysis of multiple dimensions can be performed on log information, including: module filtering, process filtering, thread filtering, product type filtering, log type filtering, and the like.
For the collected memory dumps, the server may determine a stack of log information in the collected memory dumps that corresponds to the presence of logical errors, thereby analyzing the cause of the problem. In practical application, analysis can be performed through a WinDbg tool provided by Microsoft, the collected memory dump is opened by utilizing the WinDbg tool, and then a 'kbL' command is input to find a stack corresponding to the error log, as shown in FIG. 7.
According to the technical scheme, the embodiment of the invention realizes automatic real-time monitoring of the application program under the condition that a user does not feel the situation, particularly the real-time monitoring of important logic branches, so that logic errors in the application program can be found in time, further, the problem can be effectively controlled before the application program bursts out of an abnormal problem on a large scale, the stability and the life cycle of the application program are ensured, the experience effect of the user is improved, and the communication cost with the user is reduced.
Referring to fig. 8, a timing diagram of a program logic monitoring method according to an embodiment of the invention is shown, the method may be applied to the system architecture shown in fig. 1, and as shown in fig. 8, the method may include:
S801, when a target application program is executed to a preset position, the client generates log information of the preset position according to a preset error log function corresponding to the preset position.
S803, the client sends the log information to the monitoring server.
S805, the monitoring server receives log information sent by at least one client.
S807, the monitoring server determines the logic abnormal position in the target application program according to the log information, and generates an information collection instruction corresponding to the logic abnormal position.
S809, the monitoring server sends the information collection instruction to the at least one client.
S811, the client receives the information collection instruction sent by the server, and collects target information according to the information collection instruction.
And S813, the client sends the target information to a monitoring server.
Correspondingly, the monitoring server receives the target information sent by at least one client.
And S815, the monitoring server determines the logic error existing in the target application program according to the target information.
Specifically, the details of the steps S801 to S815 may refer to the content of the corresponding steps of the execution subject in the foregoing method embodiment of the present disclosure, which is not described herein.
In contrast to the program logic monitoring methods provided in the foregoing embodiments, the embodiment of the present invention further provides a program logic monitoring device, and since the program logic monitoring device provided in the embodiment of the present invention corresponds to the program logic monitoring method provided in the foregoing embodiments, implementation of the foregoing program logic monitoring method is also applicable to the program logic monitoring device provided in the embodiment, and will not be described in detail in the embodiment.
Referring to fig. 9, a schematic structural diagram of a program logic monitoring device according to an embodiment of the present invention is shown, where the device has a function of implementing the client side in the above method embodiment, and the function may be implemented by hardware or implemented by executing corresponding software by hardware. As shown in fig. 9, the apparatus may include:
The log generation module 910 is configured to generate log information of a preset location according to a preset error log function corresponding to the preset location when the target application program is executed to the preset location;
A first sending module 920, configured to send the log information to a server, so that the server determines a logical abnormal location in the target application according to the log information, and generates an information collection instruction corresponding to the logical abnormal location; the information collection instruction is used for indicating to collect information associated with the logical anomaly location;
the target information collection module 930 is configured to receive the information collection instruction sent by the server, and collect target information according to the information collection instruction;
And a second sending module 940, configured to send the target information to a server, so that the server determines, according to the target information, a logic error existing in the target application program.
Optionally, the log generating module 910 may include:
The third determining module is used for calling a preset error log function corresponding to the preset position and determining the position identification of the preset position through the preset error log function;
a fourth determining module, configured to determine a log level of the log information according to an error level of the preset error log function;
and the generation sub-module is used for generating log information of the preset position according to the position identification of the preset position and the log level.
Optionally, the third determining module may include:
The first acquisition module is used for acquiring the file name of the file where the target application program is located and a preset output character string corresponding to the preset position;
A fifth determining module, configured to determine the file name and a binary number corresponding to the preset output string;
And the operation module is used for carrying out exclusive OR operation on the binary number of the file name and the binary number of the preset output character string to obtain the position identification of the preset position.
In some embodiments, the apparatus may further comprise:
The storage module is used for storing the log information into a preset shared storage section of the memory;
The second acquisition module is used for acquiring the log information with the log level being a preset level in the preset shared storage section, and taking the log information with the log level being the preset level as the log information to be sent to the server.
Optionally, the storage module may include:
a fifth determining module, configured to determine a data size of the log information;
A sixth determining module, configured to determine a memory offset position in the preset shared storage segment that matches the data size;
and the writing module is used for writing the log information into the memory offset position.
Optionally, the apparatus may further include:
and the creation module is used for responding to the starting of the target application program and creating the preset shared storage segment in the memory.
Referring to fig. 10, a schematic structural diagram of another program logic monitoring device according to an embodiment of the present invention is shown, where the device has a function of implementing the server side in the above method embodiment, and the function may be implemented by hardware or implemented by executing corresponding software by hardware. As shown in fig. 10, the apparatus may include:
A first receiving module 1010, configured to receive log information sent by at least one client; the log information is generated according to a preset error log function corresponding to a preset position when the target application program of the at least one client executes to the preset position;
A first determining module 1020, configured to determine a logical anomaly location in the target application according to the log information;
The collection instruction generating module 1030 is configured to generate an information collection instruction corresponding to the logical anomaly location; the information collection instruction is used for indicating to collect information associated with the logical anomaly location;
A third sending module 1040, configured to send the information collection instruction to the at least one client, so that the at least one client collects target information according to the information collection instruction, and sends the target information to a server;
a second determining module 1050, configured to determine a logical error existing in the target application program according to the target information.
Optionally, the first determining module 1020 may include:
a seventh determining module, configured to determine, according to the location identifiers of the preset locations in the log information, a total number of log information corresponding to each location identifier;
The judging module is used for judging whether the total quantity of the log information corresponding to each position mark meets a preset condition or not;
and the eighth determining module is used for determining that the preset position corresponding to the position identifier is a logic abnormal position when the judging result is yes.
Optionally, the information collection instruction includes an instruction for collecting log information and/or an instruction for collecting a memory dump; accordingly, the second determining module 1050 may include:
a ninth determining module, configured to determine log information in which a logical error exists in the collected log information;
A tenth determining module, configured to determine, according to the location identifier in the log information with the logic error, a location where the logic error exists in the target application program; and/or the number of the groups of groups,
An eleventh determining module is configured to determine a stack of log information corresponding to the logical error in the collected memory dump.
The embodiment of the invention also provides a program logic monitoring system, as shown in fig. 1, which comprises a monitoring server and at least one client, wherein,
The at least one client is used for generating log information of a preset position according to a preset error log function corresponding to the preset position when the target application program is executed to the preset position; the log information is sent to a server; receiving an information collection instruction sent by the server, and collecting target information according to the information collection instruction; the target information is sent to a server;
The monitoring server is used for receiving log information sent by the at least one client; determining a logic abnormal position in the target application program according to the log information; generating an information collection instruction corresponding to the logic abnormal position; the information collection instruction is used for indicating to collect information associated with the logical anomaly location; transmitting the information collection instruction to the at least one client; and determining logic errors in the target application program according to the target information returned by the at least one client.
It should be noted that, in the apparatus provided in the foregoing embodiment, when implementing the functions thereof, only the division of the foregoing functional modules is used as an example, in practical application, the foregoing functional allocation may be implemented by different functional modules, that is, the internal structure of the device is divided into different functional modules, so as to implement all or part of the functions described above. In addition, the apparatus and the method embodiments provided in the foregoing embodiments belong to the same concept, and specific implementation processes of the apparatus and the method embodiments are detailed in the method embodiments and are not repeated herein.
The program logic monitoring device provided by the embodiment of the invention realizes the real-time monitoring of the application program logic, can timely find logic errors in the application program, further can effectively control the problem before the application program massively bursts out of the abnormal problem, and can improve the experience effect of a user and ensure the life cycle of the application program while ensuring the stability of the application program.
In addition, the embodiment of the invention supports cross-module, cross-process and cross-Session based on the writing and reading of the log information realized by the shared memory segment, so that the reading and writing of the log information are almost free from delay, the real-time performance of program logic monitoring is ensured, and no load is caused to a disk.
The embodiment of the invention provides a terminal, which comprises a processor and a memory, wherein at least one instruction, at least one section of program, a code set or an instruction set is stored in the memory, and the at least one instruction, the at least one section of program, the code set or the instruction set is loaded and executed by the processor so as to realize the program logic monitoring method of the client side.
The embodiment of the invention provides a monitoring server, which comprises a processor and a memory, wherein at least one instruction, at least one section of program, a code set or an instruction set is stored in the memory, and the at least one instruction, the at least one section of program, the code set or the instruction set is loaded and executed by the processor so as to realize the program logic monitoring method of the server side.
Fig. 11 is a schematic structural diagram of a terminal according to an embodiment of the present invention, where the terminal is used to implement the program logic monitoring method on the client side provided in the above embodiment. Specifically, the present invention relates to a method for manufacturing a semiconductor device.
Terminal 1100 can include components such as RF (Radio Frequency) circuitry 1110, memory 1120 including one or more computer-readable storage media, input unit 1130, display unit 1140, video sensor 1150, audio circuit 1160, wiFi (WIRELESS FIDELITY ) module 11110, processor 1180 including one or more processing cores, and power supply 110. It will be appreciated by those skilled in the art that the terminal structure shown in fig. 11 is not limiting of the terminal and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components. Wherein:
The RF circuit 1110 may be used for receiving and transmitting signals during a message or a call, and in particular, after receiving downlink information of a base station, the downlink information is processed by one or more processors 1180; in addition, data relating to uplink is transmitted to the base station. Typically, RF circuitry 1110 includes, but is not limited to, an antenna, at least one amplifier, a tuner, one or more oscillators, a Subscriber Identity Module (SIM) card, a transceiver, a coupler, an LNA (Low Noise Amplifier ), a duplexer, and the like. In addition, RF circuitry 1110 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol including, but not limited to, GSM (Global System of Mobile communication, global system for mobile communications), GPRS (GENERAL PACKET Radio Service), CDMA (Code Division Multiple Access ), WCDMA (Wideband Code Division Multiple Access, wideband code division multiple access), LTE (Long Term Evolution ), email, SMS (Short MESSAGING SERVICE, short message Service), etc.
The memory 1120 may be used to store software programs and modules, and the processor 1180 may perform various functional applications and data processing by executing the software programs and modules stored in the memory 1120. The memory 1120 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as video data, phonebook, etc.) created according to the use of the terminal 1100, and the like. In addition, memory 1120 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 1120 may also include a memory controller to provide access to the memory 1120 by the processor 1180 and the input unit 1130.
The input unit 1130 may be used to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, the input unit 1130 may include an image input device 1131 and other input devices 1132. The image input device 1131 may be a camera or an optoelectronic scanning device. The input unit 1130 may include other input devices 1132 in addition to the image input device 1131. In particular, other input devices 1132 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, mouse, joystick, etc.
The display unit 1140 may be used to display information input by a user or information provided to the user and various graphical user interfaces of the terminal 1100, which may be composed of graphics, text, icons, video, and any combination thereof. The display unit 1140 may include a display panel 1141, and optionally, the display panel 1141 may be configured in the form of an LCD (Liquid CRYSTAL DISPLAY), an OLED (Organic Light-Emitting Diode), or the like.
The terminal 1100 may include at least one video sensor 1150 for acquiring video information of a user. Terminal 1100 can also include other sensors (not shown), such as light sensors, motion sensors, and other sensors. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 1141 according to the brightness of ambient light, and a proximity sensor that may turn off the display panel 1141 and/or the backlight when the terminal 1100 moves to the ear. As one of the motion sensors, the gravity acceleration sensor can detect the acceleration in all directions (generally three axes), and can detect the gravity and the direction when the mobile phone is stationary, and can be used for applications of recognizing the gesture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and knocking), and the like; other sensors such as gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that may also be configured with respect to the terminal 1100 are not described in detail herein.
Video circuitry 1160, speaker 1161, microphone 1162 may provide a video interface between a user and terminal 1100. The audio circuit 1160 may transmit the received electrical signal converted from audio data to the speaker 1161, and may be converted into a sound signal by the speaker 1161 to be output; on the other hand, the microphone 1162 converts the collected sound signals into electrical signals, which are received by the audio circuit 1160 and converted into audio data, which are processed by the audio data output processor 1180 for transmission to, for example, another terminal via the RF circuit 1110, or which are output to the memory 1120 for further processing. Audio circuit 1160 may also include an ear bud jack to provide for communication of a peripheral ear bud with terminal 1100.
WiFi belongs to a short-distance wireless transmission technology, and the terminal 1100 can help a user to send and receive e-mails, browse web pages, access streaming media and the like through the WiFi module 1170, so that wireless broadband Internet access is provided for the user. Although fig. 11 shows WiFi module 1170, it is understood that it does not belong to the essential constitution of terminal 1100, and can be omitted entirely as needed within the scope of not changing the essence of the invention.
The processor 1180 is a control center of the terminal 1100, connects various parts of the entire mobile phone using various interfaces and lines, and performs various functions of the terminal 1100 and processes data by running or executing software programs and/or modules stored in the memory 1120 and calling data stored in the memory 1120, thereby performing overall monitoring of the mobile phone. Optionally, the processor 1180 may include one or more processing cores; preferably, the processor 1180 may integrate an application processor and a modem processor, wherein the application processor primarily handles operating systems, user interfaces, applications, etc., and the modem processor primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 1180.
Terminal 1100 also includes a power supply 110 (e.g., a battery) for powering the various components, which may be logically connected to processor 1180 via a power management system so as to perform functions such as managing charge, discharge, and power consumption via the power management system. The power supply 110 may also include one or more of any of a direct current or alternating current power supply, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown, the terminal 1100 may further include a bluetooth module or the like, which is not described herein.
In particular, in this embodiment, the terminal 1100 further includes a memory, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors. The one or more programs include instructions for performing the client-side program logic monitoring method provided by the method embodiments described above.
Fig. 12 is a schematic structural diagram of a server according to an embodiment of the present invention, where the server is used to implement the program logic monitoring method on the server side provided in the above embodiment. The server 1200 may vary considerably in configuration or performance and may include one or more central processing units (Central Processing Units, CPUs) 1210 (the processor 1210 may include, but is not limited to, a microprocessor MCU or a processing device such as a programmable logic device FPGA), memory 1230 for storing data, one or more storage mediums 1220 (e.g., one or more mass storage devices) for storing applications 1223 or data 1222. Wherein memory 1230 and storage medium 1220 can be transitory or persistent. The program stored on the storage medium 1220 may include one or more modules, each of which may include a series of instruction operations on a server. Still further, the central processor 1210 may be configured to communicate with a storage medium 1220 and execute a series of instruction operations in the storage medium 1220 on the server 1200. The server 1200 may also include one or more power supplies 1260, one or more wired or wireless network interfaces 1250, one or more input/output interfaces 1240, and/or one or more operating systems 1221, such as Windows Server, mac OS XTM, unixTM, linuxTM, freeBSDTM, and the like.
The input-output interface 1240 may be used to receive or transmit data via a network. The specific example of the network described above may include a wireless network provided by a communication provider of the server 1200. In one example, the input/output interface 1240 includes a network adapter (Network Interface Controller, NIC) that can connect to other network devices through a base station to communicate with the internet. In one example, the input/output interface 1240 may be a Radio Frequency (RF) module for communicating with the internet wirelessly.
It will be appreciated by those of ordinary skill in the art that the configuration shown in fig. 12 is merely illustrative and is not intended to limit the configuration of the electronic device described above. For example, the server 1200 may also include more or fewer components than shown in fig. 12, or have a different configuration than shown in fig. 12.
Embodiments of the present invention also provide a computer readable storage medium, where the storage medium may be disposed in a terminal to store at least one instruction, at least one program, a code set, or an instruction set related to a program logic monitoring method for implementing a client side in a method embodiment, where the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by the processor to implement the program logic monitoring method provided in the method embodiment.
Embodiments of the present invention also provide a computer readable storage medium that may be disposed in a server to store at least one instruction, at least one program, a set of codes, or a set of instructions related to a program logic monitoring method for implementing a server side in a method embodiment, where the at least one instruction, the at least one program, the set of codes, or the set of instructions are loaded and executed by the processor to implement the program logic monitoring method provided in the method embodiment.
Alternatively, in the present embodiment, the storage medium may include, but is not limited to: a usb disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It should be noted that: the sequence of the embodiments of the present invention is only for description, and does not represent the advantages and disadvantages of the embodiments. And the foregoing description has been directed to specific embodiments of this specification. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims can be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
In this specification, each embodiment is described in a progressive manner, and identical and similar parts of each embodiment are all referred to each other, and each embodiment mainly describes differences from other embodiments. In particular, for the device embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference is made to the description of the method embodiments in part.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, where the program may be stored in a computer readable storage medium, and the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The foregoing description of the preferred embodiments of the invention is not intended to limit the invention to the precise form disclosed, and any such modifications, equivalents, and alternatives falling within the spirit and scope of the invention are intended to be included within the scope of the invention.

Claims (12)

1. A method of program logic monitoring, the method comprising:
When a target application program is executed to a preset position, calling a preset error log function corresponding to the preset position, and acquiring the file name of a file where the target application program is located and a preset output character string in the preset error log function; determining the file name and the binary number corresponding to the preset output character string, and performing exclusive OR operation on the binary number of the file name and the binary number of the preset output character string to obtain a position identifier of the preset position; wherein, the preset output character strings in the preset error log functions corresponding to different preset positions are different;
determining a log level according to the error level of the preset error log function;
generating log information of the preset position according to the position identification of the preset position and the log level;
The log information is sent to a server, so that the server determines a logic abnormal position in the target application program according to the log information, and an information collection instruction corresponding to the logic abnormal position is generated; the information collection instruction is used for indicating to collect information associated with the logical anomaly location;
receiving the information collection instruction sent by the server, and collecting target information according to the information collection instruction;
And sending the target information to a server so that the server determines the logic errors in the target application program according to the target information.
2. The program logic monitoring method of claim 1, wherein prior to sending the log information to a server, the method further comprises:
Storing the log information into a preset shared storage section of a memory;
acquiring log information with a log level of a preset level in the preset shared storage section;
And taking the log information with the log level being a preset level as the log information.
3. The method of claim 2, wherein storing the log information in a predetermined shared memory segment of a memory comprises:
determining the data size of the log information;
Determining a memory offset position matched with the data size in the preset shared storage section;
And writing the log information into the memory offset position.
4. The program logic monitoring method of claim 2, wherein prior to storing the log information in the predetermined shared memory segment of memory, the method further comprises:
and responding to the starting of the target application program, and creating the preset shared storage segment in a memory.
5. A method of monitoring program logic, the method comprising:
Receiving log information sent by at least one client; the log information is a preset error log function corresponding to a preset position when the target application program is executed to the preset position by the at least one client, and a file name of a file where the target application program is located and a preset output character string in the preset error log function are obtained; determining the file name and the binary number corresponding to the preset output character string, and performing exclusive OR operation on the binary number of the file name and the binary number of the preset output character string to obtain a position identifier of the preset position; determining a log level according to the error level of the preset error log function; generating log information of the preset position according to the position identification of the preset position and the log level; wherein, the preset output character strings in the preset error log functions corresponding to different preset positions are different;
Determining a logic abnormal position in the target application program according to the log information;
Generating an information collection instruction corresponding to the logic abnormal position; the information collection instruction is used for indicating to collect information associated with the logical anomaly location;
The information collection instruction is sent to the at least one client, so that the at least one client can collect target information according to the information collection instruction and send the target information to a server;
And determining the logic errors existing in the target application program according to the target information.
6. The program logic monitoring method of claim 5, wherein the determining the location of the logical exception in the target application from the log information comprises:
determining the total number of the log information corresponding to each position mark according to the position mark of the preset position in the log information;
judging whether the total quantity of the log information corresponding to each position mark meets a preset condition or not;
And when the judgment result is yes, determining that the preset position corresponding to the position identifier is a logic abnormal position.
7. The program logic monitoring method of claim 5, wherein the information gathering instructions include instructions to gather log information and/or instructions to gather a memory dump;
Accordingly, the determining, according to the target information, the logic error existing in the target application program includes:
Determining log information with logic errors in the collected log information;
Determining the position of the logic error in the target application program according to the position identification in the log information with the logic error; and/or the number of the groups of groups,
A stack of log information in the collected memory dump corresponding to the presence of the logical error is determined.
8. A program logic monitoring device, the device comprising:
The log generation module is used for calling a preset error log function corresponding to a preset position when the target application program is executed to the preset position, and acquiring the file name of the file where the target application program is located and a preset output character string in the preset error log function; determining the file name and the binary number corresponding to the preset output character string, and performing exclusive OR operation on the binary number of the file name and the binary number of the preset output character string to obtain a position identifier of the preset position; determining a log level according to the error level of the preset error log function; generating log information of the preset position according to the position identification of the preset position and the log level; wherein, the preset output character strings in the preset error log functions corresponding to different preset positions are different;
the first sending module is used for sending the log information to a server so that the server can determine the logic abnormal position in the target application program according to the log information and generate an information collection instruction corresponding to the logic abnormal position; the information collection instruction is used for indicating to collect information associated with the logical anomaly location;
the target information collection module is used for receiving the information collection instruction sent by the server and collecting target information according to the information collection instruction;
And the second sending module is used for sending the target information to a server so that the server can determine the logic errors in the target application program according to the target information.
9. A program logic monitoring device, the device comprising:
The first receiving module is used for receiving log information sent by at least one client; the log information is a preset error log function corresponding to a preset position when the target application program is executed to the preset position by the at least one client, and a file name of a file where the target application program is located and a preset output character string in the preset error log function are obtained; determining the file name and the binary number corresponding to the preset output character string, and performing exclusive OR operation on the binary number of the file name and the binary number of the preset output character string to obtain a position identifier of the preset position; determining a log level according to the error level of the preset error log function; generating log information of the preset position according to the position identification of the preset position and the log level; wherein, the preset output character strings in the preset error log functions corresponding to different preset positions are different;
The first determining module is used for determining the logic abnormal position in the target application program according to the log information;
The collection instruction generation module is used for generating an information collection instruction corresponding to the logic abnormal position; the information collection instruction is used for indicating to collect information associated with the logical anomaly location;
The third sending module is used for sending the information collection instruction to the at least one client so that the at least one client can collect target information according to the information collection instruction and send the target information to a server;
and the second determining module is used for determining the logic errors existing in the target application program according to the target information.
10. A terminal comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a set of codes, or a set of instructions, the at least one instruction, the at least one program, the set of codes, or the set of instructions being loaded and executed by the processor to implement the program logic monitoring method of any one of claims 1-4.
11. A monitoring server comprising a processor and a memory, wherein the memory stores at least one instruction, at least one program, a set of codes, or a set of instructions, the at least one instruction, the at least one program, the set of codes, or the set of instructions being loaded and executed by the processor to implement the program logic monitoring method of any one of claims 5-7.
12. A computer readable storage medium having stored therein at least one instruction, at least one program, code set, or instruction set, the at least one instruction, the at least one program, the code set, or instruction set being loaded and executed by a processor to implement the program logic monitoring method of any of claims 1-7.
CN201910480119.6A 2019-06-04 2019-06-04 Program logic monitoring method and device Active CN112035311B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910480119.6A CN112035311B (en) 2019-06-04 2019-06-04 Program logic monitoring method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910480119.6A CN112035311B (en) 2019-06-04 2019-06-04 Program logic monitoring method and device

Publications (2)

Publication Number Publication Date
CN112035311A CN112035311A (en) 2020-12-04
CN112035311B true CN112035311B (en) 2024-07-12

Family

ID=73575839

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910480119.6A Active CN112035311B (en) 2019-06-04 2019-06-04 Program logic monitoring method and device

Country Status (1)

Country Link
CN (1) CN112035311B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112650613B (en) * 2020-12-29 2023-09-26 北京天融信网络安全技术有限公司 Error information processing method and device, electronic equipment and storage medium
CN112749059A (en) * 2021-01-13 2021-05-04 叮当快药科技集团有限公司 Front-end abnormity monitoring method, device and system

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102981943A (en) * 2012-10-29 2013-03-20 新浪技术(中国)有限公司 Method and system for monitoring application logs
CN109388537A (en) * 2018-08-31 2019-02-26 阿里巴巴集团控股有限公司 Operation information tracking, device and computer readable storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100717242B1 (en) * 2005-08-11 2007-05-11 엔에이치엔(주) Error management system providing debugging information and method using the same
CN106250424B (en) * 2016-07-22 2019-12-03 杭州朗和科技有限公司 A kind of searching method, the apparatus and system of log context
CN107145429A (en) * 2017-06-01 2017-09-08 成都通甲优博科技有限责任公司 A kind of log analysis method and system
CN108459939B (en) * 2018-01-08 2020-06-23 平安科技(深圳)有限公司 Log collection method and device, terminal equipment and storage medium
CN108920364A (en) * 2018-06-21 2018-11-30 深圳壹账通智能科技有限公司 Software defect positioning method, device, terminal and computer readable storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102981943A (en) * 2012-10-29 2013-03-20 新浪技术(中国)有限公司 Method and system for monitoring application logs
CN109388537A (en) * 2018-08-31 2019-02-26 阿里巴巴集团控股有限公司 Operation information tracking, device and computer readable storage medium

Also Published As

Publication number Publication date
CN112035311A (en) 2020-12-04

Similar Documents

Publication Publication Date Title
CN107368400B (en) CPU monitoring method and device, computer readable storage medium and mobile terminal
US10824449B2 (en) Application running method and device
CN106708554B (en) Program operating method and device
CN107291586B (en) Application program analysis method and device
CN108039963B (en) Container configuration method and device and storage medium
CN106294108B (en) Application program testing method and device
CN110046497B (en) Function hook realization method, device and storage medium
CN106294168B (en) A kind of method and system carrying out Application testing
CN111858112B (en) Method, client and server for detecting memory leakage
CN110831262B (en) Signal processing method and signal processing device
CN110837343B (en) Snapshot processing method and device and terminal
CN112035311B (en) Program logic monitoring method and device
CN111913848A (en) Data monitoring and analyzing method and related equipment
CN112711516B (en) Data processing method and related device
CN106709330B (en) Method and device for recording file execution behaviors
CN105528220B (en) Method and device for loading dynamic shared object
CN116468382A (en) RPA robot flow management method, device, equipment and storage medium
CN108269223B (en) Webpage graph drawing method and terminal
CN113961380B (en) Cross-application repair method, device, equipment and storage medium
CN112181508B (en) Page automatic refreshing method and device and computer equipment
CN112667868B (en) Data detection method and device
CN109471708B (en) Task processing method, device and system
CN108280798B (en) Method and device for rendering and displaying browser kernel
CN110913022A (en) Method, device and system for downloading network file of mobile terminal and storage medium
CN105278967B (en) System updating method, device and system of mobile terminal

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
GR01 Patent grant
GR01 Patent grant