CN112035311A - Program logic monitoring method and device - Google Patents

Program logic monitoring method and device Download PDF

Info

Publication number
CN112035311A
CN112035311A CN201910480119.6A CN201910480119A CN112035311A CN 112035311 A CN112035311 A CN 112035311A CN 201910480119 A CN201910480119 A CN 201910480119A CN 112035311 A CN112035311 A CN 112035311A
Authority
CN
China
Prior art keywords
information
preset
log
logic
log information
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.)
Granted
Application number
CN201910480119.6A
Other languages
Chinese (zh)
Other versions
CN112035311B (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
Priority claimed from CN201910480119.6A external-priority 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

Images

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)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Mathematical Physics (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Medical Informatics (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; sending the log information to a server so that the server determines a 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; the information collection instruction is used for indicating to collect information associated with the logic exception position; 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 existing in the target application program according to the target information. The invention realizes the real-time monitoring of the application program logic, finds the logic error 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 an apparatus for monitoring program logic.
Background
With the rapid development of the internet communication technology, more and more applications are installed in the terminal, and a logic error existing in a logic code for implementing each application often determines the life cycle of the application, for example, an application which frequently appears abnormal or even crashes in operation is abandoned by a user quickly due to poor user experience effect, so that the life cycle of the application is greatly shortened.
In the related art, generally, after receiving a large amount of feedback information of a user on an operation error of an application program, a logical error in the application program is checked, and a problem of poor real-time performance of monitoring the logical error in the application program exists, so that the abnormal problem cannot be effectively controlled before the abnormal problem occurs in a large scale in the application program, and further, a life cycle of the application program is influenced.
Disclosure of Invention
In order to solve the problems in the prior art, embodiments of the present invention provide a method and an apparatus for monitoring program logic. The technical scheme is as follows:
in one aspect, a method for monitoring program logic is provided, and the method includes:
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;
sending the log information to a server, so that the server determines a 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; the information collection instruction is used for indicating to collect information associated with the logic exception position;
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 existing in the target application program according to the target information.
In another aspect, a method for monitoring program logic is provided, the method comprising:
receiving log information sent by at least one client; the log information is generated at a preset position according to a preset error log function corresponding to the preset position when a target application program is executed to the preset position 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 logic exception position;
sending 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;
and determining a logic error existing in the target application program according to the target information.
In another aspect, a method for monitoring program logic is provided, the method comprising:
when a target application program is executed to a preset position, a client generates log information of the preset position according to a preset error log function corresponding to the preset position; sending the log information 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 logic exception position; sending 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; sending the target information to a server;
and the server determines the logic error existing in the target application program according to the target information returned by the at least one client.
In another aspect, a program logic monitoring apparatus is provided, the apparatus comprising:
the log generating module is used for generating log information of a preset position according to a preset error log function corresponding to the preset position when a 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 determines a logic abnormal position in the target application program according to the log information and generates an information collecting instruction corresponding to the logic abnormal position; the information collection instruction is used for indicating to collect information associated with the logic exception position;
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 determines the logic errors existing in the target application program according to the target information.
Optionally, the log generating module includes:
a third determining module, configured to call a preset error log function corresponding to the preset position, and determine a position identifier of the preset position through the preset error log function;
a fourth determining module, configured to determine, according to an error level of the preset error log function, a log level of the log information;
and the generating submodule is used for generating the 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 filename and a binary number corresponding to the preset output character string;
and the operation module is used for carrying out XOR operation on the binary number of the file name and the binary number of the preset output character string to obtain the position identifier of the preset position.
Optionally, the apparatus further comprises:
the storage module is used for storing the log information into a preset shared storage segment of a memory;
and the second acquisition module is used for acquiring the log information with the log level as the preset level in the preset shared storage segment, and taking the log information with the log 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, where the memory offset position matches the size of the data;
and the writing module is used for writing the log information into the memory offset position.
Optionally, the apparatus further comprises:
and the creating module is used for responding to the starting of the target application program and creating the preset shared memory segment in the memory.
In another aspect, a program logic monitoring apparatus is provided, the apparatus comprising:
the first receiving module is used for receiving log information sent by at least one client; the log information is generated at a preset position according to a preset error log function corresponding to the preset position when a target application program is executed to the preset position by the at least one client;
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 logic exception position;
a third sending module, 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;
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 identifier of the preset location in the log information, a total amount of the log information corresponding to each location identifier;
the judging module is used for judging whether the total amount of the log information corresponding to each position identifier 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 judgment result is yes.
Optionally, the information collecting instruction includes an instruction to collect log information and/or an instruction to collect a memory dump; accordingly, the second determining module comprises:
a ninth determining module, configured to determine that log information with 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 logical error, a location where the logical error exists in the target application program; and/or the presence of a gas in the gas,
and an eleventh determining module for determining a stack in the collected memory dump corresponding to log information in which the logical error exists.
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 a target application program is executed to the preset position; sending the log information to a server; receiving an information collection instruction sent by the server, and collecting target information according to the information collection instruction; sending the target information to a server;
the monitoring server is used for receiving the 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 logic exception position; sending the information collection instruction to the at least one client; and determining a logic error existing in the target application program according to the target information returned by the at least one client.
In another aspect, a terminal is provided, which includes a processor and a memory, where the memory stores at least one instruction, at least one program, a code set, or an instruction set, and 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 above-mentioned method for monitoring program logic on the client side.
In another aspect, a monitoring server is provided, which includes a processor and a memory, where at least one instruction, at least one program, a code set, or a set of instructions is stored in the memory, and the at least one instruction, the at least one program, the code set, or the set of instructions is loaded and executed by the processor to implement the above-mentioned method for monitoring program logic on the server side.
In another aspect, a computer readable storage medium is provided, in which at least one instruction, at least one program, a set of codes, or a set of instructions is stored, which is loaded and executed by a processor to implement the program logic monitoring method as described above.
The embodiment of the invention generates the log information of the preset position according to the preset error log generating function corresponding to the preset position when the target application program is executed to the preset position, and sends the log information to the server, so that the server can determine the logic abnormal position in the target application program according to the log information and generate the information collecting instruction corresponding to the logic abnormal position, the client side collects the target information associated with the logic abnormal position and sends the target information to the server after receiving the information collecting instruction, the server determines the logic error in the target application program based on the target information, thereby realizing the real-time monitoring of the application program logic, finding the logic error in the application program in time and further effectively controlling the problem before the application program breaks out abnormal problems in a large scale, the stability of the application program is ensured, meanwhile, the experience effect of a user is improved, and the life cycle of the application program is ensured.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is an architecture diagram of a program logic monitoring system provided by an embodiment of the present invention;
FIG. 2 is a flow chart illustrating a method for monitoring program logic according to an embodiment of the present invention;
fig. 3 is a schematic flowchart of a method for generating log information of the 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 flow chart illustrating another method for monitoring program logic according to an embodiment of the present invention;
fig. 5 is a flowchart illustrating a method for storing the log information in a preset shared storage segment of a memory according to an embodiment of the present invention;
FIG. 6 is a flow chart illustrating another method for monitoring program logic according to an embodiment of the present invention;
FIG. 7 is a diagram illustrating a stack for finding log information corresponding to a logical error in a memory dump according to an embodiment of the present invention;
FIG. 8 is a timing diagram illustrating a method for monitoring program logic according to an embodiment of the present invention;
FIG. 9 is a schematic structural diagram of a program logic monitor according to an embodiment of the present invention;
FIG. 10 is a schematic structural diagram of another program logic monitor provided in accordance with 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 technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or 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, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Referring to fig. 1, which is a system architecture diagram of program logic monitoring provided in 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 terminal device such as a smart phone, a desktop computer, a tablet computer, a notebook computer, a digital assistant, and a smart wearable device, and may also include software running in the terminal device, where the software may be an application program in the terminal device, such as a computer administrator, for monitoring the application program running in the terminal device.
The monitoring server 110 may comprise a server operating independently, or a distributed server, or a server cluster consisting of a plurality of servers.
Fig. 2 is a schematic flow chart of a program logic monitoring method according to an embodiment of the present invention, which can be applied to a client side in the system architecture shown in fig. 1. It is noted that the present specification provides the method steps as described in the examples or flowcharts, but may include more or less steps based on routine or non-inventive labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In actual system or product execution, sequential execution or parallel execution (e.g., parallel processor or multi-threaded environment) may be possible according to the embodiments or methods shown in the figures. Specifically, as shown in fig. 2, the method may include:
s201, 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.
In this embodiment of the present description, a preset error log function may be set at a preset position in a code during a code development process of a target application program, and when a 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 applications, the preset position and the preset error log function corresponding to the preset position may be set according to actual needs, and generally, the logic branch of the application program may be selected as the preset position.
To differentiate the level of logical errors, the preset error log function of embodiments of the present specification may include functions corresponding to a plurality of error levels. In a specific embodiment, the preset error log function may have an error level from high to low, which includes the following function of 7 error levels: a FATAL ERROR log function L _ fault (), a general ERROR log function L _ ERROR (), a warning log function L _ WARN _ CODE (), an information log function L _ INFO (), a detailed log function L _ TRACE (), and a DEBUG log function L _ DEBUG (), wherein the DEBUG log function L _ DEBUG () is used only at the DEBUG stage of the development function, and the function is not used by the application program after normal release. Since the FATAL ERROR log function L _ false () and the general ERROR log function L _ ERROR () belong to the FATAL ERROR log function, when the preset location is an important logical branch of the application, the preset ERROR log function corresponding to the preset location can be set as the FATAL ERROR log function L _ false () or the general ERROR log function L _ ERROR ().
In an embodiment of this specification, the method shown in fig. 3 may be adopted for generating the log information of the preset position according to the preset error log function corresponding to the preset position, and the method may include:
s301, calling a preset error log function corresponding to the preset position, and determining the position identifier of the preset position through the preset error log function.
In the embodiment of the present specification, the location identifier is used for uniquely identifying the logical location of the target application, i.e. a location in the code of the target application can be uniquely determined by the location identifier.
The If … else … statement, shown below, indicates that a logical ERROR has occurred when the logic of the code executes into the else branch, and then calls L _ ERROR (), and determines the location identifier of the location through L _ ERROR ().
Figure BDA0002083544430000091
Figure BDA0002083544430000101
Specifically, when the position identifier of the preset position is determined through the preset error log function, the file name of the file where the target application program is located and a preset output character string corresponding to the preset position can be acquired; determining the file name and a binary number corresponding to the preset output character string; and carrying out XOR operation on the binary number of the file name and the binary number of the preset output character string to obtain the position identifier of the preset position. The preset output character strings can be set by developers according to actual needs in the development process of codes, and different preset output character strings are set at different preset positions. For example, a preset ERROR log function L _ ERROR (101, _ T ("test aerror,% d,% lf,% d,% p \ n"),1, dtest,2, this) is set at a preset position, and the "test aerror,% d,% lf,% d,% p \ n" is the preset output character string.
In practical application, when determining the position identifier, the method is not limited to outputting the character string based on the file name and the preset output character string, and may also output the row number of the row based on the file name and the function name, and the file name and the log. Due to the position identification determined by the character string based on the file name and the function name, when a plurality of logic errors exist in one function, the specific positions of the logic errors cannot be distinguished; the position identifier determined based on the file name and the row number of the log output row is not beneficial to timely discovery because the row number of the code can be changed continuously when the iteration of the code version is faster, and thus different position identifiers can appear in the same logic error. Therefore, in the embodiment of the present specification, preferably, the location identifier is determined based on the file name and the preset output character string, and the location identifier determined by the method can 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 to one, so that the accuracy of the subsequently located logical error location is ensured.
S303, determining the log level of the log information according to the error level of the preset error log function.
The embodiment of the specification determines the log level of the log information 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, and so forth.
S305, generating the 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 specification, 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 contents, and the structural body for presetting the error log function may be set according to actual needs, so that the log information including other contents except the position identifier of the preset position and the log level may be output through the structural 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 log function includes 6 fields of a location identifier, an error code, a log level, an error module, a file name, and a preset output string, so that log information generated according to an output of the preset error log function may include the location identifier, the error code, the log level, the error module, the file name, and the preset output string. It should be understood that the above-mentioned preset error log function is only an example and does not constitute a limitation of the present invention.
In practical applications, the generated log information may be stored, and then the stored log information may be sent to the server. In consideration of the processing load of the server, the log information corresponding to a preset log level may be transmitted to the server, for example, the log information corresponding to the far or ERROR log level may be transmitted to the server, and the log information of the remaining log levels may not be transmitted to the server.
S203, sending the log information to a server, so that the server determines a 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.
In an embodiment of the present specification, the information collection instruction is to instruct collection of information associated with the logical exception location. The associated information may include log information and a memory dump corresponding to a preset context of the logical exception location, and accordingly, the information collection 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, the preset context may be set to collect log information and memory dump and the like corresponding to 5 or 10 rows before and after the logical abnormal position.
The specific manner in which the server determines the location of the logical exception in the target application according to 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 exception location. In practical applications, the client may identify whether to collect the log information or the memory dump by defining the name of the information collection instruction and the corresponding value. For example, it may be defined that when the received information collection instruction is CrcAction _ Log and the value of the CrcAction _ Log is not 0, the collection of Log information is indicated, and the client may collect Log information corresponding to a preset context of the logical abnormal position; when the received information collection instruction is CrcAction _ Dump and the value of CrcAction _ Dump is not 0, it indicates to collect a memory Dump, and the client can collect a memory Dump corresponding to a preset context of the logical exception location. In one particular embodiment, the form of the information gathering instruction may be expressed as follows:
enum{CrcAction_None=0,CrcAction_Log=1,CrcAction_Dump=2}
s207, sending the target information to a server so that the server determines the logic errors existing in the target application program according to the target information.
After collecting the target information, the client may send the target information to the server, for example, when the client is a computer administrator, the target information may be uploaded to the server through qmupload. 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 of the embodiment of the invention, the embodiment of the invention realizes automatic real-time monitoring on the application program under the condition that the user has no perception, particularly real-time monitoring on important logic branches, so that logic errors existing in the application program can be found in time, further the problem can be effectively controlled before the application program breaks out of abnormality in 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 cost of communication 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, and the storage mode needs to write the log information into the external hardware device first, and the information in the external hardware device can be read only after the writing is completely executed, i.e., the writing and the reading can not be performed synchronously, and the information can not be read during the writing, so that the log information can not be sent to a server in time, the real-time performance of program logic monitoring is poor, and meanwhile, 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, an embodiment of the present invention provides another program logic monitoring method, which may be applied to the client in fig. 1, and as shown in fig. 4, the method may include:
s401, responding to the starting of the target application program, and creating a preset shared memory segment in the memory.
In this embodiment of the present description, a client may monitor the start of an application program, and when it is monitored that a target application program is started, a preset shared memory segment is created in a memory in response to the start of the target application program, where the preset shared memory segment allows multiple threads of the target application program to access the target application program at the same time. The size of the preset shared memory segment can be set according to actual requirements, and can be set to 20M, for example.
In practical applications, the program logic monitoring method of the embodiment of the present invention may be implemented in qmlogex.dll, and in order to enable other modules to use the method, a GetQMLogEx interface may be exported in qmlogex.dll, an external module calls LoadLibrary to load qmlogex.dll, and then calls GetProcAddress to obtain GetQMLogEx interface (i.e., a pointer of the sharegger object, which is a single-instance object). In addition, the management function can be realized in the CShareLogger class, the CShareLogger class inherits the IQMLLogEx interface, and the three classes of CQMLogCtrl, CShareLogFile and CQMLogmonitor and CShareLogger are in an aggregation relation and respectively correspond to three member variables of m _ LogCtrl, m _ ShareFile and m _ Logmonitor in the class CShareLogger. The Init functions of three classes of CQMLogCtrl, CShareLogFile and CQMLogmonitor are called in the Init function of CShareLogger, and the three classes are initialized. In an Init function of a CQMLogCtrl class, a preset shared storage segment is created by calling OpenFileMapping, CreateFileMapping and MapViewOfFile.
And 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 refer to the contents of the corresponding step in the foregoing embodiment of the method shown in fig. 2, and are not described herein again.
S405, storing the log information into a preset shared storage segment of a memory.
In this embodiment of the present specification, the method shown in fig. 5 may be used to implement storing the log information in a preset shared storage segment of a memory, where the method may include:
s501, determining the data size of the log information.
For example, the data size of the determined log information is 5K, 2K, etc
And S503, determining the memory offset position matched with the data size in the preset shared storage segment.
In this embodiment of the present description, before writing the log information into the preset shared storage segment, a memory offset matched with the data size of the log information may be divided in the preset shared storage segment, so as to determine a memory offset position, where the memory offset position is a section of memory used for storing the log information, obtained by offsetting a certain amount from an occupied memory position in the preset shared storage segment. In practical application, the memory offset position can be determined by calling an InterlockedCompareExchange function.
And 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 in the preset shared storage segment.
The embodiment of the invention realizes the writing-in of the log information based on the memory offset in the preset shared memory segment, thereby allowing the synchronization of the writing-in and the reading of the preset shared memory segment, namely, the log information is written in a certain memory offset position while the log information of other memory positions in the preset shared memory segment is allowed to be read, ensuring that the written log information can be subsequently and timely sent to a server, greatly enhancing the real-time performance of program logic monitoring and having no load on external hardware equipment. In addition, even under the condition that a plurality of threads exist, the exception caused by simultaneous writing of multiple threads can not occur, and the writing performance is improved.
S407, acquiring the log information with the log level as the preset level in the preset shared storage segment, and taking the log information with the log level as the log information to be sent to the server.
In the embodiment of the present specification, in consideration of the load of the server, only the log information of which the log level is the preset level in the preset shared storage segment is sent to the server, so that the processing amount 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 the ERROR level belonging to a FATAL ERROR may be generally determined as the preset level, for example, the preset level may be set to the aforementioned FATAL and ERROR.
S409, sending the log information to a server so that the server determines a 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;
in particular, the information collection instruction is configured to instruct collection of information associated with the logical exception location.
S411, receiving the information collection instruction sent by the server, and collecting target information according to the information collection instruction.
S413, sending the target information to a server, so that the server determines a logic error existing in the target application according to the target information.
The details of steps S409 to S413 may refer to the contents of the corresponding parts of the embodiment of the method shown in fig. 2, and are not described herein again.
In practical applications, when the target application program exits, the client may respond to the exit of the target application program to clear the preset shared memory segment and further release the memory of the preset shared memory segment, that is, at this time, the preset shared memory segment corresponding to the target application program is eliminated.
According to the technical scheme of the embodiment of the invention, the embodiment of the invention realizes automatic real-time monitoring on the application program under the condition that the user has no perception, particularly real-time monitoring on important logic branches, so that logic errors existing in the application program can be found in time, further the problem can be effectively controlled before the application program breaks out of abnormality in 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 cost of communication with the user is reduced.
In addition, the writing and reading of the log information realized based on the shared storage segment supports cross-module, cross-process and cross-Session, so that the reading and writing of the log information are almost not delayed, the real-time performance of program logic monitoring is ensured, and no load is applied to a disk.
Referring to fig. 6, a flow chart of another program logic monitoring method according to an embodiment of the present invention is shown, where the method may be applied to the server in fig. 1, and as shown in fig. 6, the method may include:
s601, receiving log information sent by at least one client.
The log information is generated at the 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 by the at least one client.
In this embodiment, 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 contents, and the structural body for presetting the error log function may be set according to actual needs, so that the log information including other contents except the position identifier of the preset position and the log level may be output through the structural body.
Specifically, for the generation of the log information of the preset position in the client, reference may be made to the contents of the corresponding parts in the embodiments of the methods shown in fig. 2 and fig. 6, which are not described herein again.
S603, determining the logic abnormal position in the target application program according to the log information.
In this embodiment, after receiving log information of a target application uploaded by a plurality of clients, a server may determine, according to a location identifier in the log information, log information having the same location identifier, so as to determine the total amount of log information corresponding to each location identifier.
The server judges whether the total amount of the log information corresponding to each position identification meets a preset condition, and if the judgment result is that the total amount of the log information meets the preset condition, the preset position corresponding to the corresponding position identification can be determined to be a logic abnormal position.
In practical application, the preset condition can be set according to actual requirements. In a specific embodiment, the preset condition may be that the average value of the number of log information corresponding to the location identifier is not exceeded within a preset historical time period, and the preset historical time period may be set as required, for example, the preset historical time period may be the previous week, the previous three days, and the like, that is, when the current time period is the current time period
Figure BDA0002083544430000171
Then, the total number N of the log information corresponding to the position identifier i is showniThe preset condition is satisfied.
In another specific embodiment, the preset condition may be that the average of the number of log information corresponding to the location identity with respect to the preset historical time period does not increase more than a preset increase rate, that is, when,
Figure BDA0002083544430000172
indicating the total number N of log information corresponding to the position identifier iiSatisfy the requirement ofAnd (4) presetting conditions.
Wherein the content of the first and second substances,
Figure BDA0002083544430000173
representing the average value of the number of the log information corresponding to the position identifier i in a preset historical time period; p% represents a preset increase rate, and may be set according to actual demand, 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 exception location.
In this embodiment, the associated information may include log information and a memory dump corresponding to a preset context of the logical exception location, and accordingly, the information collection 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, the preset context may be set to collect log information and memory dump and the like corresponding to 5 or 10 rows before and after the logical abnormal position.
In practical applications, an information collecting instruction corresponding to the logical exception location may be generated by defining an information collecting instruction name and a corresponding value, and in a specific embodiment, the information collecting instruction may be expressed as: enum { CrcAction _ None ═ 0, CrcAction _ Log ═ 1, and CrcAction _ Dump ═ 2}, wherein the values of CrcAction _ Log and CrcAction _ Dump are not both 0, which indicates that Log information collection and memory Dump collection are required; if the value of CrcAction _ Log is 0, it indicates that no Log information needs to be collected, and if the value of CrcAction _ Dump is 0, it indicates that no memory Dump needs to be collected.
S607, sending the information collecting instruction to the at least one client, so that the at least one client collects target information according to the information collecting instruction, and sends the target information to a server.
And 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 log information in which a logical error exists in the collected log information, and determine a location in the target application program where the logical error exists according to a location identifier in the log information in which the logical error exists. In practical application, a log analysis tool can be used for reading logs in real time for analysis, and in the analysis process of the logs, multi-dimensional filtering analysis can be performed on log information, including: module filtering, process filtering, thread filtering, product type filtering, and log type filtering, among others.
For the collected memory dump, the server may determine a stack in the collected memory dump corresponding to log information in which a logical error exists, and analyze the cause of the problem. In practical application, analysis can be performed by using a WinDbg tool provided by microsoft, the collected memory dump is opened by using the WinDbg tool, and then a command of "kbL" is input to find the stack corresponding to the error log, as shown in fig. 7.
According to the technical scheme of the embodiment of the invention, the embodiment of the invention realizes automatic real-time monitoring on the application program under the condition that the user has no perception, particularly real-time monitoring on important logic branches, so that logic errors existing in the application program can be found in time, further the problem can be effectively controlled before the application program breaks out of abnormality in 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 cost of communication with the user is reduced.
Referring to fig. 8, a timing diagram of a program logic monitoring method according to an embodiment of the present invention is shown, where the method can be applied to the system architecture shown in fig. 1, and as shown in fig. 8, the method can include:
s801, when a target application program is executed to a preset position, a client generates log information of the preset position according to a preset error log function corresponding to the preset position.
And S803, the client sends the log information to the monitoring server.
S805, the monitoring server receives the log information sent by at least one client.
S807, the monitoring server determines a 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.
And 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 the monitoring server.
Correspondingly, the monitoring server receives the target information sent by at least one client.
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 contents of the corresponding steps of the corresponding execution main body in the foregoing method embodiments of the present specification, and are not described herein again.
Corresponding to the program logic monitoring methods provided in the foregoing embodiments, embodiments of the present invention further provide a program logic monitoring apparatus, and since the program logic monitoring apparatus provided in embodiments of the present invention corresponds to the program logic monitoring methods provided in the foregoing embodiments, embodiments of the program logic monitoring method are also applicable to the program logic monitoring apparatus provided in this embodiment, and are not described in detail in this embodiment.
Please refer to fig. 9, which is a schematic structural diagram illustrating a program logic monitoring apparatus according to an embodiment of the present invention, where the apparatus has a function of implementing a client side in the foregoing method embodiment, and the function may be implemented by hardware or by hardware executing corresponding software. As shown in fig. 9, the apparatus may include:
a log generating module 910, configured to generate log information of a preset position according to a preset error log function corresponding to the preset position when a target application program is executed to the preset position;
a first sending module 920, configured to send the log information to a server, so that the server determines a logical abnormal position in the target application according to the log information, and generates an information collection instruction corresponding to the logical abnormal position; the information collection instruction is used for indicating to collect information associated with the logic exception position;
a target information collecting module 930, configured to receive the information collecting instruction sent by the server, and collect target information according to the information collecting instruction;
a second sending module 940, configured to send the target information to a server, so that the server determines a logic error existing in the target application according to the target information.
Optionally, the log generating module 910 may include:
a third determining module, configured to call a preset error log function corresponding to the preset position, and determine a position identifier of the preset position through the preset error log function;
a fourth determining module, configured to determine, according to an error level of the preset error log function, a log level of the log information;
and the generating submodule is used for generating the 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 filename and a binary number corresponding to the preset output character string;
and the operation module is used for carrying out XOR operation on the binary number of the file name and the binary number of the preset output character string to obtain the position identifier 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 segment of a memory;
and the second acquisition module is used for acquiring the log information with the log level as the preset level in the preset shared storage segment, and taking the log information with the log 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, where the memory offset position matches the size of the data;
and the writing module is used for writing the log information into the memory offset position.
Optionally, the apparatus may further include:
and the creating module is used for responding to the starting of the target application program and creating the preset shared memory segment in the memory.
Referring to fig. 10, a schematic structural diagram of another program logic monitoring apparatus according to an embodiment of the present invention is shown, where the apparatus has a function of implementing a server side in the foregoing method embodiment, and the function may be implemented by hardware or by hardware executing corresponding software. 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 at a preset position according to a preset error log function corresponding to the preset position when a target application program is executed to the preset position by the at least one client;
a first determining module 1020, configured to determine a logical exception location in the target application according to the log information;
a collection instruction generating module 1030, configured to 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 logic exception position;
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 logic error existing in the target application according to the target information.
Optionally, the first determining module 1020 may include:
a seventh determining module, configured to determine, according to the location identifier of the preset location in the log information, a total amount of the log information corresponding to each location identifier;
the judging module is used for judging whether the total amount of the log information corresponding to each position identifier 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 judgment result is yes.
Optionally, the information collecting instruction includes an instruction to collect log information and/or an instruction to collect a memory dump; accordingly, the second determining module 1050 may include:
a ninth determining module, configured to determine that log information with 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 logical error, a location where the logical error exists in the target application program; and/or the presence of a gas in the gas,
and an eleventh determining module for determining a stack in the collected memory dump corresponding to log information in which the logical error exists.
An embodiment of the present invention further provides a program logic monitoring system, as shown in fig. 1, which includes 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 a target application program is executed to the preset position; sending the log information to a server; receiving an information collection instruction sent by the server, and collecting target information according to the information collection instruction; sending the target information to a server;
the monitoring server is used for receiving the 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 logic exception position; sending the information collection instruction to the at least one client; and determining a logic error existing in the target application program according to the target information returned by the at least one client.
It should be noted that, when the apparatus provided in the foregoing embodiment implements the functions thereof, only the division of the functional modules is illustrated, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the apparatus may be divided into different functional modules to implement all or part of the functions described above. In addition, the apparatus and method embodiments provided by the above embodiments belong to the same concept, and specific implementation processes thereof are described in the method embodiments for details, which are not described herein again.
The program logic monitoring device of the embodiment of the invention realizes real-time monitoring of the application program logic, can timely find out the logic errors existing in the application program, further can effectively control the problem before the abnormal problem occurs in a large scale in the application program, improves the experience effect of a user while ensuring the stability of the application program, and ensures the life cycle of the application program.
In addition, the embodiment of the invention realizes the writing and reading of the log information based on the shared storage segment, supports the cross-module, cross-process and cross-Session, ensures that the reading and writing of the log information almost has no delay, ensures the real-time performance of program logic monitoring and has no load on 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 program, a code set or an instruction set is stored in the memory, and 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 realize the program logic monitoring method on 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 program, a code set or an instruction set is stored in the memory, and 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 realize the program logic monitoring method on the server side.
Please refer to fig. 11, which is a schematic structural diagram of a terminal according to an embodiment of the present invention, the terminal is configured to implement the method for monitoring program logic on the client side according to the foregoing embodiment. Specifically, the method comprises the following steps:
the terminal 1100 can include RF (Radio Frequency) circuitry 1110, memory 1120 including one or more computer-readable storage media, an input unit 1130, a display unit 1140, a video sensor 1150, audio circuitry 1160, a WiFi (wireless fidelity) module 11110, a processor 1180 including one or more processing cores, and the power supply 110. Those skilled in the art will appreciate that the terminal structure shown in fig. 11 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components. Wherein:
RF circuit 1110 may be used for receiving and transmitting signals during a message transmission or communication process, and in particular, for receiving downlink messages from a base station and then processing the received downlink messages by one or more processors 1180; in addition, data relating to uplink is transmitted to the base station. In general, 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, the 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 for Mobile communications), GPRS (General Packet Radio Service), CDMA (Code Division Multiple Access), WCDMA (Wideband Code Division Multiple Access), LTE (Long Term Evolution), email, SMS (Short Messaging Service), and the like.
The memory 1120 may be used to store software programs and modules, and the processor 1180 may execute various functional applications and data processing by operating 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 by 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, a phone book, etc.) created according to the use of the terminal 1100, and the like. Further, the 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 the processor 1180 and the input unit 1130 access to the memory 1120.
The input unit 1130 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. Specifically, 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 a photoelectric 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, a mouse, a joystick, and the like.
The display unit 1140 may be used to display information input by or provided to the user and various graphical user interfaces of the terminal 1100, which may be made up 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 can 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 adjusts the brightness of the display panel 1141 according to the brightness of ambient light, and a proximity sensor that turns 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 magnitude of acceleration in each direction (generally, three axes), can detect the magnitude and direction of gravity when the mobile phone is stationary, and can be used for applications of recognizing the posture of the mobile phone (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), vibration recognition related functions (such as pedometer and tapping), and the like; as for other sensors such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which can be configured in the terminal 1100, detailed descriptions thereof are omitted.
Video circuitry 1160, speakers 1161, and microphone 1162 may provide a video interface between a user and terminal 1100. The audio circuit 1160 may transmit the electrical signal converted from the received audio data to the speaker 1161, and convert the electrical signal into a sound signal for output by the speaker 1161; on the other hand, the microphone 1162 converts the collected sound signal into an electric signal, receives it by the audio circuit 1160, converts it into audio data, processes it by the audio data output processor 1180, and transmits it to, for example, another terminal via the RF circuit 1110, or outputs it to the memory 1120 for further processing. Audio circuitry 1160 may also include an earbud jack to provide peripheral headset communication with terminal 1100.
WiFi belongs to short-distance wireless transmission technology, and the terminal 1100 can help the user send and receive e-mails, browse web pages, access streaming media, etc. through the WiFi module 1170, and it provides the user with wireless broadband internet access. Although fig. 11 shows the WiFi module 1170, it is understood that it does not belong to the essential constitution of the terminal 1100, and can be omitted entirely as needed within the scope 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 operating 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, processor 1180 may include one or more processing cores; preferably, the processor 1180 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated within processor 1180.
The terminal 1100 also includes a power supply 110 (e.g., a battery) for powering the various components, which may preferably be logically connected to the processor 1180 via a power management system that may be configured to manage charging, discharging, and power consumption. The power supply 110 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
Although not shown, the terminal 1100 may further include a bluetooth module or the like, which is not described in detail herein.
In this embodiment, the terminal 1100 further comprises 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 above-described method embodiments.
Please refer to fig. 12, which is a schematic structural diagram of a server according to an embodiment of the present invention, the server is used for implementing the method for monitoring program logic on the server side provided in the foregoing embodiment. The server 1200 may have large differences due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 1210 (the processor 1210 may include but is not limited to a Processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 1230 for storing data, and one or more storage media 1220 (e.g., one or more mass storage devices) for storing applications 1223 or data 1222. Memory 1230 and storage media 1220, among other things, may be transient storage or persistent storage. The program stored in the storage medium 1220 may include one or more modules, each of which may include a series of instruction operations for a server. Further, the central processor 1210 may be configured to communicate with the 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 so forth.
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 Interface Controller (NIC) that may be coupled to other Network devices via a base station to communicate with the internet. In one example, the input/output interface 1240 may be a Radio Frequency (RF) module, which is used to communicate with the internet in a wireless manner.
It will be understood by those skilled in the art that the structure shown in fig. 12 is only an illustration and is not intended to limit the structure of the electronic device. For example, 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, which may be disposed in a terminal to store at least one instruction, at least one program, a code set, or a set of instructions related to implementing a program logic monitoring method on a client side in the method embodiments, where the at least one instruction, the at least one program, the code set, or the set of instructions are loaded and executed by the processor to implement the program logic monitoring method provided by the above method embodiments.
Embodiments of the present invention also provide a computer-readable storage medium, where the storage medium may be disposed in a server to store at least one instruction, at least one program, a code set, or a set of instructions related to implementing a program logic monitoring method on the server side in the method embodiments, and the at least one instruction, the at least one program, the code set, or the set of instructions are loaded and executed by the processor to implement the program logic monitoring method provided in the method embodiments.
Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
It should be noted that: the precedence order of the above embodiments of the present invention is only for description, and does not represent the merits of the embodiments. And specific embodiments thereof have been described above. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may 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 may also be possible or may be advantageous.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, as for the apparatus embodiment, since it is substantially similar to the method embodiment, the description is relatively simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
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 instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents, improvements and the like that fall within the spirit and principle of the present invention are intended to be included therein.

Claims (11)

1. A method for program logic monitoring, 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;
sending the log information to a server, so that the server determines a 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; the information collection instruction is used for indicating to collect information associated with the logic exception position;
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 existing in the target application program according to the target information.
2. The method for monitoring program logic according to claim 1, wherein the generating log information of the preset location according to a preset error log function corresponding to the preset location comprises:
calling a preset error log function corresponding to the preset position, and determining a position identifier of the preset position through the preset error log function;
determining the log level of the log information according to the error level of the preset error log function;
and generating the log information of the preset position according to the position identification of the preset position and the log level.
3. The method for program logic monitoring according to claim 2, wherein said determining the location identity of the predetermined location by the predetermined error log function comprises:
acquiring a file name of a file where the target application program is located and a preset output character string corresponding to the preset position;
determining the file name and a binary number corresponding to the preset output character string;
and carrying out XOR operation on the binary number of the file name and the binary number of the preset output character string to obtain the position identifier of the preset position.
4. The program logic monitoring method of claim 2, wherein prior to sending the log information to a server, the method further comprises:
storing the log information into a preset shared storage segment of a memory;
acquiring log information with a log level of a preset level in the preset shared storage segment;
and taking the log information with the log level as a preset level as the log information.
5. The program logic monitoring method according to claim 4, wherein the storing the log information into a preset shared storage segment of a memory comprises:
determining the data size of the log information;
determining the memory offset position matched with the data size in the preset shared storage segment;
and writing the log information into the memory offset position.
6. The method of program logic monitoring according to claim 4, wherein prior to storing the log information in a 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 the memory.
7. A method of monitoring program logic, the method comprising:
receiving log information sent by at least one client; the log information is generated at a preset position according to a preset error log function corresponding to the preset position when a target application program is executed to the preset position 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 logic exception position;
sending 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;
and determining a logic error existing in the target application program according to the target information.
8. The program logic monitoring method of claim 7, wherein determining the location of the logical exception in the target application from the log information comprises:
determining the total amount of the log information corresponding to each position identification according to the position identification of the preset position in the log information;
judging whether the total amount of the log information corresponding to each position identification meets a preset condition or not;
and when the judgment result is yes, determining that the preset position corresponding to the position identification is a logic abnormal position.
9. The program logic monitoring method according to claim 7, wherein the information collecting instruction comprises an instruction to collect log information and/or an instruction to collect a memory dump;
correspondingly, the determining the logic error existing in the target application according to the target information 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 presence of a gas in the gas,
a stack in the collected memory dump corresponding to log information for which a logical error exists is determined.
10. A program logic monitoring apparatus, the apparatus comprising:
the log generating module is used for generating log information of a preset position according to a preset error log function corresponding to the preset position when a 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 determines a logic abnormal position in the target application program according to the log information and generates an information collecting instruction corresponding to the logic abnormal position; the information collection instruction is used for indicating to collect information associated with the logic exception position;
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 determines the logic errors existing in the target application program according to the target information.
11. 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 at a preset position according to a preset error log function corresponding to the preset position when a target application program is executed to the preset position by the at least one client;
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 logic exception position;
a third sending module, 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;
and the second determining module is used for determining the logic errors existing in the target application program according to the target information.
CN201910480119.6A 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 Program logic monitoring method and device

Applications Claiming Priority (1)

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

Publications (2)

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

Family

ID=

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112650613A (en) * 2020-12-29 2021-04-13 北京天融信网络安全技术有限公司 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 (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20070019881A (en) * 2005-08-11 2007-02-15 엔에이치엔(주) Error management system providing debugging information and method using the same
CN102981943A (en) * 2012-10-29 2013-03-20 新浪技术(中国)有限公司 Method and system for monitoring application logs
CN106250424A (en) * 2016-07-22 2016-12-21 杭州朗和科技有限公司 The searching method of a kind of daily record context, Apparatus and system
CN107145429A (en) * 2017-06-01 2017-09-08 成都通甲优博科技有限责任公司 A kind of log analysis method and system
CN108459939A (en) * 2018-01-08 2018-08-28 平安科技(深圳)有限公司 A kind of log collecting method, device, terminal device and storage medium
CN108920364A (en) * 2018-06-21 2018-11-30 深圳壹账通智能科技有限公司 Software defect positioning method, device, terminal and computer readable storage medium
CN109388537A (en) * 2018-08-31 2019-02-26 阿里巴巴集团控股有限公司 Operation information tracking, device and computer readable storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20070019881A (en) * 2005-08-11 2007-02-15 엔에이치엔(주) Error management system providing debugging information and method using the same
CN102981943A (en) * 2012-10-29 2013-03-20 新浪技术(中国)有限公司 Method and system for monitoring application logs
CN106250424A (en) * 2016-07-22 2016-12-21 杭州朗和科技有限公司 The searching method of a kind of daily record context, Apparatus and system
CN107145429A (en) * 2017-06-01 2017-09-08 成都通甲优博科技有限责任公司 A kind of log analysis method and system
CN108459939A (en) * 2018-01-08 2018-08-28 平安科技(深圳)有限公司 A kind of log collecting method, device, terminal device and storage medium
CN108920364A (en) * 2018-06-21 2018-11-30 深圳壹账通智能科技有限公司 Software defect positioning method, device, terminal and computer readable storage medium
CN109388537A (en) * 2018-08-31 2019-02-26 阿里巴巴集团控股有限公司 Operation information tracking, device and computer readable storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112650613A (en) * 2020-12-29 2021-04-13 北京天融信网络安全技术有限公司 Error information processing method and device, electronic equipment and storage medium
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

Similar Documents

Publication Publication Date Title
CN108959000B (en) Server pressure testing method, system and terminal
US8843895B2 (en) Debugger connection
EP3525417A1 (en) Data processing method, device, storage medium, electronic device and server
CN108268366B (en) Test case execution method and device
CN108039963B (en) Container configuration method and device and storage medium
CN105429775B (en) Method and device for reporting log
CN111176961B (en) Application program testing method and device and storage medium
CN106294108B (en) Application program testing method and device
CN107291586B (en) Application program analysis method and device
CN108415741B (en) Object serialization and deserialization method and related device
CN108337127B (en) Application performance monitoring method, system, terminal and computer readable storage medium
CN110046497B (en) Function hook realization method, device and storage medium
CN108287706B (en) Data processing method and device
CN108810057B (en) User behavior data acquisition method and device and storage medium
CN109714476B (en) Data processing method and device, mobile terminal and storage medium
CN106020962B (en) A kind of course control method and terminal device
CN111913848A (en) Data monitoring and analyzing method and related equipment
CN107734618B (en) Application program closing method and device, storage medium and electronic equipment
CN111273955A (en) Thermal restoration plug-in optimization method and device, storage medium and electronic equipment
CN112711516B (en) Data processing method and related device
CN111930565B (en) Process fault self-healing method, device and equipment for components in distributed management system
CN105528220B (en) Method and device for loading dynamic shared object
CN112035311A (en) Program logic monitoring method and device
CN112035311B (en) Program logic monitoring method and device
CN114297322A (en) Data processing method, device, terminal and storage medium

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