Code positioning method
By adding code access paths to the log query system and associating the log query system with the code warehouse, the problem of low code positioning efficiency in the log query system is solved, and the rapid positioning from business logs to code is realized, and the code positioning efficiency is improved.
Patent Information
- Application Number
- CN202411057852.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-02
- Publication Date
- 2024-12-17
AI Technical Summary
The existing log query system is inefficient in the code positioning process, making it difficult for users to locate the code position quickly and accurately, and the operation is complicated.
By adding code access paths to the log query system, the log query system is closely linked to the code warehouse, and the rapid positioning from business logs to code is realized, and the code positioning process is simplified. The specific methods include receiving log query instructions, querying and feedbacking the target log. The target log contains the log content and code access path. After the user selects the code access path, positioning and displaying the corresponding code branch location of the target log.
It improves the efficiency of code positioning, simplifies the code positioning process, enables users to quickly and accurately locate code positions, and reduces operational complexity.
Smart Images

Figure CN119149277A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a code positioning method. Background Art
[0002] The log query system is an important means for developers to locate application problems. In the relevant solution, the log query system collects the application's business logs through Logstash and stores them in Elasticsearch (distributed search and analysis engine, ES) by formulating rules, and then provides a visual interactive interface for users through Kibana; users can filter and query the required business logs through conditions during use; if they encounter business logs with error information and need to locate the code, users need to first check the business log information, then open the relevant project code, find the code location that prints the business log, and then analyze and judge by checking the context-related code to solve the relevant problems.
[0003] In the above solution, when the user uses the log query system to locate the code, the code cannot be located quickly and accurately, the operation of locating the code is relatively complicated, and the efficiency of locating the code is low. Summary of the invention
[0004] An embodiment of the present application provides a code location method. By adding the code access path to the business log, the log query system can be closely associated with the code repository, thereby achieving rapid location from the business log to the code, simplifying the code location process, and improving the code location efficiency. The technical solution is as follows.
[0005] On the one hand, a code location method is provided, the method being performed by a log query system, the method comprising:
[0006] Receive log query instructions;
[0007] Based on the log query instruction, query and feedback the target log; the target log includes log content and code access path; the code access path is used to link the code corresponding to the target log to the code location in the corresponding code repository;
[0008] When a selection operation corresponding to the code access path is received, a code position of a code branch corresponding to the target log is located and displayed.
[0009] On the other hand, a code positioning device is provided, which is applied in a log query system, and includes:
[0010] An instruction receiving module, used for receiving log query instructions;
[0011] A log feedback module, used to query and feedback a target log based on the log query instruction; the target log includes log content and a code access path; the code access path is used to link the code corresponding to the target log to the code location in the corresponding code repository;
[0012] The code locating module is used to locate and display the code position of the code branch corresponding to the target log when receiving a selection operation corresponding to the code access path.
[0013] In a possible implementation, the log content of the business log includes a business system identifier and a code branch, and the device further includes:
[0014] An identification acquisition module is used to obtain the business system identification corresponding to the business log;
[0015] A query module, used to perform information query based on the business system identifier of the business log to obtain a query result;
[0016] A path generation module, configured to generate a code access path corresponding to the business log based on a code branch of the business log and the corresponding code repository information, when the query result indicates that the log query system contains code repository information corresponding to the business log;
[0017] The path adding module is used to write the code access path corresponding to the business log into the business log.
[0018] In a possible implementation manner, the device further includes:
[0019] An information receiving module, used to receive code repository information corresponding to the dynamic configuration of the business system;
[0020] The matching module is used to associate and match the business system identifier of the business system with the corresponding code repository information.
[0021] In a possible implementation, when the target log is an error log, the target log also includes a log analysis result, and the log analysis result includes at least one of the following: an associated link of the target log, log information of the associated link, and a suggested solution.
[0022] In a possible implementation manner, the device further includes:
[0023] An analysis module, configured to analyze and process the business log to obtain a log analysis result of the business log when determining that the received business log is an error log;
[0024] The result writing module is used to write the log analysis result into the business log.
[0025] In a possible implementation, the analysis module is used for at least one of the following:
[0026] Performing log link tracking based on the log tracking identifier of the business log to obtain an associated link of the business log;
[0027] Based on the log information of each business log in the associated link of the business log, the log information of the associated link is composed;
[0028] Based on the service log and the solutions of the historical error logs stored in the log database, a suggested solution corresponding to the service log is generated.
[0029] In a possible implementation, the analysis module includes:
[0030] A set determination submodule, configured to determine a target log set from the historical error logs stored in the log database based on the business log; the target log set includes at least one historical error log whose similarity to the business log is higher than a similarity threshold;
[0031] The solution generation submodule is used to generate a suggested solution corresponding to the business log based on the solution of each historical error log in the target log set.
[0032] In a possible implementation, the solution generation submodule is used to:
[0033] A solution of a target error log in a target log set is determined as a suggested solution for the service log; the target error log is a historical error log in the target log set that has the highest similarity to the service log.
[0034] In a possible implementation, the solution generation submodule is used to:
[0035] The solutions of each historical error log in the target log set and the solution generation indicator are input into the large language model to obtain the recommended solutions corresponding to the business log output by the large language model.
[0036] In a possible implementation, the code location module is used to:
[0037] Locate and display the code position of the code branch corresponding to the target log in a target display mode; the target display mode includes at least one of the following: highlight rendering, identification box identification, bold font, enlarged font size and font color change.
[0038] On the other hand, a computer device is provided, the computer device comprising a processor and a memory, the memory storing at least one computer program, the at least one computer program being loaded and executed by the processor to implement the above-mentioned code location method.
[0039] On the other hand, a computer-readable storage medium is provided, wherein at least one computer program is stored in the computer-readable storage medium, and the computer program is loaded and executed by a processor to implement the above-mentioned code location method.
[0040] On the other hand, a computer program product is provided, which includes a computer program stored on a non-transitory computer-readable storage medium, and the computer program includes program instructions, which, when executed by a computer, cause the computer to execute to implement the code location method provided in the above-mentioned various optional implementations.
[0041] The technical solution provided by this application may have the following beneficial effects:
[0042] The code location method provided by the embodiment of the present application is that when the log query system receives the log query instruction, it queries and feeds back the target log based on the log query instruction. In addition to the log content, the target log also contains a code access path for linking the code corresponding to the target log to the code location in the corresponding code warehouse. After receiving the selection operation based on the code access path, the code location of the code branch corresponding to the target log can be located and displayed. By adding the code access path to the business log, the log query system can be closely associated with the code warehouse, and then rapid location from the business log to the code can be achieved, which simplifies the code location process and improves the code location efficiency.
[0043] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0045] Figure 1 A flowchart of a code positioning method provided by an exemplary embodiment of the present application is shown;
[0046] Figure 2 A flowchart of a code positioning method provided by an exemplary embodiment of the present application is shown;
[0047] Figure 3A schematic diagram showing a code location architecture corresponding to a code location method provided by an exemplary embodiment of the present application;
[0048] Figure 4 An interactive schematic diagram of a code location architecture provided by an exemplary embodiment of the present application is shown;
[0049] Figure 5 A block diagram of a code locating device provided by an exemplary embodiment of the present application is shown;
[0050] Figure 6 It is a structural block diagram of a computer device according to an exemplary embodiment. DETAILED DESCRIPTION
[0051] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0052] In order to improve the convenience of code location, the embodiment of the present application provides a solution for quickly viewing the relevant codes of the print log and quickly locating the code problem through the log query system; Figure 1 A flowchart of a code location method provided by an exemplary embodiment of the present application is shown. The method can be executed by a log query system, and the log query system can be implemented as a server, such as Figure 1 As shown, the code positioning method may include the following steps:
[0053] Step 110: Receive a log query instruction.
[0054] In a possible implementation, the log query system can receive the log query instruction input by the user through a visual interactive platform provided to the outside. The log query instruction can be based on the text input received by the visual interactive platform, or the log query instruction can also be obtained after voice recognition of the voice input received based on the visual interactive platform. The present application does not limit the way in which the user inputs the log query instruction. Among them, the visual interactive platform can be a visual web interface provided, and the visual interactive platform is used to receive the user's log query instruction and display the feedback log query result.
[0055] The log query instruction may include at least one of the following: a keyword, a date, a date range, a log level, or other screening conditions, for querying the log records required by the user.
[0056] Step 120, query and feedback the target log based on the log query instruction; the target log includes log content and code access path; the code access path is used to link the code corresponding to the target log to the code location in the corresponding code repository.
[0057] The log query system retrieves qualified log records, i.e., target logs, from the log database or cluster according to the received log query instructions; the target log contains log content and code access path, where the log content may include but is not limited to timestamp, log level, error information, etc.; the code access path is a link generated by the log query system for each log written into the system, which points to the code location in the code repository of the code that generates this log.
[0058] Step 130 , when a selection operation corresponding to the code access path is received, the code position of the code branch corresponding to the target log is located and displayed.
[0059] When receiving a user's selection operation (such as a click operation, or a touch operation, etc.) on the code access path in the target log, the log query system responds to the selection operation, jumps to the specified code branch and code position in the code repository, and displays it through a visual interactive platform for the user to view the code of the target log; in a possible implementation, when the log query system identifies the code position of the code branch corresponding to the target log in the corresponding code repository, the code position of the code branch corresponding to the target log can be displayed in a target display mode, wherein the target display mode includes at least one of the following: highlight rendering, identification by an identification box, bold font, enlarged font size, and changed font color; while ensuring the readability of the code, the code position of the code branch that generates the log is highlighted to facilitate users to quickly locate the corresponding code.
[0060] In addition to displaying the code location of the code branch that generates the target log in the code repository, the visual interactive platform can also display the context code of the code branch corresponding to the target log, that is, several lines of code before and after it, to provide a more complete code environment, making it easier for users to understand the code logic and contextual relationship.
[0061] In summary, the code location method provided by the embodiment of the present application is that when the log query system receives the log query instruction, it queries and feeds back the target log based on the log query instruction. In addition to the log content, the target log also contains a code access path for linking the code corresponding to the target log to the code location in the corresponding code warehouse, and then after receiving the selection operation based on the code access path, the code location of the code branch corresponding to the target log can be located and displayed. By adding the code access path to the business log, the log query system can be closely associated with the code warehouse, and then rapid location from the business log to the code can be achieved, which simplifies the code location process and improves the code location efficiency.
[0062] The code location method provided by the embodiment of the present application includes a log writing phase and a log query phase, wherein, in order to make the log queried in the log query phase contain the code access path, so as to realize the rapid location of the code branch corresponding to the log based on the code access path, in the log writing phase, the log query system needs to associate the written log with the code branch in the corresponding code repository to generate the code access path, and add the code access path to the corresponding log. Corresponding to the log writing phase, Figure 2 A flowchart of a code location method provided by an exemplary embodiment of the present application is shown. The method can be executed by a log query system, and the log query system can be implemented as a server, such as Figure 2 As shown, the code positioning method may include the following steps:
[0063] Step 210: Obtain the business system identifier corresponding to the business log.
[0064] The business log is any log written into the log management system.
[0065] The business log is obtained by the business system that generates the log data printing the log data into the log file according to the log format defined by the log query system; wherein, the business system prints the log data to be printed into the specified directory file in the required format to obtain the business log, wherein the log data may include but is not limited to the business system identifier (service), log level (log_level), log printing time (print_time), business access path (request_url), log tracking id (trace_id), code branch (code_branch) and other information required according to the business system requirements.
[0066] After generating a business log, the business system will actively send the business log to the log query system, and correspondingly, the log query system receives the business log; alternatively, the log query system can collect the business log generated by the business system through a log collection program.
[0067] After obtaining the business log, the log query system can obtain the business system identifier corresponding to the business log through the log collection program.
[0068] Step 220: perform information query based on the business system identifier of the business log to obtain query results.
[0069] In a possible implementation, after the business system is connected to the log query system, relevant personnel (such as administrators or authorized personnel) can dynamically configure the code repository information of the business system based on the code repository of the business system, where the code repository information may include but is not limited to the repository address, branch information, tags or version information and other code repository related information; after receiving the configured code repository information of the business system, the log query system associates and matches the business system identifier (service) of the connected business system with the corresponding code repository (gitlab) information; if the log query system does not receive the code repository information corresponding to the business system configuration, the corresponding association processing operation is not performed. The process can be implemented as follows:
[0070] Receive code repository information corresponding to the dynamic configuration of the business system;
[0071] Associate and match the business system ID of the business system with the corresponding code repository information.
[0072] After the above processing, the log query system stores the association relationship between the business system identifier and the corresponding code repository information. When receiving the business log, the log query system can perform information query based on the business system identifier carried in the business log to obtain a query result. The query result indicates that the log query system contains the code repository information corresponding to the business log, or the query result indicates that the log query system does not contain the code repository information corresponding to the business log.
[0073] In a possible implementation, the above-mentioned process of establishing the association and matching relationship between the business system identifier and the code warehouse information, and performing information query based on the business system identifier of the business log can be performed through a log collection program in the log query system, that is, the relevant personnel input or set the code warehouse information corresponding to the accessed business system through the log collection program; the log collection program matches and associates the business system identifier of the business system with the code warehouse information of the business system. When the business log is written into the log query system, the log collection program determines the corresponding code warehouse information based on the business system identifier corresponding to the business log.
[0074] Step 230 , when the query result indicates that the log query system contains code repository information corresponding to the business log, a code access path corresponding to the business log is generated based on the code branch of the business log and the corresponding code repository information.
[0075] After obtaining the code repository information and the code branch of the business log, the log query system can obtain the location of the business log in the code repository by performing a code branch query in the code repository indicated by the code repository information, and then generate the code access path corresponding to the business log.
[0076] Step 240: Write the code access path corresponding to the business log into the business log.
[0077] After the code access path is written into the business log, after the business log is queried in the log query phase, the code location of the code branch corresponding to the target log in the corresponding code repository can be directly located based on the code access path in the business log.
[0078] If the query result indicates that the log query system does not contain the code repository information corresponding to the business log, the process of generating and writing the code access path is not performed.
[0079] In summary, the code location method provided by the embodiment of the present application is that the log query system associates and matches the business system identifier of the business system with the corresponding code warehouse information. When receiving the business log of the business system, the corresponding code warehouse information is obtained based on the business system identifier, and the code access path corresponding to the business log is generated based on the located code warehouse information and the code branch of the business log, and the code access path is written into the business log; thus, when receiving the log query instruction, the target log containing the code access path can be fed back, and then after receiving the selection operation based on the code access path, the code position of the code branch corresponding to the target log can be located and displayed. By adding the code access path to the business log, the log query system can be closely associated with the code warehouse, and then rapid location from the business log to the code can be achieved, which simplifies the code location process and improves the code location efficiency.
[0080] Further, in the case where the target log is an error log, the target log also includes a log analysis result, and the log analysis result includes at least one of the following: an associated link of the target log, log information of the associated link, and a suggested solution.
[0081] In order to achieve the above effect, Figure 2 As shown, the log writing phase may also include:
[0082] Step 250: When it is determined that the received service log is an error log, the service log is analyzed and processed to obtain a log analysis result of the service log.
[0083] In an embodiment of the present application, the log query system can determine whether the business log is an error log based on the log level of the business log. Schematically, the log level can be marked as FATAL (fatal error), ERROR (error), WARN (warning), INFO (information), DEBUG (debug), TRACE (tracing), ALL (all) and OFF (off), among which logs with log levels of FATAL, ERROR, and WARN can be determined as error logs.
[0084] In a possible implementation, the log query system may analyze and process the business log through a log analysis program to obtain a log analysis result of the business log, wherein the log analysis result of the business log includes at least one of the following: an associated link, log information of the associated link, and a suggested solution.
[0085] Corresponding to different log analysis results, different analysis processes may be performed on the business log to obtain corresponding analysis results. The business log is analyzed and processed to obtain the log analysis results of the business log, including at least one of the following:
[0086] Based on the log tracking identifier of the business log, the log link tracking is performed to obtain the associated link of the business log;
[0087] Log information of each business log in the associated link of the business log is used to form the log information of the associated link;
[0088] Based on the business log and the solutions of the historical error logs stored in the log database, a suggested solution corresponding to the business log is generated.
[0089] Among them, the log tracking identifier (trace_id) of the business log is a key field for identifying and associating a series of related log records, which can be implemented as a transaction ID, request ID, tracking ID, etc. Based on the log tracking identifier, log entries related to specific business operations or events can be screened out from massive logs. In an embodiment of the present application, the log analysis program can track the log sequence of system components and time points involved in the business operation corresponding to the business log from the beginning to the end by parsing the tracking identifier in the business log, thereby constructing a log link, that is, the association link corresponding to the business log.
[0090] After obtaining the association link of the business log, the log analysis program collects information of all logs involved in the association link and combines all relevant log information into log information of an association link for subsequent analysis and processing.
[0091] Furthermore, the log analysis program can also perform program analysis based on the solutions of historical error logs stored in the log database, find out the error logs in the log database that are the same or similar to the business log, and generate a suggested solution corresponding to the business log based on the solution of the error log in the log database. This process can be implemented as follows:
[0092] Determine a target log set from the historical error logs stored in the log database based on the business log; the target log set includes at least one historical error log whose similarity with the business log is higher than a similarity threshold;
[0093] Based on the solutions of each historical error log in the target log set, a suggested solution corresponding to the business log is generated.
[0094] Among them, the log analysis program can extract relevant information in the error log, such as timestamp, error information, stack trace, and user context information, so as to pre-process the error log into unstructured text; analyze and process the unstructured text corresponding to the error log to extract key detailed information and generate a summary of the error log, which contains important information in the error log; wherein the log analysis program can generate a summary through abstract or extractive summary technology to facilitate the subsequent identification of recurring patterns, common errors or abnormal situations; the log analysis program can be configured to train an anomaly detection model using historical error logs as training data, so as to identify and mark the abnormal type of the error log based on the error log (or the summary of the error log) through the trained anomaly detection model; further, the log analysis program can use a language model to perform contextual understanding based on the error log (or the summary of the error log) to obtain the cause of the abnormal situation corresponding to the error log, such as determining the environmental factors or code interactions that cause the error.
[0095] When determining historical error logs that are identical or similar to business logs, the log analysis program can compare the business logs with the various historical error logs in the log database, such as the exception type and / or the cause of the exception, and calculate the similarity between the business logs and the various historical error logs in the log database to determine the historical error logs that are identical or similar to the business logs and form a target log set.
[0096] In one possible implementation, the solution of a target error log in a target log set is determined as a recommended solution for the business log; the target error log is a historical error log in the target log set that has the highest similarity to the business log; that is, after determining the target log set, the log analysis program can determine the solution corresponding to the historical error log that has the highest similarity to the business log as the recommended solution for the business log.
[0097] Alternatively, in another possible implementation, the solutions to each historical error log in the target log set and solution generation indicators are input into the large language model to obtain a suggested solution corresponding to the business log output by the large language model; that is, the log analysis program generates a new suggested solution by synthesizing the solutions of historical error logs that are the same or similar to the business log through the large language model; illustratively, the solution generation indicator may be "please generate a solution based on the above content"; wherein the suggested solution may be a code snippet for code repair or may be relevant text indicating the direction of error resolution, and the present application does not limit this.
[0098] Step 260: Write the log analysis result into the business log.
[0099] In the case where the business log is an error log, by writing the log analysis results into the business log, during the log query phase, when the error log is queried based on the user's log query instructions, the log analysis results in the error log can be directly obtained, thereby shortening the process and time for relevant personnel to conduct exception investigation and / or solution formulation, and improving the efficiency of solving abnormal problems.
[0100] The code location method provided in the embodiment of the present application involves the interaction between the business system and the log query system, and the interaction between the user and the log query system. Figure 3 A schematic diagram showing a code location architecture corresponding to a code location method provided by an exemplary embodiment of the present application is shown. Figure 3As shown, the architecture includes a business system 310 and a log query system 320; the business system 310 is used to generate business logs; the log query system includes a log collection program, Logstash, a log analysis program, Elasticsearch, and Kibana; wherein the log collection program is used to collect the business logs generated by the business system 310 connected to the log query system 320, perform code repository information association matching, generate a code access path corresponding to the business log, and after writing the code access path to the business log, output it to the log processing component composed of Logstash and the log analysis program; Logstash in the log processing component is used to receive the business logs passed by the log collection program, and perform analysis based on the log level of the business log. Log screening is performed to determine the error logs with error levels in the business logs, and the error logs are sent to the log analysis program. The log analysis program is used to analyze and process the received error logs to obtain log analysis results, write the log analysis results into the error logs and return them to Logstash; Logstash sends the final processed business logs to Elasticsearch, which is used to store the received processed business logs and provide log retrieval and query capabilities to Kibana; Kibana is used to provide an analysis and visualization Web platform for Elasticsearch, which is used to search in the Elasticsearch index, interact with data, and generate tables and charts of various dimensions.
[0101] Figure 4 FIG. 1 shows an interactive schematic diagram of a code location architecture provided by an exemplary embodiment of the present application. Figure 4As shown, the business system prints the log data into the log file according to the log format defined by the log query system to obtain the business log; after the log collection program collects the business log, it queries the corresponding code warehouse information according to the business system identifier of the business log, and generates a code access path according to its code branch and the code warehouse indicated by the code warehouse information. After writing the code access path into the business log, the log collection program sends the processed business log to Logstash; if Logstash determines that the business log is an error log, it sends the error log to the log analysis program, and the log analysis program obtains the log analysis result after log analysis and writes it into the error log and returns it to Logstash. If Logstash determines that the business log is not an error log, it skips the processing of the log analysis program; Logstash sends the final business log to Elasticsearch for storage. Elasticsearch provides Kibana with log retrieval and query capabilities. Kibana provides Elasticsearch with an analysis and visualization interaction platform. Users input log query instructions based on the visualization interaction provided by Kibana. Kibana queries in Elasticsearch based on the received log query instructions to obtain the queried target log, and feeds the target log back to the user through Kibana.
[0102] Figure 5 A block diagram of a code location device provided by an exemplary embodiment of the present application is shown. The device can be applied in a log query system to perform the following steps: Figure 1 or Figure 2 All or part of the steps of the embodiment shown, such as Figure 5 As shown, the code positioning device includes:
[0103] The instruction receiving module 510 is used to receive the log query instruction;
[0104] The log feedback module 520 is used to query and feedback the target log based on the log query instruction; the target log includes log content and code access path; the code access path is used to link the code corresponding to the target log to the code location in the corresponding code repository;
[0105] The code locating module 530 is used to locate and display the code position of the code branch corresponding to the target log when receiving the selection operation corresponding to the code access path.
[0106] In a possible implementation, the log content of the business log includes a business system identifier and a code branch, and the device further includes:
[0107] An identification acquisition module is used to obtain the business system identification corresponding to the business log;
[0108] A query module, used to perform information query based on the business system identifier of the business log to obtain a query result;
[0109] A path generation module, configured to generate a code access path corresponding to the business log based on a code branch of the business log and the corresponding code repository information, when the query result indicates that the log query system contains code repository information corresponding to the business log;
[0110] The path adding module is used to write the code access path corresponding to the business log into the business log.
[0111] In a possible implementation manner, the device further includes:
[0112] An information receiving module, used to receive code repository information corresponding to the dynamic configuration of the business system;
[0113] The matching module is used to associate and match the business system identifier of the business system with the corresponding code repository information.
[0114] In a possible implementation, when the target log is an error log, the target log also includes a log analysis result, and the log analysis result includes at least one of the following: an associated link of the target log, log information of the associated link, and a suggested solution.
[0115] In a possible implementation manner, the device further includes:
[0116] An analysis module, configured to analyze and process the business log to obtain a log analysis result of the business log when determining that the received business log is an error log;
[0117] The result writing module is used to write the log analysis result into the business log.
[0118] In a possible implementation, the analysis module is used for at least one of the following:
[0119] Performing log link tracking based on the log tracking identifier of the business log to obtain an associated link of the business log;
[0120] Based on the log information of each business log in the associated link of the business log, the log information of the associated link is composed;
[0121] Based on the service log and the solutions of the historical error logs stored in the log database, a suggested solution corresponding to the service log is generated.
[0122] In a possible implementation, the analysis module includes:
[0123] A set determination submodule, configured to determine a target log set from the historical error logs stored in the log database based on the business log; the target log set includes at least one historical error log whose similarity to the business log is higher than a similarity threshold;
[0124] The solution generation submodule is used to generate a suggested solution corresponding to the business log based on the solution of each historical error log in the target log set.
[0125] In a possible implementation, the solution generation submodule is used to:
[0126] A solution of a target error log in a target log set is determined as a suggested solution for the service log; the target error log is a historical error log in the target log set that has the highest similarity to the service log.
[0127] In a possible implementation, the solution generation submodule is used to:
[0128] The solutions of each historical error log in the target log set and the solution generation indicator are input into the large language model to obtain the recommended solutions corresponding to the business log output by the large language model.
[0129] In a possible implementation, the code location module 530 is used to:
[0130] Locate and display the code position of the code branch corresponding to the target log in a target display mode; the target display mode includes at least one of the following: highlight rendering, identification box identification, bold font, enlarged font size and font color change.
[0131] In summary, the code location device provided by the embodiment of the present application is that when the log query system receives the log query instruction, it queries and feeds back the target log based on the log query instruction. In addition to the log content, the target log also contains a code access path for linking the code corresponding to the target log to the code location in the corresponding code warehouse, and then after receiving the selection operation based on the code access path, the code location of the code branch corresponding to the target log can be located and displayed. By adding the code access path to the business log, the log query system can be closely associated with the code warehouse, and then rapid location from the business log to the code can be achieved, which simplifies the code location process and improves the code location efficiency.
[0132] Figure 6The structural block diagram of a computer device 600 shown in an exemplary embodiment of the present application is shown. The computer device can be implemented as a log query system in the above scheme of the present application. The computer device 600 includes a central processing unit (CPU) 601, a system memory 604 including a random access memory (RAM) 602 and a read-only memory (ROM) 603, and a system bus 605 connecting the system memory 604 and the central processing unit 601. The computer device 600 also includes a large-capacity storage device 606 for storing an operating system 609, an application program 610 and other program modules 611.
[0133] Without loss of generality, the computer-readable medium may include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable instructions, data structures, program modules or other data. Computer storage media include RAM, ROM, Erasable Programmable Read Only Memory (EPROM), Electronically-Erasable Programmable Read-Only Memory (EEPROM) flash memory or other solid-state storage technology, CD-ROM, Digital Versatile Disc (DVD) or other optical storage, cassettes, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art will appreciate that the computer storage medium is not limited to the above. The above-mentioned system memory 604 and mass storage device 606 can be collectively referred to as memory.
[0134] According to various embodiments of the present disclosure, the computer device 600 can also be connected to a remote computer on the network through a network such as the Internet. That is, the computer device 600 can be connected to the network 608 through the network interface unit 607 connected to the system bus 605, or the network interface unit 607 can be used to connect to other types of networks or remote computer systems (not shown).
[0135] The memory also includes at least one instruction, at least one program, code set or instruction set, and the at least one instruction, at least one program, code set or instruction set is stored in the memory. The central processing unit 601 implements all or part of the steps in the code positioning method shown in the above-mentioned embodiments by executing the at least one instruction, at least one program, code set or instruction set.
[0136] In an exemplary embodiment, a computer-readable storage medium is also provided, in which at least one computer program is stored, and the computer program is loaded and executed by a processor to implement all or part of the steps in the above-mentioned code location method. For example, the computer-readable storage medium can be a read-only memory (ROM), a random access memory (RAM), a compact disc (CD-ROM), a magnetic tape, a floppy disk, an optical data storage device, etc.
[0137] In an exemplary embodiment, a computer program product is also provided, the computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, the computer program comprising program instructions, when the program instructions are executed by a computer, the computer is executed to implement the above Figure 1 or Figure 2 All or part of the steps of the code positioning method shown in any embodiment.
[0138] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the claims.
[0139] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A code positioning method, characterized in that: The method is performed by a log query system, and the method includes: Receive log query instructions; Based on the log query instruction, query and feedback the target log; the target log includes log content and code access path; the code access path is used to link the code corresponding to the target log to the code location in the corresponding code repository; When a selection operation corresponding to the code access path is received, a code position of a code branch corresponding to the target log is located and displayed.
2. The method according to claim 1, characterized in that The log content of the business log includes the business system identifier and code branch; The method further comprises: Get the business system ID corresponding to the business log; Performing information query based on the business system identifier of the business log to obtain query results; In a case where the query result indicates that the log query system contains code repository information corresponding to the business log, generating a code access path corresponding to the business log based on the code branch of the business log and the corresponding code repository information; The code access path corresponding to the business log is written into the business log.
3. The method according to claim 2, characterized in that The method further comprises: Receiving code repository information corresponding to the dynamic configuration of the business system; Associate and match the business system ID of the business system with the corresponding code repository information.
4. The method according to claim 1, characterized in that: In the case that the target log is an error log, the target log also includes a log analysis result, and the log analysis result includes at least one of the following: an associated link of the target log, log information of the associated link, and a suggested solution.
5. The method according to claim 4, characterized in that The method further comprises: In the case where it is determined that the received service log is an error log, analyzing and processing the service log to obtain a log analysis result of the service log; The log analysis result is written into the business log.
6. The method according to claim 5, characterized in that The analyzing and processing the business log to obtain a log analysis result of the business log includes at least one of the following: Performing log link tracking based on the log tracking identifier of the business log to obtain an associated link of the business log; Based on the log information of each business log in the associated link of the business log, the log information of the associated link is composed; Based on the service log and the solutions of the historical error logs stored in the log database, a suggested solution corresponding to the service log is generated.
7. The method according to claim 6, characterized in that The solution based on the business log and the historical error log stored in the log database generates a suggested solution corresponding to the business log, including: Determine a target log set from the historical error logs stored in the log database based on the business log; the target log set includes at least one historical error log whose similarity with the business log is higher than a similarity threshold; Based on the solutions of each historical error log in the target log set, a suggested solution corresponding to the business log is generated.
8. The method according to claim 7, characterized in that The solution based on each historical error log in the target log set generates a suggested solution corresponding to the business log, including: A solution of a target error log in a target log set is determined as a suggested solution for the service log; the target error log is a historical error log in the target log set that has the highest similarity to the service log.
9. The method according to claim 7, characterized in that: The solution based on each historical error log in the target log set generates a suggested solution corresponding to the business log, including: The solutions of each historical error log in the target log set and the solution generation indicator are input into the large language model to obtain the recommended solutions corresponding to the business log output by the large language model.
10. The method according to claim 1, characterized in that The locating and displaying the code position of the code branch corresponding to the target log includes: Locate and display the code position of the code branch corresponding to the target log in a target display mode; the target display mode includes at least one of the following: highlight rendering, identification box identification, bold font, enlarged font size and font color change.
