A log generation method and related device
By identifying and analyzing the initial text of the target program and generating detailed log text, the problem of excessive log output flooding important information is solved, and development and maintenance efficiency and system stability are improved.
Patent Information
- Application Number
- CN202411219555.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-02
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-09-02
AI Technical Summary
In the prior art, excessive log output will overwhelm the really important information, making locating and debugging problems in the log difficult and time-consuming, and reducing the efficiency of system debugging with the help of logs.
By identifying and analyzing the initial text of the target program, filtering out important information, generating target text, and determining the target relationship and process information based on the program information, matching the annotation information to identify the target function, verify its input and output, and generating detailed log text so as to for debugging.
It significantly improves the efficiency of development and maintenance, and rapid fault location shortens program failure time, helps developers quickly find the root cause, avoid duplicate problems, and improves system stability and reliability.
Smart Images

Figure CN118760568B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a log generation method and related devices. Background Art
[0002] Logs are commonly used debugging tools in development and operation and maintenance. They can record various states and events of system operation to help developers quickly locate and solve problems. However, as the complexity of applications and systems increases, developers need to add some log printing statements during the application and system development process, which will print a large number of logs, which may increase storage costs. Excessive log output will drown out the really important information, making it more difficult and time-consuming to locate and debug problems in logs. Developers may miss key debugging clues due to information overload, which reduces the efficiency of system debugging with the help of logs. When the log file is too large or the information is disorganized, developers and operation and maintenance personnel may find it difficult to quickly find useful information from it, which affects the speed of locating and solving problems. Summary of the invention
[0003] The main purpose of the embodiments of the present invention is to provide a log generation method and related devices, aiming to solve the problem in the related art that excessive log output will drown out the truly important information, making it more difficult and time-consuming to locate and debug problems in the log, which in turn may cause developers to miss key debugging clues due to information overload, thereby reducing the efficiency of system debugging with the help of logs.
[0004] In a first aspect, an embodiment of the present invention provides a log generation method, comprising:
[0005] Obtaining an initial text corresponding to a target program, and performing importance recognition on the initial text to obtain a target text corresponding to the target program;
[0006] Performing information recognition on the target text to obtain program information corresponding to the target program in the target text;
[0007] Determining a target relationship corresponding to the target text according to the program information;
[0008] Determine the process information corresponding to the target program according to the program information and the target relationship;
[0009] Obtaining annotation information corresponding to the target program, and matching the annotation information with process information to obtain a target function corresponding to any sub-process in the process information;
[0010] Determine a target input corresponding to the target function and an expected output corresponding to the target input, and obtain a real output corresponding to the target input in the target function;
[0011] Determine a test result corresponding to the objective function according to the expected output and the actual output;
[0012] The log text corresponding to the target program is determined according to the target function, the expected output, the actual output and the test result.
[0013] In some optional embodiments, the step of performing importance identification on the initial text to obtain a target text corresponding to the target program includes:
[0014] Extracting information from the initial text to obtain a target function corresponding to the target program and a functional relationship between any two of the target functions;
[0015] Obtain any sentence information from the initial text, and delete the sentence information from the initial text to obtain a deleted intermediate text;
[0016] Calculate the first relationship probability corresponding to the functional relationship between any two of the target functions in the initial text, and calculate the second relationship probability corresponding to the functional relationship between any two of the target functions in the intermediate text;
[0017] Determine the importance score corresponding to the sentence information according to the first relationship probability and the second relationship probability;
[0018] Deleting the sentence information in the initial text according to the importance score to obtain the target text corresponding to the target program;
[0019] The importance score is obtained according to the following formula:
[0020] ;
[0021] in, Indicates that the functional relationship between the i-th target function and the j-th target function is in the intermediate text after deleting the sentence information m. The corresponding probability of the second relationship is as follows; The first relationship probability representing the functional relationship between the i-th target function and the j-th target function corresponding to the initial text; The importance score corresponding to the functional relationship between the i-th target function and the j-th target function in the sentence information m.
[0022] In some optional embodiments, deleting the sentence information in the initial text according to the importance score to obtain the target text corresponding to the target program includes:
[0023] Determine, from the sentence information, a set of irrelevant sentences corresponding to any one of the functional relationships according to the importance scores;
[0024] Performing repeated statement calculation on all the irrelevant statement sets to obtain repeated statement sets corresponding to the irrelevant statement sets;
[0025] Any repeated text in the repeated statement set is deleted from the initial text to obtain the target text corresponding to the target program.
[0026] In some optional embodiments, the program information includes a function text, a function element, a function position, and context information corresponding to the function text, and determining the target relationship corresponding to the target text according to the program information includes:
[0027] Using the feature embedding layer of the relationship recognition model, the function text is represented by text to obtain a corresponding first information representation, the function position is represented by position embedding to obtain a corresponding second information representation, the function element is represented by function information embedding to obtain a corresponding third information representation, and the context information is represented by text to obtain a corresponding fourth information representation;
[0028] Using the feature fusion layer of the relationship recognition model, the first information representation, the second information representation, the third information representation and the fourth information representation are fused to obtain an initial information representation;
[0029] Using the feature extraction layer of the relationship recognition model to perform effective feature extraction on the initial information representation to obtain the target information representation;
[0030] The target information representation is subjected to relationship classification using the relationship classification layer of the relationship recognition model to obtain the target relationship corresponding to the target texts.
[0031] In some optional embodiments, obtaining annotation information corresponding to the target program, and matching the annotation information with process information to obtain a target function corresponding to any sub-process in the process information includes:
[0032] Obtaining a first batch of annotation content corresponding to any sub-function in the target program from the annotation information, and obtaining a first associated content corresponding to any sub-process in the process information from the target text;
[0033] Calculating a first similarity between the first batch of annotation contents and the first associated contents, and selecting a related function corresponding to the sub-process from the sub-functions according to the first similarity;
[0034] Obtaining a first calling function and a second calling function corresponding to the related function from a calling sequence of the target program, wherein the first calling function is used to represent a function that calls the related function, and the second calling function is used to represent a function that calls other functions of the related function;
[0035] Obtaining second annotation content corresponding to the first calling function from the annotation information, and obtaining third annotation content corresponding to the second calling function from the annotation information;
[0036] Obtaining the upper process and the lower process connected to the sub-process from the process information, and obtaining the second associated content corresponding to the upper process from the target text and obtaining the third associated content corresponding to the lower process from the target text;
[0037] Calculating a second similarity between the second annotation content and the second associated content, and calculating a third similarity between the third annotation content and the third associated content;
[0038] The target function corresponding to the sub-process is determined from the correlation function according to the second similarity degree and the third similarity degree.
[0039] In some optional embodiments, determining the log text corresponding to the target program according to the target function, the expected output, the actual output and the test result includes:
[0040] Obtaining first description information corresponding to the target function from the target text and obtaining second description information corresponding to the target function from the annotation information;
[0041] Extract key information according to the first description information and the second description information to obtain target description information corresponding to the target function;
[0042] The expected output, the actual output and the test result are used to perform text constraints on the target description information to generate the log text corresponding to the target function.
[0043] In some optional embodiments, the step of using the expected output, the actual output, and the test result to perform text constraints on the target description information to generate the log text corresponding to the target function includes:
[0044] Determine a description framework corresponding to the objective function according to the objective description information, and fill the expected output, the actual output and the test result into the description framework to obtain the test description information corresponding to the objective function;
[0045] Determine a connection relationship between the test description information and the target description information according to the test result;
[0046] The test description information and the target description information are fused according to the connection relationship to obtain the log text corresponding to the target function.
[0047] In some optional embodiments, after determining the test result corresponding to the objective function according to the expected output and the actual output, the method further includes:
[0048] When the test result is that the test fails, the operation data corresponding to the objective function is obtained;
[0049] Analyzing the operation data using a static analysis tool and a dynamic analysis tool to obtain an initial abnormal region corresponding to the objective function;
[0050] Using an artificial intelligence model to score the code complexity of the initial abnormal area, and obtaining a risk identifier corresponding to the initial abnormal area;
[0051] The initial abnormal area is checked step by step using an automated debugging tool according to the risk identification to obtain a target abnormal area corresponding to the objective function, and the target abnormal area is used for subsequent abnormal problem solving of the objective function.
[0052] In a second aspect, an embodiment of the present invention further provides a terminal device, comprising a processor, a memory, a computer program stored in the memory and executable by the processor, and a data bus for realizing connection and communication between the processor and the memory, wherein when the computer program is executed by the processor, the steps of any log generation method provided in the specification of the present invention are implemented.
[0053] In a third aspect, an embodiment of the present invention further provides a storage medium for computer-readable storage, characterized in that the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any log generation method provided in the specification of the present invention.
[0054] The embodiment of the present invention provides a log generation method and a related device, which includes: by identifying and analyzing the important information corresponding to the initial text of the target program, the structure and function of the program can be better understood, thereby screening the initial text to obtain the target text corresponding to the target program, then obtaining the program information corresponding to the target program in the target text by information identification of the target text, and then determining the target relationship corresponding to the target text according to the program information; thereby determining the process information corresponding to the target program according to the program information and the target relationship, and then combing the execution logic and data flow of the target program according to the process information. This is very important for subsequent testing and debugging. Then, according to the corresponding annotation information in the target program, the target function corresponding to any sub-process in the process information is determined, and then by determining the target input and expected output of the target function, and testing by using the target input through the target function, it can be verified whether the program works as expected to obtain the real output, and then comparing the expected output and the real output can help determine the test result corresponding to the target function, and finally by recording the test result, expected output, real output and target function of the target function to generate a detailed log text, and then after obtaining the log text, the developer can quickly locate the problem in the program by analyzing the log text, so as to effectively debug and repair. This method not only significantly improves the efficiency of development and maintenance, but also shortens the time of program failures by quickly locating faults. In addition, log text can help developers find the root cause faster when encountering problems, thereby avoiding the same problems from happening again and further improving the stability and reliability of the system. This method also solves the problem in related technologies that excessive log output will drown out truly important information. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] In order to more clearly illustrate the technical solutions of 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 some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0056] Figure 1 A flow chart of a log generation method provided by an embodiment of the present invention;
[0057] Figure 2 A schematic block diagram of the structure of a terminal device provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0058] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0059] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.
[0060] It should be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.
[0061] The embodiment of the present invention provides a log generation method and related devices. The log generation method can be applied to a terminal device, which can be an electronic device such as a tablet computer, a laptop computer, a desktop computer, a personal digital assistant, and a wearable device. The terminal device can be a server or a server cluster.
[0062] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0063] Please refer to Figure 1 , Figure 1 A flow chart of a log generation method provided by an embodiment of the present invention.
[0064] like Figure 1 As shown, the log generation method includes steps S101 to S108.
[0065] Step S101: obtaining an initial text corresponding to a target program, and performing importance recognition on the initial text to obtain a target text corresponding to the target program.
[0066] For example, the initial text is a product document planned by a product manager or product designer to facilitate developers to develop products according to the initial text, so that developers can develop products according to the initial text to obtain the corresponding target program. That is, the initial text is the corresponding requirement document when the target program is developed.
[0067] For example, the initial text contains relevant description texts of the functional modules, core algorithms, data structures, and input-output relationships that developers need to develop, as well as other description texts of the user groups that the product project needs to serve. In order to improve the accuracy of subsequent target function search, it is necessary to delete the statements in the initial text that are not related to the functional description in the target program to obtain the target text.
[0068] For example, define what information is essential for understanding and analyzing the target program. This may include the main functional modules, core algorithms, data structures, input-output relationships, etc. of the program, and then determine the above content as important information and the non-above content as unimportant information, and then obtain the target text corresponding to the target program.
[0069] In some embodiments, the importance identification of the initial text to obtain the target text corresponding to the target program includes: extracting information from the initial text to obtain the target function corresponding to the target program and the functional relationship between any two of the target functions; obtaining any sentence information from the initial text, and deleting the sentence information from the initial text to obtain an intermediate text after deletion; calculating the first relationship probability corresponding to the functional relationship between any two of the target functions in the initial text, and calculating the second relationship probability corresponding to the functional relationship between any two of the target functions in the intermediate text; determining the importance score corresponding to the sentence information according to the first relationship probability and the second relationship probability; deleting the sentence information in the initial text according to the importance score to obtain the target text corresponding to the target program; wherein the importance score is obtained according to the following formula:
[0070] ;
[0071] in, Indicates that the functional relationship between the i-th target function and the j-th target function is in the intermediate text after deleting the sentence information m. The corresponding probability of the second relationship is as follows; The first relationship probability representing the functional relationship between the i-th target function and the j-th target function corresponding to the initial text; The importance score corresponding to the functional relationship between the i-th target function and the j-th target function in the sentence information m.
[0072] Exemplarily, a functional description of the target program corresponding to the initial text is performed through methods such as keyword extraction, named entity recognition or pattern matching, and then the information of the functional description is summarized to obtain the summarized target function. Then, syntactic analysis, semantic role labeling and other techniques are used to identify the conjunctions and verbs between the functions to analyze the interactions and dependencies between the target functions described in the initial text, thereby obtaining the functional relationship between any two target functions.
[0073] Exemplarily, a sentence information is randomly or sequentially selected from the initial text as a processing object, and then the sentence information is deleted from the initial text so that the information after deleting the sentence information is determined as the corresponding intermediate text. In the initial text, a conditional probability model (such as naive Bayes) or other probability graph model is used to calculate the first relationship probability of the functional relationship between any two target functions, and a conditional probability model (such as naive Bayes) or other probability graph model is used in the intermediate text (i.e., the initial text after deleting a certain sentence information) to recalculate the second relationship probability of the functional relationship between any two target functions.
[0074] Exemplarily, the importance score corresponding to the sentence information in the process of determining the functional relationship is determined according to the change between the first relationship probability and the second relationship probability, and the difference between the first relationship probability and the second relationship probability is compared. The greater the difference, the greater the impact of the deleted sentence information on the functional relationship, and the greater the importance score, which reflects the importance of the sentence information in maintaining the stability of the functional relationship. The importance score can be obtained according to the following formula:
[0075] ;
[0076] in, Indicates the functional relationship between the i-th target function and the j-th target function in the middle text after deleting the sentence information m The corresponding second relationship probability is: Represents the first relationship probability corresponding to the functional relationship between the i-th target function and the j-th target function under the initial text; Represents the importance score of the functional relationship between the i-th target function and the j-th target function in the sentence information m.
[0077] For example, a target threshold of importance score is set according to the requirements. Only the sentence information below this target threshold will be considered for deletion, and then the importance score calculation corresponding to each sentence information is repeatedly performed until the expected text simplification degree is reached or the importance scores of all sentences are higher than the target threshold. After the above iterative process, the remaining text is the simplified target text, which retains the most critical information in the initial text for describing the functions and relationships of the target program.
[0078] Specifically, information is extracted from the initial text to obtain the target functions and functional relationships of the target program, and any sentence information is deleted and the relationship probability is calculated to determine the importance score of the sentence information. The sentence information in the initial text is deleted to obtain the target text. This can provide good support for the subsequent rapid and accurate acquisition of the target function corresponding to the sub-process, and thus provide a good information basis for the subsequent generation of accurate log information.
[0079] In some embodiments, the method of deleting the sentence information in the initial text according to the importance score to obtain the target text corresponding to the target program includes: determining an irrelevant statement set corresponding to any one of the functional relationships from the sentence information according to the importance score; performing repeated statement calculations on all of the irrelevant statement sets to obtain a repeated statement set corresponding to the irrelevant statement set; and deleting any repeated text in the repeated statement set from the initial text to obtain the target text corresponding to the target program.
[0080] For example, when determining whether a statement information has an impact on a functional relationship, directly deleting the statement information may affect the judgment of another functional relationship by the statement information. Therefore, it is avoided to directly delete the statement information after judging by the target threshold.
[0081] Exemplarily, a target threshold is set based on expert experience or actual needs, and when the importance score is lower than the target threshold, the sentence information corresponding to the importance score is determined as an irrelevant statement corresponding to the functional relationship, and all irrelevant statements are combined into an irrelevant statement set corresponding to the functional relationship.
[0082] Exemplarily, the above steps are repeated for all functional relationships to obtain irrelevant statement sets corresponding to each functional relationship, and then all irrelevant statement sets are subjected to set intersection calculation to obtain irrelevant statements contained in each irrelevant statement set, that is, to obtain repeated texts, and then generate corresponding repeated statement sets based on the repeated texts.
[0083] Exemplarily, any repeated text in the repeated statement set is deleted from the initial text to obtain the target text corresponding to the target program.
[0084] Specifically, by identifying the irrelevant sentence sets corresponding to different functional relationships, and then performing repeated sentence calculations on the irrelevant sentence sets to obtain repeated sentence sets, the impact of deleting irrelevant sentences between different functional relationships on another functional relationship is avoided, thereby ensuring the completeness of the description of the target text corresponding to each functional relationship and improving the accuracy of the target text.
[0085] Step S102: Perform information recognition on the target text to obtain program information corresponding to the target program in the target text.
[0086] Exemplarily, program information includes but is not limited to input information, output information, program function, program structure, etc., and the target text is identified using named entity recognition or keyword extraction techniques to obtain the program information corresponding to the target program in the target text.
[0087] Step S103: determining the target relationship corresponding to the target text according to the program information.
[0088] Exemplarily, using the input information, output information, program function, program structure and other information included in different program information, the target text is relationally classified to obtain the target relationship between the target texts containing program information. The target relationship can be a parallel relationship, a subordinate relationship, a progressive relationship, etc.
[0089] In some embodiments, the program information includes function text, function elements, function positions, and context information corresponding to the function text, and determining the target relationship corresponding to the target text according to the program information includes: using the feature embedding layer of the relationship recognition model to perform text representation on the function text to obtain a corresponding first information representation, performing position embedding representation on the function position to obtain a corresponding second information representation, performing function information embedding representation on the function element to obtain a corresponding third information representation, and performing text representation on the context information to obtain a corresponding fourth information representation; using the feature fusion layer of the relationship recognition model to perform information fusion on the first information representation, the second information representation, the third information representation, and the fourth information representation to obtain an initial information representation; using the feature extraction layer of the relationship recognition model to perform effective feature extraction on the initial information representation to obtain a target information representation; and using the relationship classification layer of the relationship recognition model to perform relationship classification on the target information representation to obtain the target relationship corresponding to the target texts.
[0090] Exemplarily, program information includes function text, function elements, function location, and context information corresponding to the function text. Function text is text information used to describe program functions, context information is the text before and after the function text, and function elements are key components and operation steps involved in realizing its functions. These elements usually include: input data, processing logic, output results, intermediate steps, etc. Function location is the location information of the function element in the function text.
[0091] Exemplarily, the relationship recognition model includes a feature embedding layer, a feature fusion layer, a feature extraction layer, and a relationship classification layer.
[0092] Exemplarily, the feature embedding layer of the relationship recognition model, such as BERT, GPT, RoBERTa and other pre-trained language models, is used to tokenize the functional text to obtain the first information representation, and the position encoding of each functional element is defined in the functional text. The position encoding can be discrete (e.g., position ID) or continuous (e.g., position encoding generated by sine and cosine functions), and then the position ID is mapped to an embedding space, and an embedding vector for each position is generated to obtain the second information representation, and then each functional element is mapped to an embedding space, usually using a lookup table or embedding layer. Each functional element is assigned a high-dimensional vector representation to obtain a third information representation. Finally, the context information is tokenized and input into the same or similar text representation model (such as BERT) to obtain an embedded representation of the context, and obtain a fourth information representation.
[0093] Exemplarily, the feature fusion layer of the relationship recognition model is used to perform weighted fusion on the first information representation, the second information representation, the third information representation and the fourth information representation to obtain an initial information representation; and then the feature extraction layer of the relationship recognition model is used to perform effective feature extraction on the initial information representation to obtain a target information representation.
[0094] Exemplarily, a relationship classification layer is designed at the last layer of the relationship recognition model, and the relationship classification layer will classify the relationship between the target information representations, thereby obtaining the corresponding target relationship between the target texts. The relationship classification layer can be designed as a Softmax layer, a multi-layer perceptron classification layer, etc. The specific setting of the relationship classification layer can be selected according to actual needs, and this application does not make specific restrictions.
[0095] Step S104: Determine the process information corresponding to the target program according to the program information and the target relationship.
[0096] Exemplarily, target relationships include but are not limited to call relationships: the relationship in which one method calls another method, dependency relationships: the dependency relationship between modules or classes, and data flow relationships: the flow of data in a program, including variable assignment and use.
[0097] Exemplarily, the process is constructed using the program information and the target relationship between the program information, so that the program information is connected according to the target relationship to obtain the process information corresponding to the target program.
[0098] Step S105: Obtain annotation information corresponding to the target program, and match the annotation information with the process information to obtain a target function corresponding to any sub-process in the process information.
[0099] Exemplarily, the annotation information is comments at the program function or program module level, and the process information is a program structure obtained by constructing a call graph or a dependency tree based on the program information and the target relationship.
[0100] Exemplarily, a program file corresponding to the target program is obtained, and then annotation information is extracted from the program file to obtain annotation information corresponding to the target program.
[0101] Exemplarily, a string matching technique (such as a regular expression search or a text similarity measurement algorithm) is used to find the function or module in the process information that is most relevant to the annotation information, so that when the sub-process best matches the annotation information, the function corresponding to the annotation information is determined as the target function corresponding to the sub-process.
[0102] In some embodiments, the step of obtaining annotation information corresponding to the target program and matching the annotation information with the process information to obtain a target function corresponding to any sub-process in the process information includes: obtaining a first batch of annotation contents corresponding to any sub-function in the target program from the annotation information, and obtaining a first associated content corresponding to any sub-process in the process information from the target text; calculating a first degree of similarity between the first batch of annotation contents and the first associated content, and filtering out related functions corresponding to the sub-process from the sub-functions according to the first degree of similarity; obtaining a first calling function and a second calling function corresponding to the related function from the calling sequence of the target program, wherein the first calling function is used to represent a function that calls the related function. , the second calling function is used to characterize the function of the related function calling other functions; obtain the second annotation content corresponding to the first calling function from the annotation information, and obtain the third annotation content corresponding to the second calling function from the annotation information; obtain the upper process and the lower process connected by the sub-process from the process information, and obtain the second associated content corresponding to the upper process from the target text and obtain the third associated content corresponding to the lower process from the target text; calculate the second similarity between the second annotation content and the second associated content and calculate the third similarity between the third annotation content and the third associated content; determine the target function corresponding to the sub-process from the related function according to the second similarity and the third similarity.
[0103] Exemplarily, it is ensured that the annotation information has been organized and stored according to the sub-functions. For example, the annotation information can be stored in a database, a file or a data structure, and each sub-function corresponds to a set of annotations. Thus, the first batch of annotation content corresponding to the sub-function can be found from the database by the name, index or other identifier of the sub-function.
[0104] Exemplarily, the title, keyword or structure information corresponding to the sub-process is obtained, and then the first associated content related to the selected sub-process is found in the target text according to the title, keyword or structure information corresponding to the sub-process. The first associated content can be specific information, data or other related details describing the sub-process.
[0105] Exemplarily, an appropriate text similarity algorithm (such as cosine similarity, Jaccard similarity or TF-IDF weighting) is used to calculate the first similarity between the first batch of annotation content and the first associated content, and the first similarity is compared with a preset value. When the first similarity is greater than or equal to the preset value, the sub-function is determined as the relevant function corresponding to the sub-process; when the first similarity is less than the preset value, the sub-function cannot be determined as the relevant function corresponding to the sub-process.
[0106] Exemplarily, a first calling function and a second calling function corresponding to the relevant function are obtained from the calling order of the target function in the target program, wherein the first calling function is used to characterize the function that calls the relevant function, and the second calling function is used to characterize the function that calls other functions of the relevant function, that is, the first calling function is the upper-level function of the relevant function, and the second calling function is the lower-level function of the relevant function.
[0107] Exemplarily, the second annotation content corresponding to the first calling function is obtained from the annotation information, and the third annotation content corresponding to the second calling function is obtained from the annotation information. The upper process and the lower process connected to the sub-process are obtained from the process information, the upper process is used to represent the sub-process corresponding to the upper position of the sub-process in the process information, and the lower process is used to represent the sub-process corresponding to the lower position of the sub-process in the process information.
[0108] Exemplarily, the second associated content corresponding to the upper process is obtained from the target text, and the third associated content corresponding to the lower process is obtained from the target text, and then the second similarity corresponding to the second annotation content and the second associated content is calculated using an appropriate text similarity algorithm (such as cosine similarity, Jaccard similarity or TF-IDF weighting), and the third similarity corresponding to the third annotation content and the third associated content is calculated using an appropriate text similarity algorithm (such as cosine similarity, Jaccard similarity or TF-IDF weighting).
[0109] Exemplarily, when the second degree of similarity is greater than or equal to a preset value, and the third degree of similarity is greater than or equal to a preset value, the related function is determined as the target function corresponding to the sub-process; when the second degree of similarity is less than the preset value, or the third degree of similarity is less than the preset value, the related function cannot be determined as the target function corresponding to the sub-process.
[0110] Specifically, by combining annotation information with process information, it is possible to more accurately identify and understand sub-functions and their locations in the program, and then obtain the related functions corresponding to the sub-functions, and connect the annotation information of the related functions with the related content in their process information to realize the identification of the target function. In this step, the upper and lower process information is used to perform information constraints when acquiring the target function, thereby effectively improving the accuracy of target function identification.
[0111] Step S106: determine the target input corresponding to the target function and the expected output corresponding to the target input, and obtain the actual output corresponding to the target input in the target function.
[0112] Exemplarily, the corresponding target input and the expected output corresponding to the target input are obtained through the program information corresponding to the target function in the target text.
[0113] Exemplarily, the target input is run in the target program to obtain the actual output corresponding to the target function under the target input.
[0114] Step S107: Determine a test result corresponding to the objective function according to the expected output and the actual output.
[0115] Exemplarily, the expected output and the actual output are compared. When the expected output is the same as the actual output, the test result corresponding to the objective function is determined to be a passed test. When the expected output is different from the actual output, the test result corresponding to the objective function is determined to be a failed test.
[0116] Step S108: determining a log text corresponding to the target program according to the target function, the expected output, the actual output and the test result.
[0117] Exemplarily, when the test result is that the test passes, the first text template corresponding to the log text is determined, for example, if the actual output and expected output of (objective function) under (target input) are the same, both are (actual output or expected output), then the (objective function) test passes; when the test result is that the test fails, the second text template corresponding to the log text is determined, for example, if the expected output of (objective function) under (target input) is (expected output), and the actual output is (actual output), and the two results are not the same, then the (objective function) fails the test and the developer needs to perform functional repairs. The content in brackets in the first text template and the second text template is the real information that needs to be entered.
[0118] For example, the target function is add(), the target input is 3 and 4, the actual output is 6, the expected output is 7, and the test result is a test failure. The log text generated according to the second text template is add() with an expected output of 7 and an actual output of 6 under 3 and 4. The two results are different, so add() fails the test and the developer needs to repair the function.
[0119] In some embodiments, determining the log text corresponding to the target program based on the objective function, the expected output, the actual output and the test result includes: obtaining first description information corresponding to the objective function from the target text and obtaining second description information corresponding to the objective function from the annotation information; extracting key information based on the first description information and the second description information to obtain target description information corresponding to the objective function; and using the expected output, the actual output and the test result to perform text constraints on the target description information to generate the log text corresponding to the objective function.
[0120] Exemplarily, the description position of the target function is searched in the target text to obtain first description information corresponding to the target function, and annotation information corresponding to the target function is obtained from the annotation information and determined as second description information.
[0121] Exemplarily, the first description information (from the target text) and the second description information (from the annotation information) are integrated to form a comprehensive target description information, so as to ensure that the target description information covers all important aspects of the target function and is clear and understandable. That is, the target description information accurately reflects the actual function and expected behavior of the target function.
[0122] Exemplarily, determine how to combine the expected output, actual output, and test results with the target description information. This includes defining the format, content, and constraints of the log text. For example, set the information that needs to be included in the log text, such as function description, expected results, actual results, and test results, and then integrate the target description information and test-related data (such as expected output, actual output, and test results) into the log text according to the defined text constraints to ensure that the log text can accurately record the execution of the target function.
[0123] Specifically, the description information extracted from the target text and annotation information can provide a comprehensive perspective of the target function, ensuring that the function's functions, inputs and outputs, and boundary conditions are fully described. By integrating description information from multiple sources, it is possible to ensure that the information recorded in the document is more accurate, reduce misunderstandings caused by inconsistent or incomplete descriptions, and then generate target description information that can accurately reflect the actual function and design intent of the target function, making the intent and implementation of the code clearer. Therefore, the log text generated using the target description information and test results can clearly record the test objectives and actual results, helping developers quickly locate problems and improve debugging efficiency.
[0124] In some embodiments, the use of the expected output, the actual output, and the test result to perform text constraints on the target description information to generate the log text corresponding to the target function includes: determining a description framework corresponding to the target function based on the target description information, and filling the expected output, the actual output, and the test result into the description framework to obtain the test description information corresponding to the target function; determining a connection relationship between the test description information and the target description information based on the test result; and fusing the test description information and the target description information based on the connection relationship to obtain the log text corresponding to the target function.
[0125] Exemplarily, a description framework is designed based on the target description information. This framework can be a structured document or template for systematically organizing and displaying all relevant information about the target function. The expected output of the target function is clearly recorded in the description framework, and after actually running the target function, the actual output of the function is recorded and filled into the description framework, and the test results are also filled into the description framework, so as to obtain the test description information corresponding to the target function.
[0126] Exemplarily, when the test result is that the test passes, the connection relationship between the test description information and the target description information is a dependency relationship; when the test result is that the test fails, the connection relationship between the test description information and the target description information is a transition relationship.
[0127] Exemplarily, the connection relationship is used to fuse the test description information and the target description information to obtain the log text corresponding to the target function. The log text completely records the description of the target function, the expected output, the actual output, and all key information between the test results, providing support for subsequent developers to solve problems.
[0128] Specifically, by determining the description framework and filling in the expected output, actual output, and test results, the relevant information of the objective function can be systematically organized. This structured approach helps ensure the completeness and consistency of the document. Recording the test description information and the target description information in a unified framework helps ensure that all relevant information is summarized in one place to avoid information omissions and inconsistencies. By analyzing the connection between the target description information and the test description information, it is easier to trace the root cause of the problem. This helps to locate functional defects or performance problems so that they can be effectively repaired. And by standardizing the description framework and log generation process, it can support the automation of documentation and testing. This will reduce the workload of manually writing and updating documents, improve the efficiency of development and testing, and help improve the overall efficiency and quality of software development.
[0129] In some embodiments, after determining the test result corresponding to the objective function based on the expected output and the actual output, the method further includes: when the test result is a test failure, obtaining the operating data corresponding to the objective function; using static analysis tools and dynamic analysis tools to analyze the operating data to obtain the initial abnormal area corresponding to the objective function; using an artificial intelligence model to score the code complexity of the initial abnormal area to obtain a risk identifier corresponding to the initial abnormal area; using an automated debugging tool to step by step check the initial abnormal area according to the risk identifier to obtain a target abnormal area corresponding to the objective function, and the target abnormal area is used for subsequent abnormal problem solving of the objective function.
[0130] Exemplarily, ensure that all relevant running data of the target function is collected when the test is running. The running data includes but is not limited to the corresponding input and output in each step of the target function, and then select a suitable static analysis tool (such as SonarQube, Checkmarx, Fortify) to analyze the code structure and potential problems, and pass the code in the running data to the static analysis tool. The tool will scan the potential defects, high-complexity areas and code quality problems in the code. And select a suitable dynamic analysis tool (such as Dynatrace, New Relic, AppDynamics) to monitor the actual running behavior of the code, and pass the running data to the dynamic analysis tool. The tool will analyze the performance, resource usage and other information of the code in actual execution. Then, based on the results of static analysis and dynamic analysis, identify the initial abnormal area where abnormalities may exist. The initial abnormal area may include highly complex code blocks, performance bottlenecks, resource leaks, etc.
[0131] Exemplarily, a suitable artificial intelligence model (such as a deep learning model, a machine learning model) is selected to evaluate code complexity and risk. These models can make predictions based on historical data and training data. The code of the initial abnormal area is passed to the artificial intelligence model, and the artificial intelligence model will evaluate the complexity and potential risks of the initial abnormal area. The score of the initial abnormal area output by the artificial intelligence model can be based on code complexity indicators, error rates, execution time, etc. The higher the output score, the higher the risk level corresponding to the initial abnormal area. The risk identification is determined based on the output score. The risk identification usually includes high, medium, and low risk levels. The initial abnormal area is then sorted from high to low according to the risk identification to determine the priority area.
[0132] Exemplarily, select a suitable automated debugging tool (such as GDB, WinDbg, Visual Studio Debugger) for step-by-step debugging. Input the code and running data of the target function into the automated debugging tool, configure the parameters and conditions for step-by-step debugging, and then perform step-by-step debugging in the automated debugging tool, check the initial abnormal area marked in the risk identifier, observe the program's running status, variable values, and error information, and then find the specific code line or code block that caused the abnormality through step-by-step debugging to determine the target abnormal area. These target abnormal areas may be the root cause of the test failure, and then record the detailed information of the target abnormal area to provide a basis for subsequent abnormal problem solving.
[0133] Specifically, by obtaining the running data of the target function, we can fully understand the performance of the function in actual operation. This includes input, output, execution path, etc., which helps to accurately diagnose the root cause of the problem. By combining static analysis tools and dynamic analysis tools, potential anomalies can be identified from multiple levels. Static analysis focuses on code quality and potential defects, and dynamic analysis focuses on runtime behavior and performance. This multi-angle analysis improves the accuracy of abnormal area identification, thereby obtaining the initial abnormal area, and then generating corresponding risk identification for the initial abnormal area through the artificial intelligence model, so that high-risk areas can be prioritized. In this way, during the step-by-step inspection and debugging process, the abnormal area with the greatest impact on system stability can be solved first, thereby improving the efficiency of abnormal identification. Finally, the target abnormal area of the target function can be checked step by step using automated debugging tools, which can systematically locate and fix the problem. This step-by-step debugging method can help developers understand the specific source of the problem in more detail.
[0134] The embodiment of the present invention provides a log generation method and a related device, which includes: by identifying and analyzing the important information corresponding to the initial text of the target program, the structure and function of the program can be better understood, thereby screening the initial text to obtain the target text corresponding to the target program, then obtaining the program information corresponding to the target program in the target text by information identification of the target text, and then determining the target relationship corresponding to the target text according to the program information; thereby determining the process information corresponding to the target program according to the program information and the target relationship, and then combing the execution logic and data flow of the target program according to the process information. This is very important for subsequent testing and debugging. Then, according to the corresponding annotation information in the target program, the target function corresponding to any sub-process in the process information is determined, and then by determining the target input and expected output of the target function, and testing by using the target input through the target function, it can be verified whether the program works as expected to obtain the real output, and then comparing the expected output and the real output can help determine the test result corresponding to the target function, and finally by recording the test result, expected output, real output and target function of the target function to generate a detailed log text, and then after obtaining the log text, the developer can quickly locate the problem in the program by analyzing the log text, so as to effectively debug and repair. This method not only significantly improves the efficiency of development and maintenance, but also shortens the time of program failures by quickly locating faults. In addition, log text can help developers find the root cause faster when encountering problems, thereby avoiding the same problems from happening again and further improving the stability and reliability of the system. This method also solves the problem in related technologies that excessive log output will drown out truly important information.
[0135] See also Figure 2 , Figure 2A schematic block diagram of the structure of a terminal device provided in an embodiment of the present invention.
[0136] like Figure 2 As shown, the terminal device 300 includes a processor 301 and a memory 302 , and the processor 301 and the memory 302 are connected via a bus 303 , such as an I2C (Inter-integrated Circuit) bus.
[0137] Specifically, the processor 301 is used to provide computing and control capabilities to support the operation of the entire terminal device. The processor 301 can be a central processing unit (CPU), and the processor 301 can also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.
[0138] Specifically, the memory 302 may be a Flash chip, a read-only memory (ROM) disk, an optical disk, a USB flash drive, or a mobile hard disk.
[0139] Those skilled in the art will understand that Figure 2 The structure shown in the figure is only a block diagram of a partial structure related to the embodiment of the present invention, and does not constitute a limitation on the terminal device to which the embodiment of the present invention is applied. The specific server may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0140] The processor is used to run a computer program stored in the memory, and implement any one of the log generation methods provided by the embodiments of the present invention when executing the computer program.
[0141] In one embodiment, the processor is used to run a computer program stored in the memory, and implements the following steps when executing the computer program:
[0142] Obtaining an initial text corresponding to a target program, and performing importance recognition on the initial text to obtain a target text corresponding to the target program;
[0143] Performing information recognition on the target text to obtain program information corresponding to the target program in the target text;
[0144] Determining a target relationship corresponding to the target text according to the program information;
[0145] Determine the process information corresponding to the target program according to the program information and the target relationship;
[0146] Obtaining annotation information corresponding to the target program, and matching the annotation information with process information to obtain a target function corresponding to any sub-process in the process information;
[0147] Determine a target input corresponding to the target function and an expected output corresponding to the target input, and obtain a real output corresponding to the target input in the target function;
[0148] Determine a test result corresponding to the objective function according to the expected output and the actual output;
[0149] The log text corresponding to the target program is determined according to the target function, the expected output, the actual output and the test result.
[0150] In some implementations, the processor 301, in the process of identifying the importance of the initial text to obtain the target text corresponding to the target program, executes:
[0151] Extracting information from the initial text to obtain a target function corresponding to the target program and a functional relationship between any two of the target functions;
[0152] Obtain any sentence information from the initial text, and delete the sentence information from the initial text to obtain a deleted intermediate text;
[0153] Calculate the first relationship probability corresponding to the functional relationship between any two of the target functions in the initial text, and calculate the second relationship probability corresponding to the functional relationship between any two of the target functions in the intermediate text;
[0154] Determine the importance score corresponding to the sentence information according to the first relationship probability and the second relationship probability;
[0155] Deleting the sentence information in the initial text according to the importance score to obtain the target text corresponding to the target program;
[0156] The importance score is obtained according to the following formula:
[0157] ;
[0158] in, Indicates that the functional relationship between the i-th target function and the j-th target function is in the intermediate text after deleting the sentence information m. The corresponding probability of the second relationship is as follows; The first relationship probability representing the functional relationship between the i-th target function and the j-th target function corresponding to the initial text; The importance score corresponding to the functional relationship between the i-th target function and the j-th target function in the sentence information m.
[0159] In some implementations, the processor 301, in the process of deleting the sentence information in the initial text according to the importance score to obtain the target text corresponding to the target program, executes:
[0160] Determine, from the sentence information, a set of irrelevant sentences corresponding to any one of the functional relationships according to the importance scores;
[0161] Performing repeated statement calculation on all the irrelevant statement sets to obtain repeated statement sets corresponding to the irrelevant statement sets;
[0162] Any repeated text in the repeated statement set is deleted from the initial text to obtain the target text corresponding to the target program.
[0163] In some implementations, the program information includes a function text, a function element, a function position, and context information corresponding to the function text. In the process of determining the target relationship corresponding to the target text according to the program information, the processor 301 executes:
[0164] Using the feature embedding layer of the relationship recognition model, the function text is represented by text to obtain a corresponding first information representation, the function position is represented by position embedding to obtain a corresponding second information representation, the function element is represented by function information embedding to obtain a corresponding third information representation, and the context information is represented by text to obtain a corresponding fourth information representation;
[0165] Using the feature fusion layer of the relationship recognition model, the first information representation, the second information representation, the third information representation and the fourth information representation are fused to obtain an initial information representation;
[0166] Using the feature extraction layer of the relationship recognition model to perform effective feature extraction on the initial information representation to obtain the target information representation;
[0167] The target information representation is subjected to relationship classification using the relationship classification layer of the relationship recognition model to obtain the target relationship corresponding to the target texts.
[0168] In some implementations, the processor 301, in the process of obtaining the annotation information corresponding to the target program and matching the annotation information with the process information to obtain the target function corresponding to any sub-process in the process information, executes:
[0169] Obtaining a first batch of annotation content corresponding to any sub-function in the target program from the annotation information, and obtaining a first associated content corresponding to any sub-process in the process information from the target text;
[0170] Calculating a first similarity between the first batch of annotation contents and the first associated contents, and selecting a related function corresponding to the sub-process from the sub-functions according to the first similarity;
[0171] Obtaining a first calling function and a second calling function corresponding to the related function from a calling sequence of the target program, wherein the first calling function is used to represent a function that calls the related function, and the second calling function is used to represent a function that calls other functions of the related function;
[0172] Obtaining second annotation content corresponding to the first calling function from the annotation information, and obtaining third annotation content corresponding to the second calling function from the annotation information;
[0173] Obtaining the upper process and the lower process connected to the sub-process from the process information, and obtaining the second associated content corresponding to the upper process from the target text and obtaining the third associated content corresponding to the lower process from the target text;
[0174] Calculating a second similarity between the second annotation content and the second associated content, and calculating a third similarity between the third annotation content and the third associated content;
[0175] The target function corresponding to the sub-process is determined from the correlation function according to the second similarity degree and the third similarity degree.
[0176] In some implementations, the processor 301, in the process of determining the log text corresponding to the target program according to the target function, the expected output, the actual output, and the test result, executes:
[0177] Obtaining first description information corresponding to the target function from the target text and obtaining second description information corresponding to the target function from the annotation information;
[0178] Extract key information according to the first description information and the second description information to obtain target description information corresponding to the target function;
[0179] The expected output, the actual output and the test result are used to perform text constraints on the target description information to generate the log text corresponding to the target function.
[0180] In some implementations, the processor 301, in the process of using the expected output, the actual output, and the test result to perform text constraints on the target description information to generate the log text corresponding to the target function, executes:
[0181] Determine a description framework corresponding to the objective function according to the objective description information, and fill the expected output, the actual output and the test result into the description framework to obtain the test description information corresponding to the objective function;
[0182] Determine a connection relationship between the test description information and the target description information according to the test result;
[0183] The test description information and the target description information are fused according to the connection relationship to obtain the log text corresponding to the target function.
[0184] In some implementations, after the processor 301 determines the test result corresponding to the objective function according to the expected output and the actual output, it further executes:
[0185] When the test result is that the test fails, the operation data corresponding to the objective function is obtained;
[0186] Analyzing the operation data using a static analysis tool and a dynamic analysis tool to obtain an initial abnormal region corresponding to the objective function;
[0187] Using an artificial intelligence model to score the code complexity of the initial abnormal area, and obtaining a risk identifier corresponding to the initial abnormal area;
[0188] The initial abnormal area is checked step by step using an automated debugging tool according to the risk identification to obtain a target abnormal area corresponding to the objective function, and the target abnormal area is used for subsequent abnormal problem solving of the objective function.
[0189] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the terminal device described above can refer to the corresponding process in the aforementioned log generation method embodiment, and will not be repeated here.
[0190] An embodiment of the present invention further provides a storage medium for computer-readable storage, wherein the storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of any log generation method provided in the description of the embodiment of the present invention.
[0191] The storage medium may be an internal storage unit of the terminal device in the aforementioned embodiment, such as a hard disk or memory of the terminal device. The storage medium may also be an external storage device of the terminal device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the terminal device.
[0192] It will be appreciated by those skilled in the art that all or some of the steps, systems, and functional modules / units in the methods disclosed above may be implemented as software, firmware, hardware, and appropriate combinations thereof. In a hardware embodiment, the division between the functional modules / units mentioned in the above description does not necessarily correspond to the division of physical components; for example, a physical component may have multiple functions, or a function or step may be performed by several physical components in cooperation. Some or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor, or a microprocessor, or implemented as hardware, or implemented as an integrated circuit, such as an application-specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or non-transitory medium) and a communication medium (or transient medium). As is known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules, or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technology, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer. In addition, it is well known to those skilled in the art that communication media typically contain computer-readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0193] It should be understood that the term "and / or" used in the present specification and the appended claims refers to any combination of one or more of the associated listed items and all possible combinations, including these combinations. It should be noted that, in this article, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "including a..." does not exclude the presence of other identical elements in the process, method, article or system including the element.
[0194] The serial numbers of the embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments. The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.
Claims
1. A log generation method, It is characterized in that The method comprises: Obtaining an initial text corresponding to a target program, and performing importance identification on the initial text to obtain a target text corresponding to the target program, wherein the initial text is a requirement document corresponding to the development of the target program; Performing information recognition on the target text to obtain program information corresponding to the target program in the target text; Determining a target relationship corresponding to the target text according to the program information; Determine the process information corresponding to the target program according to the program information and the target relationship; Obtaining annotation information corresponding to the target program, and matching the annotation information with process information to obtain a target function corresponding to any sub-process in the process information; Determine a target input corresponding to the target function and an expected output corresponding to the target input, and obtain a real output corresponding to the target input in the target function; Determine a test result corresponding to the objective function according to the expected output and the actual output; Determine the log text corresponding to the target program according to the target function, the expected output, the actual output and the test result; The step of obtaining annotation information corresponding to the target program and matching the annotation information with the process information to obtain a target function corresponding to any sub-process in the process information includes: Obtaining a first batch of annotation content corresponding to any sub-function in the target program from the annotation information, and obtaining a first associated content corresponding to any sub-process in the process information from the target text; Calculating a first similarity between the first batch of annotation contents and the first associated contents, and selecting a related function corresponding to the sub-process from the sub-functions according to the first similarity; Obtaining a first calling function and a second calling function corresponding to the related function from a calling sequence of the target program, wherein the first calling function is used to represent a function that calls the related function, and the second calling function is used to represent a function that calls other functions of the related function; Obtaining second annotation content corresponding to the first calling function from the annotation information, and obtaining third annotation content corresponding to the second calling function from the annotation information; Obtaining the upper process and the lower process connected to the sub-process from the process information, and obtaining the second associated content corresponding to the upper process from the target text and obtaining the third associated content corresponding to the lower process from the target text; Calculating a second similarity between the second annotation content and the second associated content, and calculating a third similarity between the third annotation content and the third associated content; The target function corresponding to the sub-process is determined from the correlation function according to the second similarity degree and the third similarity degree.
2. The method according to claim 1, It is characterized in that The step of identifying the importance of the initial text to obtain the target text corresponding to the target program includes: Extracting information from the initial text to obtain a target function corresponding to the target program and a functional relationship between any two of the target functions; Obtain any sentence information from the initial text, and delete the sentence information from the initial text to obtain a deleted intermediate text; Calculate the first relationship probability corresponding to the functional relationship between any two of the target functions in the initial text, and calculate the second relationship probability corresponding to the functional relationship between any two of the target functions in the intermediate text; Determine the importance score corresponding to the sentence information according to the first relationship probability and the second relationship probability; Deleting the sentence information in the initial text according to the importance score to obtain the target text corresponding to the target program; The importance score is obtained according to the following formula: ; in, Indicates that the functional relationship between the i-th target function and the j-th target function is in the intermediate text after deleting the sentence information m. The corresponding probability of the second relationship is as follows; The first relationship probability representing the functional relationship between the i-th target function and the j-th target function corresponding to the initial text; The importance score corresponding to the functional relationship between the i-th target function and the j-th target function in the sentence information m.
3. The method according to claim 2, It is characterized in that The step of deleting the sentence information in the initial text according to the importance score to obtain the target text corresponding to the target program includes: Determine, from the sentence information, a set of irrelevant sentences corresponding to any one of the functional relationships according to the importance scores; Performing repeated statement calculation on all the irrelevant statement sets to obtain repeated statement sets corresponding to the irrelevant statement sets; Any repeated text in the repeated statement set is deleted from the initial text to obtain the target text corresponding to the target program.
4. The method according to claim 1, It is characterized in that The program information includes a function text, a function element, a function position, and context information corresponding to the function text. The determining the target relationship corresponding to the target text according to the program information includes: Using the feature embedding layer of the relationship recognition model, the function text is represented by text to obtain a corresponding first information representation, the function position is represented by position embedding to obtain a corresponding second information representation, the function element is represented by function information embedding to obtain a corresponding third information representation, and the context information is represented by text to obtain a corresponding fourth information representation; Using the feature fusion layer of the relationship recognition model, the first information representation, the second information representation, the third information representation and the fourth information representation are fused to obtain an initial information representation; Using the feature extraction layer of the relationship recognition model to perform effective feature extraction on the initial information representation to obtain the target information representation; The target information representation is subjected to relationship classification using the relationship classification layer of the relationship recognition model to obtain the target relationship corresponding to the target texts.
5. The method according to claim 1, It is characterized in that The determining the log text corresponding to the target program according to the target function, the expected output, the actual output and the test result includes: Obtaining first description information corresponding to the target function from the target text and obtaining second description information corresponding to the target function from the annotation information; Extract key information according to the first description information and the second description information to obtain target description information corresponding to the target function; The expected output, the actual output and the test result are used to perform text constraints on the target description information to generate the log text corresponding to the target function.
6. The method according to claim 5, It is characterized in that The step of using the expected output, the actual output, and the test result to perform text constraints on the target description information to generate the log text corresponding to the target function includes: Determine a description framework corresponding to the objective function according to the objective description information, and fill the expected output, the actual output and the test result into the description framework to obtain the test description information corresponding to the objective function; Determine a connection relationship between the test description information and the target description information according to the test result; The test description information and the target description information are fused according to the connection relationship to obtain the log text corresponding to the target function.
7. The method according to any one of claims 1 to 6, It is characterized in that After determining the test result corresponding to the objective function according to the expected output and the actual output, the method further includes: When the test result is that the test fails, the operation data corresponding to the objective function is obtained; Analyzing the operation data using a static analysis tool and a dynamic analysis tool to obtain an initial abnormal region corresponding to the objective function; Using an artificial intelligence model to score the code complexity of the initial abnormal area, and obtaining a risk identifier corresponding to the initial abnormal area; The initial abnormal area is checked step by step using an automated debugging tool according to the risk identification to obtain a target abnormal area corresponding to the objective function, and the target abnormal area is used for subsequent abnormal problem solving of the objective function.
8. A terminal device, It is characterized in that The terminal device includes a processor and a memory; The memory is used to store computer programs; The processor is configured to execute the computer program and implement the log generating method according to any one of claims 1 to 7 when executing the computer program.
9. A computer storage medium for computer storage, It is characterized in that The computer storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps of the log generation method according to any one of claims 1 to 7.
