Parameter log printing method and device, equipment, medium and product

By receiving parameter log requests for the objective function and obtaining configuration information for each stage, determining the stage that meets the printing conditions and printing parameter logs, the problem of insufficient flexibility in parameter log printing in the prior art is solved, and the effect of quickly positioning online problems and reducing the burden on the log platform is achieved.

CN120123181APending Publication Date: 2025-06-10CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510280127.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-10
Publication Date
2025-06-10

AI Technical Summary

Technical Problem

The existing logging system cannot quickly locate the parameter logs that need to be viewed, resulting in insufficient flexibility in printing parameter logs.

Method used

By receiving the parameter log request for the objective function, the configuration information corresponding to each stage of the objective function is obtained, and the stage that meets the printing conditions is determined based on this information, and the corresponding parameters are printed into the log.

Benefits of technology

It realizes printing parameter logs on demand based on configuration information, improves the flexibility of parameter log printing, can quickly locate online problems, and reduces the burden on the log platform.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120123181A_ABST
    Figure CN120123181A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a parameter log printing method and device, equipment, a medium and a product, and belongs to the technical field of computers. The method comprises the following steps: receiving a parameter log request for a target function; in response to the parameter log request, obtaining first configuration information corresponding to each stage of the target function; wherein the first configuration information corresponding to each stage is used for determining whether the stage meets a printing condition or not; according to the first configuration information, determining a first stage of the target function meeting a printing condition; and printing the parameters corresponding to the first stage into the log to obtain a first parameter log corresponding to the target function. Thus, the first configuration information corresponding to each stage of the target function is obtained, condition judgment is performed in each stage of the target function, the first stage meeting the printing condition is obtained, and the parameter log is printed, so that the parameter log can be printed on demand based on the configuration information, and the flexibility of parameter log printing is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular, to a method, apparatus, device, medium, and product for printing parameter logs. Background Art

[0002] Parameter logs are of great significance to developers, and parameter logs can help developers quickly discover and locate online problems.

[0003] Currently, for existing logging systems, whether directly output from the local log file of the application or aggregated to the logging platform, it is necessary to print the log content to the logging system according to the log output code written in the code. When it is necessary to view the parameter logs of the target part, it is necessary to print all the logs based on the fixed code, and it is impossible to quickly locate the parameter logs that need to be viewed. Therefore, how to improve the flexibility of parameter log printing has become an urgent technical problem to be solved. Summary of the Invention

[0004] The main purpose of the embodiments of this application is to propose a method, apparatus, device, medium, and product for printing parameter logs, aiming to improve the flexibility of parameter log printing.

[0005] To achieve the above object, a first aspect of the embodiments of this application proposes a method for printing parameter logs, and the printing method includes:

[0006] Receiving a parameter log request for a target function;

[0007] In response to the parameter log request, obtaining first configuration information corresponding to each stage of the target function; wherein, the first configuration information corresponding to each stage is used to determine whether the stage meets the printing condition;

[0008] According to the first configuration information, determining a first stage in which the target function meets the printing condition;

[0009] Printing the parameters corresponding to the first stage into the log to obtain a first parameter log corresponding to the target function.

[0010] In some embodiments, after obtaining the first configuration information corresponding to each stage of the target function, the printing method further includes:

[0011] In the case where the configuration information corresponding to each stage of the target function is updated from the first configuration information to second configuration information, according to the second configuration information, determining a second stage in which the target function meets the printing condition;

[0012] Printing the parameters corresponding to the second stage into the log to obtain a second parameter log corresponding to the target function.

[0013] In some embodiments, the first configuration information includes first information;

[0014] The first stage of determining that the objective function satisfies the printing condition according to the first configuration information includes:

[0015] For any stage of the objective function, parsing the objective function at the stage to obtain second information corresponding to the first information of the objective function; the information type of the second information is the same as the information type of the first information;

[0016] Determine the first stage in which the objective function satisfies the printing condition according to the comparison result between the first information and the second information.

[0017] In some embodiments, the first stage of determining that the objective function satisfies the printing condition according to the comparison result between the first information and the second information includes:

[0018] When at least one item in the second information is the same as the corresponding information in the first information, determine that the stage of the objective function is the first stage that satisfies the printing condition.

[0019] In some embodiments, when the stage is the pre-execution stage of the objective function or the post-execution stage of the objective function, the first information and the second information include at least one of a method name, a class name, and a code package name;

[0020] When the stage is the in-execution stage of the objective function, the first information and the second information include at least one of a method name, a class name, a code package name, and an exception type.

[0021] In some embodiments, when the stage is the pre-execution stage of the objective function, the parameters corresponding to the stage include the input parameters of the objective function;

[0022] When the stage is the post-execution stage of the objective function, the parameters corresponding to the stage include the output parameters of the objective function;

[0023] When the stage is the in-execution stage of the objective function, the parameters corresponding to the stage include the input parameters of the objective function and exception information.

[0024] To achieve the above object, a second aspect of the embodiments of the present application proposes a printing device for parameter logs, and the device includes:

[0025] A receiving module, configured to receive a parameter log request for an objective function;

[0026] An acquisition module, configured to acquire first configuration information corresponding to each stage of the target function in response to the parameter log request; wherein, the first configuration information corresponding to each stage is used to determine whether the stage meets the printing condition;

[0027] A determination module, configured to determine a first stage in which the target function meets the printing condition according to the first configuration information;

[0028] A printing module, configured to print the parameters corresponding to the first stage into the log to obtain a first parameter log corresponding to the target function.

[0029] To achieve the above object, a third aspect of the embodiments of the present application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, it implements the parameter log printing method described in the first aspect above.

[0030] To achieve the above object, a fourth aspect of the embodiments of the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, it implements the parameter log printing method described in the first aspect above.

[0031] To achieve the above object, a fifth aspect of the embodiments of the present application provides a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is enabled to execute the parameter log printing method described in the first aspect above.

[0032] The parameter log printing method, device, equipment, medium and product provided by the present application receive a parameter log request for a target function, and in response to the parameter log request, acquire first configuration information corresponding to each stage of the target function; wherein, the first configuration information corresponding to each stage is used to determine whether the stage meets the printing condition. Then, according to the first configuration information, determine a first stage in which the target function meets the printing condition. Finally, print the parameters corresponding to the first stage into the log to obtain a first parameter log corresponding to the target function. In this way, by acquiring the first configuration information corresponding to each stage of the target function and performing condition judgment on each stage of the target function, a first stage that meets the printing condition is obtained and the parameter log is printed, so that it is possible to implement on-demand printing of the parameter log based on the configuration information and improve the flexibility of parameter log printing. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 is one of the flowcharts of the parameter log printing method provided by the embodiments of the present application;

[0034] Figure 2 is the flowchart of function execution provided by the embodiments of the present application;

[0035] Figure 3 is Figure 1 the flowchart of step S103 in

[0036] Figure 4 is the second flowchart of the method for printing parameter logs provided by the embodiments of the present application;

[0037] Figure 5 is the structural schematic diagram of the device for printing parameter logs provided by the embodiments of the present application;

[0038] Figure 6 is the hardware structural schematic diagram of the electronic device provided by the embodiments of the present application. Detailed implementation manners

[0039] In order to make the objectives, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0040] It should be noted that although functional module division is performed in the device schematic diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order from the module division in the device or the order in the flowchart. Terms such as "first" and "second" in the specification, claims and the above-mentioned drawings are used to distinguish similar objects and do not necessarily need to describe a specific order or sequence.

[0041] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those skilled in the technical field to which the present application belongs. The terms used herein are only for the purpose of describing the embodiments of the present application and are not intended to limit the present application.

[0042] First, several nouns involved in the present application are analyzed:

[0043] Artificial intelligence (AI): It is a new technical science that studies, develops theories, methods, technologies and application systems for simulating, extending and expanding human intelligence; artificial intelligence is a branch of computer science. Artificial intelligence attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a way similar to human intelligence. The research in this field includes robots, speech recognition, image recognition, natural language processing and expert systems, etc. Artificial intelligence can simulate the information process of human consciousness and thinking. Artificial intelligence also uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results of theories, methods, technologies and application systems.

[0044] Natural Language Processing (NLP): NLP uses computers to process, understand, and apply human languages (such as Chinese, English, etc.). NLP is a branch of artificial intelligence and an interdisciplinary field of computer science and linguistics, and is often referred to as computational linguistics. Natural language processing includes syntactic analysis, semantic analysis, discourse understanding, etc. Natural language processing is commonly used in technical fields such as machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, information intent recognition, information extraction and filtering, text classification and clustering, public opinion analysis, and opinion mining. It involves data mining, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research related to language processing, and linguistic research related to language computing, etc.

[0045] Information Extraction: A text processing technology that extracts factual information such as entities, relationships, events of a specified type from natural language texts and forms structured data for output. Information extraction is a technology for extracting specific information from text data. Text data is composed of some specific units, such as sentences, paragraphs, and passages. Text information is exactly composed of some small specific units, such as characters, words, phrases, sentences, paragraphs, or combinations of these specific units. Extracting noun phrases, personal names, place names, etc. from text data are all text information extraction. Of course, the information extracted by text information extraction technology can be various types of information.

[0046] Image Caption generates a natural language description for an image and uses the generated description to help an application understand the semantics expressed in the visual scene of the image. For example, image captioning can convert image retrieval into text retrieval, be used for classifying images, and improving image retrieval results. People can usually describe the details of the visual scene of an image just by quickly glancing at it, while automatically adding a description to an image is a comprehensive and difficult computer vision task that requires converting the complex information contained in the image into a natural language description. Compared with ordinary computer vision tasks, image captioning not only needs to identify objects in the image, but also needs to associate the identified objects with natural semantics and describe them in natural language. Therefore, image captioning requires people to extract the deep features of the image, associate them with semantic features, and convert them for generating a description.

[0047] Based on this, the embodiments of the present application provide a method, apparatus, device, medium, and product for printing parameter logs, aiming to improve the flexibility of parameter log printing.

[0048] The method, apparatus, device, medium, and product for printing parameter logs provided by the embodiments of the present application will be specifically described through the following embodiments. First, the method in the embodiments of the present application will be described.

[0049] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, Artificial Intelligence (AI) is a theory, method, technology, and application system that uses digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use knowledge to obtain the best results.

[0050] Artificial intelligence basic technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation / interaction systems, and mechatronics. Artificial intelligence software technologies mainly include several major directions such as computer vision technology, robotics, biometric technology, speech processing technology, natural language processing technology, and machine learning / deep learning.

[0051] The method for printing parameter logs provided by the embodiments of the present application relates to the field of artificial intelligence technology. The method for printing parameter logs provided by the embodiments of the present application can be applied to an electronic device or the software of an electronic device. The electronic device can be a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, etc.; the server side can be configured as an independent physical server, or can be configured as a server cluster or distributed system composed of multiple physical servers, or can also be configured as a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application that implements the method for printing parameter logs, etc., but is not limited to the above forms.

[0052] This application can be used in numerous general-purpose or special-purpose computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multi-processor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments including any of the above systems or devices, and so on. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. This application can also be practiced in a distributed computing environment where tasks are executed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.

[0053] It should be noted that in each specific embodiment of this application, when it comes to performing relevant processing based on data related to the user's identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first. Moreover, the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when an embodiment of this application needs to obtain the user's sensitive personal information, the user's separate permission or separate consent will be obtained through methods such as pop-up windows or redirecting to a confirmation page. After clearly obtaining the user's separate permission or separate consent, the necessary user-related data for the normal operation of the embodiment of this application will be obtained.

[0054] Please refer to Figure 1 , which is one of the optional flowcharts of the method for printing parameter logs provided by an embodiment of this application. This method is applied to an electronic device. Figure 1 The method in

[0055] Step S101, receive a parameter log request for the target function.

[0056] In an embodiment of this application, the target function can be understood as the function for which parameter logs are to be printed. A function can be understood as a program, and essentially, the execution of all programs is a function. A parameter log can be understood as a log that records the parameter values and related information used by a function during its operation. Parameter logs are of great significance to developers, as they can help developers quickly discover and locate online problems. When a user needs to view the parameter logs of the target function, a parameter log request for the target function can be initiated. In one example, the user can send a parameter log request for the target function to the electronic device through a client, and the client can include, but is not limited to, browsers and applications, etc.

[0057] Step S102, in response to the parameter log request, obtain the first configuration information corresponding to each stage of the target function; wherein, the first configuration information corresponding to each stage is used to determine whether the stage meets the printing condition.

[0058] In the embodiments of the present application, the target function may include multiple stages, such as the pre-execution stage, the in-execution stage, and the post-execution stage. The pre-execution stage can be understood as the stage before the target function starts to execute; the in-execution stage can be understood as the execution process of the target function; the post-execution stage can be understood as the stage after the target function finishes executing.

[0059] In the embodiments of the present application, the first configuration information can be understood as the information used to determine whether the stage meets the printing condition, that is, the information used to determine each stage of the target function to be printed. In one example, the first configuration information may include at least one of the code package name, class name, method name, and exception type of the target function. Among them, the method name can be understood as the identifier of the target function, used to describe the function of the method. The class name can be understood as the identifier of a class, usually used to represent an object or an abstract data type. The code package name can be understood as used to organize class files, usually a collection containing multiple classes. In terms of the scope size, the scope of the code package is larger than the scope of the class, and the scope of the class is larger than the scope of the method.

[0060] In the embodiments of the present application, the first configuration information can be obtained in real time based on user input, or obtained from a preset information library. The first configuration information can be configured through database configuration, or through third-party configuration centers and application configuration files, etc. In the case where the application has been started, the user can also modify the first configuration information in real time.

[0061] In the embodiments of the present application, the target function has corresponding first configuration information in each stage, and among them, the first configuration information of each stage can be the same or different. In one example, in the pre-execution stage and the post-execution stage of the target function, the first configuration information can both include the method name, class name, and code package name of the target function; in the in-execution stage of the target function, the first configuration information can include the method name, class name, code package name, and exception type of the target function.

[0062] Step S103, according to the first configuration information, determine the first stage in which the target function meets the printing condition.

[0063] In the embodiments of the present application, the first stage can be understood as the stage that meets the printing condition among the stages of the target function. Among them, the first stage can include one stage or multiple stages.

[0064] After obtaining the first configuration information corresponding to each stage of the target function, determine the first stage that meets the printing condition from each stage of the target function according to the first configuration information. In one example, when determining the first stage, first parse the target function based on the first information included in the first configuration information to obtain the second information of the target function, where the information types included in the first information and the second information are the same, and the second information of the target function obtained by parsing corresponds one-to-one with the first information of the target function. Then, compare the first information with the second information. When at least one item in the second information is the same as the corresponding information in the first information, the current stage of the target function can be determined as the first stage that meets the printing condition.

[0065] Step S104, print the parameters corresponding to the first stage to the log to obtain the first parameter log corresponding to the target function.

[0066] In the embodiments of the present application, the first stage is the stage where parameter printing is required. After determining the first stage, print the parameters corresponding to the first stage to the log to obtain the first parameter log corresponding to the target function. Please refer to Figure 2 , which is a flowchart of the function execution provided by the embodiments of the application. The function has input parameters in the pre-execution stage; has output parameters in the post-execution stage; and there may be exception information during the execution, that is, it has input parameters and exception information in the in-execution stage. In one example, when the first stage includes the pre-execution stage, the parameters corresponding to the first stage include the input parameters. In another example, when the first stage includes the in-execution stage and the post-execution stage, the parameters corresponding to the first stage include the input parameters, exception information, and output parameters.

[0067] Steps S101 to S104 illustrated in the embodiments of the present application receive a parameter log request for the target function and, in response to the parameter log request, obtain the first configuration information corresponding to each stage of the target function; where the first configuration information corresponding to each stage is used to determine whether the stage meets the printing condition. Then, according to the first configuration information, determine the first stage of the target function that meets the printing condition. Finally, print the parameters corresponding to the first stage to the log to obtain the first parameter log corresponding to the target function. In this way, by obtaining the first configuration information corresponding to each stage of the target function and performing condition judgment on each stage of the target function, the first stage that meets the printing condition is obtained and the parameter log is printed, so that it is possible to implement on-demand printing of the parameter log based on the configuration information and improve the flexibility of parameter log printing.

[0068] In some embodiments, after obtaining the first configuration information corresponding to each stage of the target function, the printing method further includes:

[0069] When the configuration information corresponding to each stage of the objective function is updated from the first configuration information to the second configuration information, determine, according to the second configuration information, a second stage at which the objective function satisfies the printing condition;

[0070] Print the parameters corresponding to the second stage to a log to obtain a second parameter log corresponding to the objective function.

[0071] Specifically, the first configuration information can be obtained in real time based on user input or from a preset information library, that is, the first configuration information can be changed through dynamic configuration. Dynamic configuration can be understood as performing aspect-oriented programming on the objective function, and the steps or information in the aspect can be configured at each stage of the objective function. For example, the implementation methods of dynamic configuration can include, but are not limited to, database configuration, third-party configuration center configuration, and application configuration file configuration, etc.

[0072] In the embodiments of the present application, when other parameter logs need to be printed, the content of the parameter logs to be printed can be changed by modifying the first configuration information.

[0073] In the embodiments of the present application, when the configuration information corresponding to each stage of the objective function is updated from the first configuration information to the second configuration information, the second stage at which the objective function satisfies the printing condition can be determined according to the second configuration information, and the parameters corresponding to the second stage can be printed to a log to obtain a second parameter log corresponding to the objective function.

[0074] In this embodiment, by using dynamic configuration, it is convenient for developers to perform on-demand configuration, and it can be realized that when the application has been started, without modifying the code, by modifying the dynamic configuration information, the function of dynamically printing parameter logs on demand can be realized.

[0075] Please refer to Figure 3 , in some embodiments, the first configuration information includes first information, and step S103 may include, but is not limited to, steps S301 to S302:

[0076] Step S301, for any stage of the objective function, parse the objective function at the stage to obtain second information corresponding to the first information of the objective function; the information type of the second information is the same as the information type of the first information;

[0077] Step S302, determine a first stage at which the objective function satisfies the printing condition according to the comparison result of the first information and the second information.

[0078] Specifically, the first configuration information can be understood as the information used to determine whether the phase meets the printing condition, that is, the information for determining each phase of the printing objective function. The first configuration information may include first information. For different phases of the objective function, the first information may be the same or different. In one example, when the phase is the pre-execution phase or the post-execution phase, the first information may include at least one of the method name, class name, and code package name of the objective function; when the phase is the in-execution phase, the first information may include at least one of the method name, class name, code package name, and exception type of the objective function. The method name can be understood as the identifier of the objective function, used to describe the function of the method. The class name can be understood as the identifier of a class, usually used to represent an object or an abstract data type. The code package name can be understood as being used to organize class files, usually a collection containing multiple classes. In terms of the scope size, the scope of the code package is larger than the scope of the class, which is larger than the scope of the method.

[0079] In the embodiments of the present application, for any phase of the objective function, the objective function can be parsed based on the first information to obtain the second information of the objective function, where the second information of the objective function obtained by parsing corresponds one-to-one with the first information of the objective function. The information type of the second information is the same as the information type of the first information. For example, the first information includes the method name, class name, and code package name of the configured objective function, and the second information includes the method name, class name, and code package name of the parsed objective function.

[0080] In the embodiments of the present application, the first information and the second information are compared. When at least one item in the second information is the same as the corresponding information in the first information, the current phase of the objective function can be determined as the first phase that meets the printing condition. For example, if the method name of the objective function configured in the first information is the same as the method name of the parsed objective function in the second information, the current phase is determined as the first phase.

[0081] In this embodiment, by parsing the objective function and determining the first phase based on the second information obtained after parsing, the phase where the parameter to be printed is located can be accurately positioned, improving the accuracy of parameter log printing.

[0082] In some embodiments, determining the first phase in which the objective function meets the printing condition according to the comparison result of the first information and the second information includes:

[0083] When at least one item in the second information is the same as the corresponding information in the first information, determining the phase of the objective function as the first phase that meets the printing condition.

[0084] Specifically, the first information can be understood as the information included in the first configuration information. The second information can be understood as the information obtained by parsing the objective function based on the first information. The information types of the first information and the second information each include at least one type of information, and the information types of the first information and the second information are the same. After obtaining the first information and the second information, the first information and the second information are compared. When at least one item in the second information is the same as the corresponding information in the first information, it is determined that the current stage of the objective function is the first stage that meets the printing condition.

[0085] In one example, in the pre-execution stage of the objective function, the first information includes the configured code package name, class name, and method name, and the second information includes the code package name, class name, and method name of the objective function. When at least one of the code package name, class name, and method name of the objective function is the same as the configured code package name, class name, and method name, it is determined that the pre-execution stage of the objective function is the first stage that meets the printing condition.

[0086] In the embodiments of the present application, when all items in the second information are different from the corresponding information in the first information, it is determined that the stage of the objective function does not meet the printing condition. In one example, in the pre-execution stage of the objective function, the first information includes the configured code package name, class name, and method name, and the second information includes the code package name, class name, and method name of the objective function. When each of the code package name, class name, and method name of the objective function is different from the configured code package name, class name, and method name, it is determined that the pre-execution stage of the objective function does not meet the printing condition.

[0087] In this embodiment, by comparing the first information and the second information, the stage where the parameter to be printed is located can be accurately positioned, improving the accuracy of parameter log printing.

[0088] In some embodiments, when the stage is the pre-execution stage or the post-execution stage of the objective function, the first information and the second information include at least one of the method name, class name, and code package name;

[0089] When the stage is the execution stage of the objective function, the first information and the second information include at least one of the method name, class name, code package name, and exception type.

[0090] Specifically, the objective function includes multiple stages, such as the pre-execution stage, the in-execution stage, and the post-execution stage. The pre-execution stage can be understood as the stage before the objective function starts to execute; the in-execution stage can be understood as the execution process of the objective function; the post-execution stage can be understood as the stage after the objective function finishes execution. The method name can be understood as the identifier of the objective function, used to describe the function of the method. The class name can be understood as the identifier of a class, usually used to represent an object or an abstract data type. The code package name can be understood as being used to organize class files, usually a collection containing multiple classes. In terms of the scope size, the scope of the code package is greater than the scope of the class, which is greater than the scope of the method.

[0091] In the embodiments of the present application, in both the pre-execution stage and the post-execution stage of the objective function, the objective function can be parsed according to the dimension of the scope size to obtain the method name, class name, and code package name of the objective function. That is, the first information and the second information include at least one of the method name, class name, and code package name.

[0092] In the embodiments of the present application, in the in-execution stage of the objective function, in addition to parsing the objective function according to the dimension of the scope size, the objective function can also be parsed based on the dimension of the thrown exception type, that is, the first information and the second information include at least one of the method name, class name, code package name, and exception type.

[0093] In this embodiment, by printing the input parameters of the objective function and the exception information when an exception is thrown, it can help locate the problems in most exception scenarios that have occurred and are difficult to reproduce.

[0094] In this embodiment, by parsing the objective function in different stages respectively, the stage where the parameter to be printed is located can be accurately positioned, improving the accuracy of parameter log printing.

[0095] In some embodiments, when the stage is the pre-execution stage of the objective function, the parameters corresponding to the stage include the input parameters of the objective function;

[0096] When the stage is the post-execution stage of the objective function, the parameters corresponding to the stage include the output parameters of the objective function;

[0097] When the stage is the in-execution stage of the objective function, the parameters corresponding to the stage include the input parameters of the objective function and the exception information.

[0098] Specifically, please refer to Figure 2 , which is the flowchart of function execution provided by the embodiments of the application. The function has input parameters in the pre-execution stage. The input parameters can be understood as the parameters input to the objective function before the objective function starts to execute.

[0099] In the embodiments of the present application, there are output parameters in the post - execution stage. The output parameters can be understood as the parameters output by the objective function after execution is completed.

[0100] In the embodiments of the present application, there may be exception information during execution, that is, there are input parameters and exception information in the in - execution stage. The exception information can be understood as the information thrown when the objective function goes wrong.

[0101] In one example, take the objective function as the devide function. The input parameters are two numerical parameters a and b that need to be divided, and the output parameter result is the result of their division.

[0102] In this embodiment, by determining the parameters corresponding to each stage of the function, the accuracy of parameter log printing can be improved.

[0103] In the embodiments of the present application, for an application running stably online, if it is necessary to troubleshoot online problems, the printing of the input parameters and output parameters of the objective function can be determined through dynamic configuration. Since the logs to be viewed can be dynamically determined, in the coding stage, there is no need to add excessive logs for subsequent problem - location. Without the interference of excessive useless information, the root cause of online problems can be quickly located, improving the efficiency of code writing. At the same time, since the logs to be viewed can be dynamically determined and there is no need to print fixed invalid logs, the burden on the log platform is also reduced, the storage cost of the log platform is lowered, and the working efficiency of the log platform is improved.

[0104] In the embodiments of the present application, when an exception occurs during the function running process, by configuring the conditions for the input parameters and exception information that must be printed when an exception is thrown, it can help to locate the problems in most exception scenarios that have occurred and are difficult to reproduce.

[0105] The method for printing parameter logs provided by the embodiments of the present application can be applied to most business scenarios with large transaction volumes, high repeatability, and the need to quickly discover problems, such as daily payment, order transactions, product inventory management, etc.

[0106] The printing method, device, equipment, medium and product of the parameter log proposed in the present application receive a parameter log request for a target function, and in response to the parameter log request, obtain the first configuration information corresponding to each stage of the target function; wherein the first configuration information corresponding to each stage is used to determine whether the stage meets the printing condition. Then, according to the first configuration information, the first stage of the target function that meets the printing condition is determined. Finally, the parameters corresponding to the first stage are printed into the log to obtain the first parameter log corresponding to the target function. In this way, by obtaining the first configuration information corresponding to each stage of the target function and performing conditional judgment on each stage of the target function, the first stage that meets the printing condition is obtained and the parameter log is printed, so that the parameter log can be printed on demand based on the configuration information, thereby improving the flexibility of parameter log printing.

[0107] See also Figure 4 , is the second optional flow chart of the method for printing a parameter log provided in the embodiment of the present application. Figure 4 As shown, take the target function as the devide function as an example. The input parameters are the two numeric parameters a and b that need to be divided, and the output parameter result is the result of the division between the two. The client first initiates a request to the web application where the function devide is located. The web application can correspond to one or more functions. When there are multiple functions, the request needs to carry relevant information of the devide function. The client may include but is not limited to browsers and applications. In an embodiment of the present application, the request initiated by the client also includes an interface request for calling the interface. After receiving the request initiated by the client, the configured condition information is obtained from the third-party data source redis database. Developers can dynamically modify the configured condition information as needed. After obtaining the condition information, the devide function is compared with the condition information, and the parameters that meet the conditions are printed to the log system to obtain the parameter log. Developers can locate online problems through the parameter log.

[0108] In an embodiment of the present application, by performing aspect programming at each stage of the devide function, all functions can be matched through configuration rules for aspect weaving, and then the required logs can be filtered according to the conditions for printing, without intruding into the business logic or doing additional code development. That is, parameter printing can be positioned at each stage of function execution, and the position of the parameters to be printed can be accurately located, thereby improving the accuracy of the parameters.

[0109] In an embodiment of the present application, by dynamically modifying the configuration information, the printing results of the input parameters and output parameters of the objective function are determined. There is no need to print too much useless information or print fixed invalid logs. This can reduce the burden on the log platform, reduce the storage cost of the log platform, quickly locate the root cause of online problems, and improve the work efficiency of the log platform.

[0110] Please refer to Figure 5 , an embodiment of the present application further provides a printing device for parameter logs, which can implement the above-mentioned method for printing parameter logs. The device includes:

[0111] A receiving module, configured to receive a parameter log request for a target function;

[0112] An obtaining module, configured to obtain first configuration information corresponding to each stage of the target function in response to the parameter log request; wherein, the first configuration information corresponding to each stage is used to determine whether the stage meets the printing condition;

[0113] A determining module, configured to determine a first stage in which the target function meets the printing condition according to the first configuration information;

[0114] A printing module, configured to print the parameters corresponding to the first stage to a log to obtain a first parameter log corresponding to the target function.

[0115] In an embodiment of the present application, when a user needs to view the parameter log of a target function, a parameter log request for the target function is initiated. The receiving module receives the parameter log request for the target function.

[0116] In an embodiment of the present application, the obtaining module obtains the first configuration information corresponding to each stage of the target function in response to the parameter log request. Each stage may include a pre-execution stage, an in-execution stage, and a post-execution stage of the target function. The target function has corresponding first configuration information in each stage, and the first configuration information of each stage may be the same or different. In one example, in the pre-execution stage and the post-execution stage of the target function, the first configuration information may include the method name, class name, and code package name of the target function; in the in-execution stage of the target function, the first configuration information may include the method name, class name, code package name, and exception type of the target function. The method name can be understood as an identifier of the target function, used to describe the function of the method. The class name can be understood as an identifier of a class, usually used to represent an object or an abstract data type. The code package name can be understood as used to organize class files, usually a collection containing multiple classes. In terms of the scope size, the scope of the code package is greater than the scope of the class which is greater than the scope of the method.

[0117] In an embodiment of the present application, after obtaining the first configuration information, the determination module determines, according to the first configuration information, the first stage in which the objective function meets the printing condition. When determining the first stage, the first stage that meets the printing condition is determined from each stage of the objective function according to the first configuration information. In one example, when determining the first stage, the objective function is first parsed based on the first information included in the first configuration information to obtain second information, where the information types included in the first information and the second information are the same. Then, based on the comparison between the first information and the second information, when at least one item in the second information is the same as the corresponding information in the first information, the current stage of the objective function can be determined as the first stage that meets the printing condition.

[0118] In an embodiment of the present application, the first stage is the stage where parameter printing is required. After determining the first stage, the printing module prints the parameters corresponding to the first stage to the log to obtain the first parameter log corresponding to the objective function.

[0119] The parameter log printing device shown in the embodiment of the present application receives, through the receiving module, a parameter log request for the objective function, and in response to the parameter log request, obtains, through the obtaining module, the first configuration information corresponding to each stage of the objective function; where the first configuration information corresponding to each stage is used to determine whether the stage meets the printing condition. Then, according to the first configuration information, the determination module determines the first stage in which the objective function meets the printing condition. Finally, through the printing module, the parameters corresponding to the first stage are printed to the log to obtain the first parameter log corresponding to the objective function. In this way, by obtaining the first configuration information corresponding to each stage of the objective function and performing condition judgment on each stage of the objective function, the first stage that meets the printing condition is obtained and the parameter log is printed, so that it is possible to achieve on-demand printing of the parameter log based on the configuration information and improve the flexibility of parameter log printing.

[0120] The embodiment of the present application also provides an electronic device. The electronic device includes a memory and a processor. The memory stores a computer program, and when the processor executes the computer program, the above-mentioned parameter log printing method is implemented. The electronic device can be any intelligent terminal including a tablet computer, an in-vehicle computer, etc.

[0121] Please refer to Figure 6 , Figure 6 which shows the hardware structure of an electronic device in another embodiment. The electronic device includes:

[0122] The processor 601 can be implemented in ways such as a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;

[0123] The memory 602 can be implemented in forms such as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 602 can store an operating system and other application programs. When implementing the technical solutions provided in the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 602 and are called by the processor 601 to execute the parameter log printing method of the embodiments of the present application;

[0124] The input / output interface 603 is used to implement information input and output;

[0125] The communication interface 604 is used to implement communication interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.);

[0126] The bus 605 transmits information between various components of the device (such as the processor 601, the memory 602, the input / output interface 603, and the communication interface 604);

[0127] Among them, the processor 601, the memory 602, the input / output interface 603, and the communication interface 604 achieve communication connections with each other inside the device through the bus 605.

[0128] The embodiments of the present application also provide a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the above-mentioned parameter log printing method is implemented.

[0129] The memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, a flash memory device, or other non-transitory solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor through a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0130] The embodiments of the present application also provide a computer program product. When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device is caused to execute the method for printing parameter logs as described above.

[0131] Generally, when the code in an application is fixed and the log level configuration is fixed, the information that the log system can see is basically fixed. If there is a lot of code for printing logs or the configured log level is low, it will cause too much output information in the log system, resulting in a large waste of storage space, slow log search, interference with valid logs when viewing, etc. If there is little code for printing logs or the configured log level is high, it will lead to problems in production. Key log information may not be printed at the code layer, resulting in the inability to view key information, making it difficult to troubleshoot problems. To locate problems, it is necessary to add code again and redeploy the application, which is a cumbersome and inefficient process.

[0132] The method, device, equipment, medium, and product for printing parameter logs proposed in the present application receive a parameter log request for a target function, and in response to the parameter log request, obtain first configuration information corresponding to each stage of the target function; wherein, the first configuration information corresponding to each stage is used to determine whether the stage meets the printing condition. Then, according to the first configuration information, determine the first stage in which the target function meets the printing condition. Finally, print the parameters corresponding to the first stage into the log to obtain the first parameter log corresponding to the target function. In this way, by obtaining the first configuration information corresponding to each stage of the target function and performing a conditional judgment on each stage of the target function, the first stage that meets the printing condition is obtained and the parameter log is printed, so that it is possible to print parameter logs on demand based on the configuration information, improving the flexibility of parameter log printing.

[0133] The embodiments described in the embodiments of the present application are for more clearly explaining the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. Those skilled in the art can know that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.

[0134] Those skilled in the art can understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than those shown in the figures, or combine some steps, or different steps.

[0135] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0136] Those of ordinary skill in the art can understand that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, and their appropriate combinations.

[0137] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product, or device that comprises a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.

[0138] It should be understood that in the present application, "at least one (item)" means one or more, and "a plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and both A and B exist at the same time. Among them, A and B can be singular or plural. The character " / " generally means that the associated objects before and after are in an "or" relationship. "At least one (one) of the following" or a similar expression means any combination of these items, including any combination of single items (ones) or plural items (ones). For example, at least one (one) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.

[0139] In several embodiments provided by the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the above-mentioned units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed couplings or direct couplings or communication connections to each other can be through some interfaces. The indirect couplings or communication connections of devices or units can be in electrical, mechanical or other forms.

[0140] The units described above as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0141] In addition, in each embodiment of the present application, the functional units can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

[0142] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes multiple instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods in each embodiment of the present application. The foregoing storage medium includes: various media that can store programs such as USB flash drives, mobile hard disks, read-only memories (ROM for short), random access memories (RAM for short), magnetic disks, or optical discs.

[0143] The preferred embodiments of the embodiments of the present application have been described above with reference to the accompanying drawings. However, this does not limit the scope of the rights of the embodiments of the present application. Any modifications, equivalent replacements, and improvements made by those skilled in the art without departing from the scope and essence of the embodiments of the present application shall fall within the scope of the rights of the embodiments of the present application.

Claims

1. A method for printing a parameter log, characterized in that: The printing method comprises: Receive a parameter log request for the target function; In response to the parameter log request, obtaining first configuration information corresponding to each stage of the objective function; wherein the first configuration information corresponding to each stage is used to determine whether the stage meets the printing condition; Determine, according to the first configuration information, a first stage in which the objective function satisfies a printing condition; The parameters corresponding to the first stage are printed into the log to obtain the first parameter log corresponding to the objective function.

2. The printing method according to claim 1, characterized in that: After obtaining the first configuration information corresponding to each stage of the objective function, the printing method further includes: When the configuration information corresponding to each stage of the objective function is updated from the first configuration information to the second configuration information, determining, according to the second configuration information, a second stage in which the objective function satisfies a printing condition; The parameters corresponding to the second stage are printed into the log to obtain the second parameter log corresponding to the objective function.

3. The printing method according to claim 1, characterized in that: The first configuration information includes first information; The first stage of determining, according to the first configuration information, that the objective function satisfies the printing condition comprises: For any stage of the objective function, the objective function is parsed at the stage to obtain second information of the objective function corresponding to the first information; the information type of the second information is the same as the information type of the first information; According to the comparison result of the first information and the second information, it is determined that the first stage in which the objective function satisfies the printing condition.

4. The printing method according to claim 3, characterized in that: The first stage of determining, based on the comparison result of the first information and the second information, that the objective function satisfies the printing condition comprises: In a case where at least one item in the second information is identical to corresponding information in the first information, the stage of the objective function is determined to be the first stage that satisfies the printing condition.

5. The printing method according to claim 3, characterized in that: In a case where the stage is a pre-execution stage of the target function or a post-execution stage of the target function, the first information and the second information include at least one of a method name, a class name, and a code package name; In a case where the stage is an execution stage of the target function, the first information and the second information include at least one of a method name, a class name, a code package name, and an exception type.

6. The printing method according to claim 1, characterized in that: In the case where the stage is a pre-execution stage of the objective function, the parameters corresponding to the stage include input parameters of the objective function; In the case where the stage is a post-execution stage of the objective function, the parameters corresponding to the stage include output parameters of the objective function; In the case where the stage is an execution stage of the objective function, the parameters corresponding to the stage include input parameters and exception information of the objective function.

7. A parameter log printing device, characterized in that: The printing device comprises: A receiving module, used for receiving a parameter log request for a target function; An acquisition module, configured to acquire, in response to the parameter log request, first configuration information corresponding to each stage of the objective function; wherein the first configuration information corresponding to each stage is used to determine whether the stage meets the printing condition; A determination module, configured to determine, according to the first configuration information, a first stage in which the objective function satisfies a printing condition; The printing module is used to print the parameters corresponding to the first stage into a log to obtain a first parameter log corresponding to the objective function.

8. An electronic device, characterized in that: The electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the parameter log printing method according to any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the method for printing a parameter log according to any one of claims 1 to 6 is implemented.

10. A computer program product, characterized in that When the instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes the method for printing a parameter log according to any one of claims 1 to 6.