Functional error detection method, device, equipment and storage medium

By detecting error character representation characters in the application log and using the functional classification model to determine the error function, error reports are generated, and the problem of waste of storage space caused by the increase in error detection code in the application is solved, and efficient error detection and reporting is achieved.

CN111930549BActive Publication Date: 2024-12-20TENCENT MUSIC ENTERTAINMENT TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010817227.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-08-14
Publication Date
2024-12-20
Estimated Expiration
2040-08-14

AI Technical Summary

Technical Problem

Inserting code for error reporting functions in the application will cause the application size to increase, wasting terminal storage space.

Method used

By obtaining the log content information of the target application, detecting whether it contains preset error character characters. If it exists, obtain the target class name and function name, and use the function classification model to determine the function to which the log belongs, generate error reports, and avoiding the application Insert additional error detection codes into it.

Benefits of technology

It realizes detection and reporting of error functions in the application, without increasing the application data volume and saving terminal storage space.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN111930549B_ABST
    Figure CN111930549B_ABST
Patent Text Reader

Abstract

The present application discloses a method, device, equipment and storage medium for function error detection, which belongs to the field of computer technology. The method comprises: obtaining content information of a target log of a target application; if the content information includes a preset error characterization character, determining a reference log set corresponding to the target log; obtaining a target class name and a target function name for each log in the reference log set; determining a target function to which the target log belongs based on the target class name, the target function name and a function classification model; and generating an error report corresponding to the target function. The present application can save storage space of the terminal.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, device, equipment and storage medium for functional error detection. Background Art

[0002] In daily life, when users use applications, application runtime errors often occur, which greatly affects the user experience. For this reason, technicians have set up the following method to determine if runtime errors have occurred in the application:

[0003] The technician sets an error reporting function for the target function and inserts the code of the error reporting function into the code of the target function so that when an operation error occurs in the target function, an error report corresponding to the target function is generated. The technician can then find the corresponding function code based on the error report and troubleshoot the error.

[0004] In the process of implementing this application, the inventor found that the prior art has at least the following problems:

[0005] There are many functions in an application. If the code of the error reporting function is inserted into the code of each function, the size of the application will be greatly increased, wasting terminal storage space. Summary of the invention

[0006] The embodiments of the present application provide a method, device, equipment and storage medium for function error detection, which can solve the problem of wasting terminal storage space in the prior art. The technical solution is as follows:

[0007] In one aspect, a method for functional error detection is provided, the method comprising:

[0008] Get the content information of the target log of the target application;

[0009] If the content information includes a preset error characterization character, determining a reference log set corresponding to the target log, wherein the reference log set includes the target log and at least one log that meets a preset proximity condition with the target log;

[0010] Obtain the target class name and target function name of each log in the reference log set;

[0011] Determine the target function to which the target log belongs based on the target class name, the target function name and the function classification model;

[0012] An error report corresponding to the target function is generated.

[0013] Optionally, determining the target function to which the target log belongs based on the target class name, the target function name and the function classification model includes:

[0014] Generate a target input vector based on the target class name and the target function name, wherein each data bit of the target input vector corresponds to a combination of a class name and a function name, the data bit corresponds to two data values, the two data values ​​include a first data value and a second data value, in the target input vector, the data value of the data bit corresponding to the combination of the target class name and the target function name is the first data value, and the data value of the data bit corresponding to other combinations other than the combination of the target class name and the target function name is the second value;

[0015] Based on the target input vector and the function classification model, a target function to which the target log belongs is determined.

[0016] Optionally, before obtaining the content information of the target log of the target application, the method further includes:

[0017] During the program code compilation process of the target application, obtaining all combinations of class names and function names included in the program code;

[0018] Determine the number of all combinations of class names and function names included in the program code as the input vector length;

[0019] Obtain a functional classification model corresponding to the input vector length.

[0020] Optionally, obtaining a function classification model corresponding to the input vector length includes:

[0021] Obtaining an initial functional classification model corresponding to the input vector length;

[0022] Acquire a sample function to which the target sample log belongs as a benchmark function;

[0023] Determine a sample reference log set corresponding to the target sample log, wherein the sample reference log set includes the target sample log and at least one sample log that meets a preset proximity condition with the target sample log;

[0024] Obtaining a sample class name and a sample function name of each sample log in the sample reference log set;

[0025] Based on the sample class name, the sample function name and the benchmark function, the initial function classification model is trained to obtain a function classification model corresponding to the input vector length.

[0026] Optionally, determining a reference log set corresponding to the target log includes:

[0027] Determine a preset number of logs before and / or a preset number of logs after the target log in the recording sequence;

[0028] Determine, among the first preset number of logs and / or the second preset number of logs, a log whose recording time difference with the target log is less than a preset threshold;

[0029] The target log and the logs whose recording time difference with the target log is less than a preset threshold are combined into a reference log set.

[0030] In another aspect, a device for functional error detection is provided, the device comprising:

[0031] An acquisition module, used to acquire content information of a target log of a target application;

[0032] A determination module, configured to determine a reference log set corresponding to the target log if the content information includes a preset error characterization character, wherein the reference log set includes the target log and at least one log that satisfies a preset proximity condition with the target log;

[0033] The acquisition module is further used to obtain the target class name and target function name of each log in the reference log set;

[0034] The determination module is further used to determine the target function to which the target log belongs based on the target class name, the target function name and the function classification model;

[0035] A generating module is used to generate an error report corresponding to the target function.

[0036] Optionally, the determining module is used to:

[0037] Generate a target input vector based on the target class name and the target function name, wherein each data bit of the target input vector corresponds to a combination of a class name and a function name, the data bit corresponds to two data values, the two data values ​​include a first data value and a second data value, in the target input vector, the data value of the data bit corresponding to the combination of the target class name and the target function name is the first data value, and the data value of the data bit corresponding to other combinations other than the combination of the target class name and the target function name is the second value;

[0038] Based on the target input vector and the function classification model, a target function to which the target log belongs is determined.

[0039] Optionally, the acquisition module is further used to:

[0040] During the program code compilation process of the target application, obtaining all combinations of class names and function names included in the program code;

[0041] Determine the number of all combinations of class names and function names included in the program code as the input vector length;

[0042] Obtain a functional classification model corresponding to the input vector length.

[0043] Optionally, the acquisition module is used to:

[0044] Obtaining an initial functional classification model corresponding to the input vector length;

[0045] Acquire a sample function to which the target sample log belongs as a benchmark function;

[0046] Determine a sample reference log set corresponding to the target sample log, wherein the sample reference log set includes the target sample log and at least one sample log that meets a preset proximity condition with the target sample log;

[0047] Obtaining a sample class name and a sample function name of each sample log in the sample reference log set;

[0048] Based on the sample class name, the sample function name and the benchmark function, the initial function classification model is trained to obtain a function classification model corresponding to the input vector length.

[0049] Optionally, the determining module is used to:

[0050] Determine a preset number of logs before and / or a preset number of logs after the target log in the recording sequence;

[0051] Determine, among the first preset number of logs and / or the second preset number of logs, a log whose recording time difference with the target log is less than a preset threshold;

[0052] The target log and the logs whose recording time difference with the target log is less than a preset threshold are combined into a reference log set.

[0053] On the other hand, a computer device is provided. The computer device includes a processor and a memory. The memory stores instructions. The processor executes the instructions so that the computer device implements the method for functional error detection.

[0054] On the other hand, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores instructions, and a computer device executes the instructions so that the computer device implements the method for functional error detection.

[0055] The beneficial effects of the technical solution provided by the embodiment of the present application are:

[0056] The present application detects whether there are preset error characterization characters in the content information of the target log. If there are preset error characterization characters, the target class name and target function name in the content information are obtained and input into the function classification model to determine the target function to which the target log belongs, and then an error report corresponding to the target function is generated. It can be seen that the above method can detect the function in which the error occurs in the application, and there is no need to insert additional error detection code in the application, so the overall data volume of the application can be controlled not to increase, thereby saving the storage space of the terminal. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0058] Figure 1 It is a schematic diagram of the implementation environment provided by the embodiment of the present application;

[0059] Figure 2 is a flow chart of a method for function error detection provided by an embodiment of the present application;

[0060] Figure 3 It is a flowchart of a method for function error detection provided by an embodiment of the present application;

[0061] Figure 4 It is a schematic diagram of the structure of a device for function error detection provided by an embodiment of the present application;

[0062] Figure 5 It is a schematic diagram of the server structure provided in an embodiment of the present application. DETAILED DESCRIPTION

[0063] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below in conjunction with the accompanying drawings.

[0064] An embodiment of the present application provides a method for functional error detection, which can be implemented by a server. The server can be a background server of an application. The server can be a single server or a server group. If it is a single server, the server can be responsible for all processing required to be performed by the server in the following scheme. If it is a server group, different servers in the server group can be responsible for different processing in the following scheme. The specific processing distribution can be arbitrarily set by technical personnel according to actual needs, and will not be repeated here.

[0065] like Figure 1 As shown in the figure, when a user uses an application through a terminal, each time the application executes a process, that is, runs a section of code, it will report a log to the server. The log contains information such as timestamp, class name, function name, parameters, etc. After receiving the reported log, the server will store the received log.

[0066] Figure 2 is a flow chart of a method for function error detection provided by an embodiment of the present application. Figure 2 , the process includes:

[0067] Step 201: Obtain content information of a target log of a target application.

[0068] In implementation, when a user uses a target application through a terminal, the terminal will report logs to the server, and the server can store the reported logs, such as Figure 3 Then, the server may determine the logs of the target application as the target logs of the target application one by one, and obtain the content information of the target logs of the target application.

[0069] For example, the content information of the target log may be as follows: [2019-11-21 19:56:22.095][Q:main][WnspacketUtil.cpp:640][isTLvMode]:wnsflag=464. Correspondingly, the log stored in the server may be as follows:

[0070] [2019-11-21 9:50:22.083][Q:main][WnsOututhLoMa.cpp:176][getQmfTokenInfoshouldUseAccessToken is 1[2019-11-21 19:56:22.095][Q:main][WnspacketUtil.cpp:640][isTLvMode]:wnsflag=464

[0071] [2019-11-21 19:56:22.095][Q:main][WnsSession.cpp:501][dataReceived]:[sessionNo:7 recv data,seqNo:3942,dataLen:1124,state:4

[0072] [2019-11-21 19:56:22.095][Q:main][WnsSessionManager.cpp:765][dataReceived]:receive data.seqNo:3942,len 1124

[0073] Optionally, before performing the above processing, the server may first perform the following processing:

[0074] During the program code compilation process of the target application, all combinations of class names and function names included in the program code are obtained.

[0075] In practice, before compiling the program code of the target application, the developer can set the compiler so that after compiling the program code of the target application, the compiler outputs all the combinations of class names and function names contained in the program code. Then, after compiling the program code of all target applications, the server can obtain all the combinations of class names and function names.

[0076] For example, the compiler is set to insert probes into the program code by means of stubs (i.e., insert a code segment that can collect information, which can be an assignment statement or a function for collecting coverage information), so that the compiler outputs a combination of the class name and the function name after the class declaration and function declaration in the program code.

[0077] The number of combinations of all class names and function names included in the program code is determined as the input vector length.

[0078] In implementation, after obtaining the number of all combinations of class names and function names, the server may obtain the number of all combinations of class names and function names, and use the value of the number as the value of the input vector length.

[0079] Get the function classification model corresponding to the input vector length.

[0080] In implementation, after determining the input vector length, the server can obtain an initial function classification model corresponding to the input vector length, obtain the sample function to which the target sample log belongs as a benchmark function, determine the sample reference log set corresponding to the target sample log, and obtain the sample class name and sample function name of each sample log in the sample reference log set, wherein the sample reference log set includes the target sample log and at least one sample log that meets a preset proximity condition with the target sample log.

[0081] For example, after determining that the input vector length is 100, the server can obtain an initial function classification model with an input vector length of 100, and the initial function classification model can be an initial naive Bayes classifier. Then, based on the pre-annotation, the sample function to which the target sample log belongs is obtained as the benchmark function, and then the first 20 logs and the last 20 logs of the target sample log in the recording order are obtained. Then, the logs whose recording time difference with the target log is less than 10 minutes in the above-obtained logs are determined, and then the sample reference log set is obtained. Then, the server obtains the sample class name and sample function name of each sample log in the sample reference log set.

[0082] Then, based on the sample class name, sample function name and benchmark function, the initial function classification model is trained to obtain the function classification model corresponding to the input vector length.

[0083] For example, after the server obtains the sample class name and sample function name of each sample log in the sample reference log set, a combination of the sample class name and the sample function name can be generated, and then at least one combination of the sample class name and the sample function name can be obtained. Then the server obtains all the combinations of class names and function names pre-stored internally, and generates a vector of corresponding length based on the number of all the combinations of class names and function names, and each length corresponds to a combination of a class name and a function name. If the combination of the class name and the function name is obtained from the sample log, the value of the corresponding data bit is set to the first data value. If the combination of the class name and the function name is not obtained from the target log, the value of the corresponding data bit is set to the second data value. Then, a training input vector is generated. Then, based on the training input vector and the corresponding benchmark function, the likelihood probability is calculated, and then the final naive Bayes classifier is obtained after training.

[0084] Step 202: If the content information includes a preset error characterization character, determine a reference log set corresponding to the target log.

[0085] The reference log set includes a target log and at least one log that meets a preset proximity condition with the target log.

[0086] In implementation, after obtaining the content information, such as Figure 3As shown, the server may detect whether the content information includes a preset error representation character, and the preset error representation character may be pre-stored in the server.

[0087] For example, after obtaining the content information, the server detects that the content information includes at least one word among fail, error, wrong, and warning, then obtains the content information containing at least one word among fail, error, wrong, and warning, and obtains the target log corresponding to the content information containing at least one word among fail, error, wrong, and warning based on the correspondence between the content information and the target log.

[0088] If the content information contains the preset error character after the above detection, the following processing can be performed:

[0089] The first treatment:

[0090] First, a preset number of logs before and a preset number of logs after the target log in the recording order are determined.

[0091] In implementation, the server may record the logs reported by the target application in the order in which they are received, and then, when detecting that the content information includes preset error characterization characters, first determine the first preset number of logs and the last preset number of logs in the recording order of the target log.

[0092] For example, when it is detected that the content information includes a preset error character, the first 20 logs and the last 20 logs of the target log in the recording sequence are first determined.

[0093] Secondly, among the first preset number of logs and the second preset number of logs, a log whose recording time difference with the target log is less than a preset threshold is determined.

[0094] In implementation, after determining the first preset number of logs and the last preset number of logs in the recording order of the target log, the server can obtain the timestamp corresponding to each of the first preset number of logs and the last preset number of logs, for example, the timestamp corresponding to one of the logs is 2019-11-21 19:54:22.095. And obtain the timestamp corresponding to the target log, for example, the server can obtain the timestamp 2019-11-21 19:56:22.095 in the first bracket [2019-11-2119:56:22.095] in the content information of the target log [2019-11-21 19:56:22.095][Q:main][WnspacketUtil.cpp:640][isTLvMode]:wnsflag=464. Then calculate the recording time difference between each timestamp and the timestamp of the target log, and determine the logs whose recording time difference is less than the preset threshold. For example, the preset threshold is 10 minutes, and the recording time difference of 2 minutes between the timestamp 2019-11-21 19:56:22.095 and the timestamp 2019-11-21 9:50:22.083 is less than the preset threshold of 10 minutes, then the log is confirmed.

[0095] Then, the target log and the logs whose recording time difference with the target log is less than a preset threshold are combined into a reference log set.

[0096] In implementation, after determining the logs whose recording time difference with the target log is less than the preset threshold through the above steps, the server forms a reference log set with the target log and the logs whose recording time difference with the target log is less than the preset threshold.

[0097] The second treatment:

[0098] First, a preset number of logs before the target log in the recording order are determined.

[0099] In implementation, the server may record the logs reported by the target application in the order in which they are received, and then, when detecting that the content information includes a preset error characterization character, first determine the first preset number of logs of the target log in the recording order.

[0100] For example, when it is detected that the content information includes a preset error character, the first 40 logs of the target log in the recording sequence are first determined.

[0101] Secondly, among the first preset number of logs, a log whose recording time difference with the target log is less than a preset threshold is determined.

[0102] In implementation, after determining the first preset number of logs in the recording order of the target log, the server can obtain the timestamp corresponding to each log in the first preset number of logs, for example, the timestamp corresponding to one of the logs is 2019-11-21 19:54:22.095. And obtain the timestamp corresponding to the target log, for example, the server can obtain the timestamp 2019-11-21 19:56:22.095 in the first bracket [2019-11-21 19:56:22.095] in the content information of the target log [2019-11-21 19:56:22.095][Q:main][WnspacketUtil.cpp:640][isTLvMode]:wnsflag=464. Then calculate the recording time difference between each timestamp and the timestamp of the target log, and determine the logs whose recording time difference is less than the preset threshold. For example, the preset threshold is 10 minutes, and the recording time difference of 2 minutes between the timestamp 2019-11-21 19:56:22.095 and the timestamp 2019-11-21 9:50:22.083 is less than the preset threshold of 10 minutes, then the log is confirmed.

[0103] Then, the target log and the logs whose recording time difference with the target log is less than a preset threshold are combined into a reference log set.

[0104] In implementation, after determining the logs whose recording time difference with the target log is less than the preset threshold through the above steps, the server forms a reference log set with the target log and the logs whose recording time difference with the target log is less than the preset threshold.

[0105] The third treatment:

[0106] First, a preset number of logs after the target log in the recording order is determined.

[0107] In implementation, the server may record the logs reported by the target application in the order in which they are received, and then, when detecting that the content information includes a preset error characterization character, first determine the target log that is a preset number of logs later in the recording order.

[0108] For example, when it is detected that the content information includes a preset error character, the last 40 logs of the target log in the recording sequence are first determined.

[0109] Secondly, among the latter preset number of logs, a log whose recording time difference with the target log is less than a preset threshold is determined.

[0110] In implementation, after determining the number of logs after the target log in the recording order, the server can obtain the timestamp corresponding to each log in the above-mentioned number of logs after the preset number of logs, for example, the timestamp corresponding to one of the logs is 2019-11-21 19:54:22.095. And obtain the timestamp corresponding to the target log, for example, the server can obtain the timestamp 2019-11-21 19:56:22.095 in the first bracket [2019-11-21 19:56:22.095] in the content information of the target log [2019-11-21 19:56:22.095][Q:main][WnspacketUtil.cpp:640][isTLvMode]:wnsflag=464. Then calculate the recording time difference between each timestamp and the timestamp of the target log, and determine the logs whose recording time difference is less than the preset threshold. For example, the preset threshold is 10 minutes, and the recording time difference of 2 minutes between the timestamp 2019-11-21 19:56:22.095 and the timestamp 2019-11-21 9:50:22.083 is less than the preset threshold of 10 minutes, then the log is confirmed.

[0111] Then, the target log and the logs whose recording time difference with the target log is less than a preset threshold are combined into a reference log set.

[0112] In implementation, after determining the logs whose recording time difference with the target log is less than the preset threshold through the above steps, the server forms a reference log set with the target log and the logs whose recording time difference with the target log is less than the preset threshold.

[0113] Step 203: Obtain the target class name and target function name of each log in the reference log set.

[0114] For example, the server can obtain the target class name WnspacketUtil.cpp and the target function name isTLvMode in the third bracket [WnspacketUtil.cpp:640] in [2019-11-21 19:56:22.095][Q:main][WnspacketUtil.cpp:640][isTLvMode]:wnsflag=464 and the fourth bracket [isTLvMode].

[0115] Step 204: Determine the target function to which the target log belongs based on the target class name, the target function name and the function classification model.

[0116] In implementation, after obtaining the target class name and target function name, the server can perform the following processing in sequence:

[0117] First, a target input vector is generated based on the target class name and the target function name.

[0118] Among them, each data bit of the target input vector corresponds to a combination of a class name and a function name, and the data bit corresponds to two data values, the two data values ​​include a first data value and a second data value. In the target input vector, the data value of the data bit corresponding to the combination of the target class name and the target function name is the first data value, and the data value of the data bit corresponding to other combinations other than the combination of the target class name and the target function name is the second value.

[0119] In implementation, the server obtains a combination of a class name and a function name from each target log, and then obtains at least one combination of a class name and a function name. Then the server obtains all the combinations of class names and function names pre-stored internally, and generates a vector of corresponding length based on the number of all the combinations of class names and function names, and each length corresponds to a combination of a class name and a function name. If the combination of class name and function name is obtained from the target log, the value of the corresponding data bit is set to the first data value. If the combination of class name and function name is not obtained from the target log, the value of the corresponding data bit is set to the second data value. Then, the target input vector is generated.

[0120] Then, based on the target input vector and the function classification model, the target function to which the target log belongs is determined.

[0121] In implementation, after the server obtains the target input vector, the server can input the target input vector into a function classification model, which can be a naive Bayes classifier. After inputting the target input vector into the function classification model, the server can obtain the probability corresponding to each function, and then the server determines the function with the highest probability as the target function to which the target log belongs.

[0122] Step 205: Generate an error report corresponding to the target function.

[0123] In implementation, Figure 3 As shown, after the server determines the function with the highest probability as the target function to which the target log belongs, the server can generate an error report corresponding to the target function, and then the server stores the generated error report for the developer to view by himself. After generating the error report, the server can also generate an error notification based on the error report and send it to a preset terminal to remind the developer that there is an error in the target function.

[0124] The present application detects whether there are preset error characterization characters in the content information of the target log. If there are preset error characterization characters, the target class name and target function name in the content information are obtained and input into the function classification model to determine the target function to which the target log belongs, and then an error report corresponding to the target function is generated. It can be seen that the above method can detect the function in the application program where an error occurs, and there is no need to insert additional error detection code into the application program, so the overall data volume of the application program can be controlled not to increase, thereby saving the storage space of the terminal. All the above optional technical solutions can be arbitrarily combined to form optional embodiments of the present disclosure, which will not be described one by one here.

[0125] Figure 4 is a schematic diagram of a device for function error detection provided in an embodiment of the present application, and the device may be the server in the above embodiment. Figure 4 , the device comprises:

[0126] An acquisition module 410 is used to acquire content information of a target log of a target application;

[0127] A determination module 420 is configured to determine a reference log set corresponding to the target log if the content information includes a preset error characterization character, wherein the reference log set includes the target log and at least one log that satisfies a preset proximity condition with the target log;

[0128] The acquisition module 410 is further used to obtain the target class name and target function name of each log in the reference log set;

[0129] The determination module 420 is further used to determine the target function to which the target log belongs based on the target class name, the target function name and the function classification model;

[0130] The generating module 430 is used to generate an error report corresponding to the target function.

[0131] Optionally, the determining module 420 is used to:

[0132] Generate a target input vector based on the target class name and the target function name, wherein each data bit of the target input vector corresponds to a combination of a class name and a function name, the data bit corresponds to two data values, the two data values ​​include a first data value and a second data value, in the target input vector, the data value of the data bit corresponding to the combination of the target class name and the target function name is the first data value, and the data value of the data bit corresponding to other combinations other than the combination of the target class name and the target function name is the second value;

[0133] Based on the target input vector and the function classification model, a target function to which the target log belongs is determined.

[0134] Optionally, the acquisition module 410 is further configured to:

[0135] During the program code compilation process of the target application, obtaining all combinations of class names and function names included in the program code;

[0136] Determine the number of all combinations of class names and function names included in the program code as the input vector length;

[0137] Obtain a functional classification model corresponding to the input vector length.

[0138] Optionally, the acquisition module 410 is used to:

[0139] Obtaining an initial functional classification model corresponding to the input vector length;

[0140] Acquire a sample function to which the target sample log belongs as a benchmark function;

[0141] Determine a sample reference log set corresponding to the target sample log, wherein the sample reference log set includes the target sample log and at least one sample log that meets a preset proximity condition with the target sample log;

[0142] Obtaining a sample class name and a sample function name of each sample log in the sample reference log set;

[0143] Based on the sample class name, the sample function name and the benchmark function, the initial function classification model is trained to obtain a function classification model corresponding to the input vector length.

[0144] Optionally, the determining module 420 is used to:

[0145] Determine a preset number of logs before and / or a preset number of logs after the target log in the recording sequence;

[0146] Determine, among the first preset number of logs and / or the second preset number of logs, a log whose recording time difference with the target log is less than a preset threshold;

[0147] The target log and the logs whose recording time difference with the target log is less than a preset threshold are combined into a reference log set.

[0148] The present application detects whether there are preset error characterization characters in the content information of the target log. If there are preset error characterization characters, the target class name and target function name in the content information are obtained and input into the function classification model to determine the target function to which the target log belongs, and then an error report corresponding to the target function is generated. It can be seen that the above method detects the function in the application program where the error occurs, and there is no need to insert additional error detection code in the application program, so that the overall data volume of the application program can be controlled not to increase, thereby saving the storage space of the terminal. It should be noted that: when detecting the function error, the device for function error detection provided in the above embodiment is only illustrated by the division of the above functional modules. In actual application, the above function allocation can be completed by different functional modules as needed, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the method embodiment of function error detection provided in the above embodiment belongs to the same concept, and its specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0149] Figure 5 : is a schematic diagram of the structure of a server provided in an embodiment of the present application. The server 500 may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 501 and one or more memories 502, wherein the memory 502 stores at least one instruction, and the at least one instruction is loaded and executed by the processor 501 to implement the methods provided in the above-mentioned various method embodiments. Of course, the server may also have components such as a wired or wireless network interface, a keyboard, and an input and output interface for input and output, and the server may also include other components for implementing device functions, which will not be described in detail here.

[0150] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including instructions, and the instructions can be executed by a processor in a terminal to complete the method of functional error detection in the above embodiment. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0151] A person skilled in the art will understand that all or part of the steps to implement the above embodiments may be accomplished by hardware or by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a disk or an optical disk, etc.

[0152] The above description is only an optional embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for functional error detection, characterized in that: The method comprises: Get the content information of the target log of the target application; If the content information includes a preset error characterization character, determining a reference log set corresponding to the target log, wherein the reference log set includes the target log and at least one log that meets a preset proximity condition with the target log; Obtaining a combination of a target class name and a target function name from each of the target logs to obtain at least one combination of a target class name and a target function name; Obtain all pre-stored combinations of class names and function names, and generate a vector of corresponding length based on the number of all the combinations of class names and function names, and each data bit of the vector corresponds to a combination of a class name and a function name; In response to the combination of the class name and the function name appearing in the combination of the at least one target class name and the target function name, setting the data bit of the combination of the class name and the function name to a first data value; in response to the combination of the class name and the function name not appearing in the combination of the at least one target class name and the target function name, setting the data bit of the combination of the class name and the function name to a second data value; Generate a target input vector based on all the combinations of class names and function names and the data bits corresponding to the combinations of all the class names and function names; Inputting the target input vector into a function classification model to determine the target function to which the target log belongs; An error report corresponding to the target function is generated.

2. The method according to claim 1, characterized in that Before obtaining the content information of the target log of the target application, the method further includes: During the program code compilation process of the target application, obtaining all combinations of class names and function names included in the program code; Determine the number of all combinations of class names and function names included in the program code as the input vector length; Obtain a functional classification model corresponding to the input vector length.

3. The method according to claim 2, characterized in that The obtaining of the function classification model corresponding to the input vector length includes: Obtaining an initial functional classification model corresponding to the input vector length; Obtain the sample function to which the target sample log belongs as the benchmark function; Determine a sample reference log set corresponding to the target sample log, wherein the sample reference log set includes the target sample log and at least one sample log that meets a preset proximity condition with the target sample log; Obtaining a sample class name and a sample function name of each sample log in the sample reference log set, and generating a combination of the sample class name and the sample function name of each sample log, to obtain at least one combination of the sample class name and the sample function name; Obtaining all the combinations of class names and function names, and generating a vector of corresponding length based on the number of all the combinations of class names and function names, wherein each data bit of the vector corresponds to a combination of a class name and a function name; In response to the combination of the class name and the function name appearing in the combination of the at least one sample class name and the sample function name, setting the data bit of the combination of the class name and the function name to a first data value; in response to the combination of the class name and the function name not appearing in the combination of the at least one sample class name and the sample function name, setting the data bit of the combination of the class name and the function name to a second data value; Generate a training input vector based on all the combinations of class names and function names and the data bits corresponding to the combinations of all the class names and function names; Based on the training input vector and the benchmark function, the initial function classification model is trained to obtain a function classification model corresponding to the input vector length.

4. The method according to claim 1, characterized in that: The determining a reference log set corresponding to the target log includes: Determine a preset number of logs before and / or a preset number of logs after the target log in the recording sequence; Determine, among the first preset number of logs and / or the second preset number of logs, a log whose recording time difference with the target log is less than a preset threshold; The target log and the logs whose recording time difference with the target log is less than a preset threshold are combined into a reference log set.

5. A device for detecting functional errors, characterized in that: The device comprises: An acquisition module, used to acquire content information of a target log of a target application; A determination module, configured to determine a reference log set corresponding to the target log if the content information includes a preset error characterization character, wherein the reference log set includes the target log and at least one log that satisfies a preset proximity condition with the target log; The acquisition module is further used to acquire a combination of a target class name and a target function name from each of the target logs to obtain at least one combination of a target class name and a target function name; acquire all pre-stored combinations of class names and function names, and generate a vector of corresponding length based on the number of all the combinations of class names and function names, and the data bits of each vector correspond to a combination of a class name and a function name; in response to the combination of the class name and the function name appearing in the combination of the at least one target class name and the target function name, set the data bits of the combination of the class name and the function name to a first data value; in response to the combination of the class name and the function name not appearing in the combination of the at least one target class name and the target function name, set the data bits of the combination of the class name and the function name to a second data value; based on all the combinations of the class name and the function name, and the data bits corresponding to the combinations of all the class name and the function name, generate a target input vector; The determination module is further used to input the target input vector into a function classification model to determine the target function to which the target log belongs; A generating module is used to generate an error report corresponding to the target function.

6. The device according to claim 5, characterized in that The acquisition module is further used for: During the program code compilation process of the target application, obtaining all combinations of class names and function names included in the program code; Determine the number of all combinations of class names and function names included in the program code as the input vector length; Obtain a functional classification model corresponding to the input vector length.

7. The device according to claim 6, characterized in that The acquisition module is used to: Obtaining an initial functional classification model corresponding to the input vector length; Obtain the sample function to which the target sample log belongs as the benchmark function; Determine a sample reference log set corresponding to the target sample log, wherein the sample reference log set includes the target sample log and at least one sample log that meets a preset proximity condition with the target sample log; Obtaining a sample class name and a sample function name of each sample log in the sample reference log set, and generating a combination of the sample class name and the sample function name of each sample log, to obtain at least one combination of the sample class name and the sample function name; Obtaining all the combinations of class names and function names, and generating a vector of corresponding length based on the number of all the combinations of class names and function names, wherein each data bit of the vector corresponds to a combination of a class name and a function name; In response to the combination of the class name and the function name appearing in the combination of the at least one sample class name and the sample function name, setting the data bit of the combination of the class name and the function name to a first data value; in response to the combination of the class name and the function name not appearing in the combination of the at least one sample class name and the sample function name, setting the data bit of the combination of the class name and the function name to a second data value; Generate a training input vector based on all the combinations of class names and function names and the data bits corresponding to the combinations of all the class names and function names; Based on the training input vector and the benchmark function, the initial function classification model is trained to obtain a function classification model corresponding to the input vector length.

8. The device according to claim 5, characterized in that The determining module is used to: Determine a preset number of logs before and / or a preset number of logs after the target log in the recording sequence; Determine, among the first preset number of logs and / or the second preset number of logs, a log whose recording time difference with the target log is less than a preset threshold; The target log and the logs whose recording time difference with the target log is less than a preset threshold are combined into a reference log set.

9. A computer device, characterized in that: The computer device includes a processor and a memory, wherein the memory stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the operation performed by the method for functional error detection according to any one of claims 1 to 4.

10. A computer-readable storage medium, characterized in that: The storage medium stores at least one instruction, and the at least one instruction is loaded and executed by the processor to implement the operation performed by the method for functional error detection according to any one of claims 1 to 4.

Citation Information

Patent Citations

  • Test method and apparatus

    CN105005521A

  • Automatic error processing method and device

    CN105893225A