Database application log level modification method and device, electronic equipment and storage medium

By adjusting the log level online, the problem of inconvenient log level modification in Spring Boot applications in production environments is solved, enabling rapid problem location.

CN120849220BActive Publication Date: 2025-12-12TIANJIN NANKAI UNIV GENERAL DATA TECH
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511341458.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-19
Publication Date
2025-12-12
Estimated Expiration
2045-09-19

AI Technical Summary

Technical Problem

After a Spring Boot application is deployed, some functions of the application may not function properly, leading to production incidents. Traditional methods of modifying log levels are time-consuming and disruptive to the production environment, and cannot quickly locate the problem.

Method used

By determining the first instruction, calling an independent first program package, recording and modifying the log level in real time, simulating operation scenarios to verify the effect of the modification, and realizing online log level adjustment.

Benefits of technology

Obtain detailed log information without affecting application operation, quickly locate problems, reduce downtime, avoid application restarts, and reduce performance overhead.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120849220B_ABST
    Figure CN120849220B_ABST
Patent Text Reader

Abstract

The application discloses a database application log level modification method and device, electronic equipment and a storage medium. The method comprises the following steps: determining a first instruction; calling a first program according to the first instruction; and modifying a first log level according to the first program. The method can modify the log level of the first log through the first program, acquire detailed log information without affecting the running of the application program, and thus confirm the running of the application program.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of database application, and particularly relates to a database application log level modification method and device, electronic equipment and a storage medium. BACKGROUND

[0002] When a SpringBoot application is deployed in a production environment, part of the functions of the program cannot normally run due to internal logical relations of the program, which may cause production accidents. When the problem occurs, it is very important to quickly locate and solve the problem. Most problems in the application program can be truly located only when the program is running. And for database-based application programs, stopping the service will cause very serious consequences. In the process of locating the problem, the output log of the program is a crucial point for troubleshooting. The more detailed the output log of the program, the more beneficial it is for troubleshooting. When the application program is deployed to the production environment, in order to reduce the output of the log and reduce the disk space occupied by the log of the server, the log level is often set to be very high. When the log level needs to be modified for more detailed troubleshooting, the traditional method is to stop the application program, then modify the log level in the program configuration file, and finally restart the application program and troubleshoot the problem. This method not only destroys the production environment but also is very time-consuming when troubleshooting some problems that need a long time to reproduce. SUMMARY

[0003] The present application provides a database application log level modification method and device, electronic equipment and a storage medium to solve the problem of inconvenient log level modification.

[0004] According to an aspect of the present application, a database application log level modification method is provided, comprising:

[0005] determining a first instruction; the first instruction is used to instruct to modify a first log level, and the first instruction contains a first identifier and a first level; the first log level is the log level of an application log which needs to be modified; the first identifier is used to represent the name of a data packet corresponding to the first log; and the first level is the log level to which the first log needs to be modified;

[0006] According to the first instruction, a first program is called; the first program is configured with a first program layer and a second program layer; the first program layer is composed of a first file and a second file; the first file is used to generate an execution path according to the first identifier and the first level; the second file is used to execute the execution path generated by the first file and modify the first log level; the execution path is a specific sequence of a series of statements, instructions or function calls experienced by the first program from the beginning to the end in the running process; the second program layer records the change of the first log level and the processing process of the first program in real time when the first program modifies the first log level, and the second program layer can also determine whether the first program modifies the first log level as expected by simulating different operation scenarios.

[0007] According to the first program, the first log level is modified.

[0008] According to another aspect of the present application, a database application log level modification device is provided, comprising:

[0009] A first instruction determination module is configured to determine a first instruction; the first instruction is used to indicate that the first log level is modified, and the first instruction contains a first identifier and a first level; the first log level is the log level of the application log which needs to be modified; the first identifier is used to represent the name of the data packet corresponding to the first log; the first level is the log level to which the first log needs to be modified;

[0010] A first program calling module is configured to call a first program according to the first instruction; the first program is configured with a first program layer and a second program layer; the first program layer is composed of a first file and a second file; the first file is used to generate an execution path according to the first identifier and the first level; the second file is used to execute the execution path generated by the first file and modify the first log level; the execution path is a specific sequence of a series of statements, instructions or function calls experienced by the first program from the beginning to the end in the running process; the second program layer records the change of the first log level and the processing process of the first program in real time when the first program modifies the first log level, and the second program layer can also determine whether the first program modifies the first log level as expected by simulating different operation scenarios.

[0011] A modification module is configured to modify the first log level according to the first program.

[0012] According to another aspect of the present application, an electronic device is provided, comprising:

[0013] at least one processor; and

[0014] a memory communicatively connected with the at least one processor; wherein,

[0015] the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the database application log level modification method according to any one of the embodiments of the present application.

[0016] According to another aspect of the present application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to implement the database application log level modification method according to any one of the embodiments of the present application when executed by the processor.

[0017] The technical solution of the embodiments of the present application determines a first instruction; calls a first program according to the first instruction, the first program is a separately packaged program package, and can exist independently of an application program without affecting the running of other modules; modifies a first log level according to the first program, and modifies the log level of the first log through the first program, so that more detailed log information can be obtained without affecting the running of the application program, thereby quickly obtaining the running condition of the application program. The method modifies the log level of the first log through the first program, so that detailed log information can be obtained without affecting the running of the application program, thereby confirming the running condition of the application program and quickly locating the problem of the application program.

[0018] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced as follows. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can also be obtained by those skilled in the art without creative labor on the basis of these drawings.

[0020] Figure 1 A flowchart of a database application log level modification method provided by the embodiments of the present application is provided.

[0021] Figure 2 A composition structure diagram of a first program provided by the embodiments of the present application is provided.

[0022] Figure 3A flowchart of another database application log level modification method provided for an embodiment of the present application;

[0023] Figure 4 A structural schematic diagram of a database application log level modification device provided for an embodiment of the present application;

[0024] Figure 5 A structural schematic diagram of an electronic device for implementing the database application log level modification method of an embodiment of the present application. DETAILED DESCRIPTION

[0025] In order to enable persons skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative work should fall within the scope of protection of the present application.

[0026] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to the process, method, product or device.

[0027] Figure 1 A flowchart of a database application log level modification method provided for an embodiment of the present application, the present embodiment can be applicable to the case of modifying the log level of a database, the method can be executed by a database application log level modification device, the database application log level modification device can be realized in the form of hardware and / or software, and the database application log level modification device can be configured in any electronic device with network communication function. As shown in the figure, the method comprises: Figure 1

[0028] ​S110, determining a first instruction; the first instruction is used to indicate modification of a first log level, and the first instruction contains a first identifier and a first level; the first log level is a log level of an application log that needs to be modified; the first identifier is used to represent the name of a data packet corresponding to the first log; and the first level is a log level to which the first log needs to be modified.

[0029] The first log can be at least one of log4j2 and logback.

[0030] The first identifier is a package name or a class name of the first log. The first level is a log level to which the first log needs to be modified.

[0031] Specifically, the first instruction is generated according to the first identifier corresponding to the first log and the log level to which the first log needs to be modified.

[0032] Further, the first instruction can be input through an input module configured in a browser.

[0033] S120, calling a first program according to the first instruction; the first program is configured with a first program layer and a second program layer; the first program layer is composed of a first file and a second file; the first file is used to generate an execution path according to the first identifier and the first level; the second file is used to execute the execution path generated by the first file and modify the first log level; the execution path is a specific sequence of a series of statements, instructions or function calls experienced by the first program from the beginning to the end in the running process; the second program layer records the changes of the first log level and the processing process of the first program in real time when the first program modifies the first log level, and the second program layer can also determine whether the first program modifies the first log level as expected by simulating different operation scenarios.

[0034] Further, the generation process of the first file is as follows: a third file is constructed, the third file is annotated by a first annotation, so that the third file has the ability to provide an external interface. The first file is obtained by adding an annotation for dynamically adjusting the log level of the first log in the third file.

[0035] The third file is a Web controller class of a Spring framework, and the main function is to receive an HTTP request of the client about the adjustment of the first log level, that is, to receive the first instruction, to call the corresponding first program to modify the log level of the first log, and to return a processing result.

[0036] The first annotation is used to provide an external interface function for the third file, and can use @RestController and @RequestMapping annotations.

[0037] Furthermore, the process of generating the second file is as follows: construct the fourth file, add a third comment to the fourth file to define the fourth file as a management service component, and add comments for the first type and dynamically adjust the first log level to obtain the second file.

[0038] The first category is used to provide the first log management operations for the first program. This first category can use the `LoggingSystem` class, a core logging system abstraction class provided by the Spring framework. Its main function is to uniformly encapsulate the operations of different logging frameworks, providing standardized log level control, log configuration refresh, and other functions, while shielding the implementation differences of the underlying logging frameworks. The underlying logging frameworks can be: Logback, Log4j2, or Java Util Logging.

[0039] Furthermore, the process for determining the second program layer is as follows: Define a TestLogger.java class and place it under the data packet corresponding to the first log. Define a test method testLogger in the TestLogger.java class. Add log output statements to the testLogger method and implement a loop call.

[0040] For example, the added statement is as follows:

[0041] while(true){

[0042] LOGGER.info(“This is an Info level log.”);

[0043] if (LOGGER.isDebugEnable()) {

[0044] LOGGER.debug(“This is the debug level log.”);

[0045] }

[0046] TimeUnit.SECONDS.sleep(5);

[0047] }

[0048] Specifically, in response to the first instruction, the client calls the first program through a RESTful interface. The client parses the first instruction to obtain the first identifier and first level of the first log. The client then sends the obtained first identifier and first level to the first program.

[0049] The client can be a browser.

[0050] Among them, such asFigure 2 As shown, the first program includes, in addition to the first program layer and the second program layer, a pom.xml file and a log4j2-spring.xml file. The pom.xml file is a core configuration file of the project, including management of dependencies, packaging, and the like of the project; and the log4j2-spring.xml file is a configuration file of the log4j2 framework in the SpringBoot project.

[0051] S130, modifying the first log level according to the first program.

[0052] Specifically, after the first program receives the first identifier and the first level, the first file in the first program first generates an execution path according to the first identifier of the first log, and calls the second file. The second file calls the data packet of the first log according to the obtained execution path, and modifies the log level in the data packet according to the first level.

[0053] Further, after the first program is started, a log file is generated in the log directory of the first program. Assuming that the initial log level of the first log cn.demo data packet is Info, the related output of the first log cn.demo is all at the Info level, and part of the information of the first log is as follows:

[0054] xxxx-xx-xx YY:10:10,030 [INFO] cn.demo.TestLogger.testLogger This is an Info level log.

[0055] xxxx-xx-xx YY:15:10,342 [INFO] cn.demo.TestLogger.testLogger This is an Info level log.

[0056] xxxx-xx-xx YY:20:10,176 [INFO] cn.demo.TestLogger.testLogger This is an Info level log.

[0057] Further, after the modification is completed, the log level information of the first log is called through a preset website, and it is judged whether the modification is successful according to the obtained information.

[0058] Further, after the modification of the log level is completed, log information is output according to the modified log level. According to the obtained log information, problems existing in the database application program are checked, and after the checking is completed, the log level of the first log is restored by the first program.

[0059] The above step, the log level restoration can be restored to a lower log level (such as INFO or WARN) in time after the problem is solved, thereby reducing the performance overhead.

[0060] As shown in the example, Figure 3 As shown in the example,

[0061] The above step, the log level of the first log is modified by the first program, so that when a problem occurs during the running of the database application, the log level of the first log corresponding to the data packet or data class can be adjusted from INFO or WARN to DEBUG or TRACE to obtain more detailed log information. This helps to quickly locate the root cause of the problem. The online modification method does not need to restart the application and can take effect immediately, thereby reducing downtime, avoiding restarting the application, and also allowing adjustment of only specific packages, classes or modules to avoid interference with other modules.

[0062] Optionally, the modification of the first log level according to the first program includes steps A1-A3:

[0063] Step A1, the first program obtains the modification information in the first instruction.

[0064] Specifically, the browser parses the first instruction to obtain the modification information, i.e., the first identifier and the first level of the first log. The obtained modification information is sent to the first program.

[0065] Step A2, generating a first path according to the modification information.

[0066] Specifically, the first file in the first program generates an execution path according to the obtained modification information as the first path, activates the calling program configured in the first file, and calls the second file.

[0067] Step A3, calling the first log according to the first path and modifying the level of the first log.

[0068] Specifically, the second file calls the data packet of the first log according to the first path, and modifies the original log level of the first log according to the first level in the modification information.

[0069] Optionally, the at least one construction procedure of the first program comprises steps B1-B3.

[0070] S1, constructing a third file and configuring a first subprogram in the third file to obtain a first file; the third file is used to provide an interface for connecting with the outside of the program; the first subprogram is used for mapping the first program and the interface.

[0071] The third file is a Web controller class of a Spring framework, and mainly functions to receive an HTTP request of the client about the first log level adjustment, i.e., receive the first instruction, call the corresponding first program to modify the log level of the first log, and return a processing result. The third file can adopt a DatabaseController.java file.

[0072] The first subprogram comprises a first annotation and a second annotation.

[0073] The first annotation is used to provide an external interface function for the third file, and can adopt a @RestController and a @RequestMapping annotation.

[0074] The second annotation is used to add a basic path of an application log in the third file, and can adopt a setLoggerLevel method added with a @PostMapping annotation.

[0075] Specifically, the third file is constructed, and the first annotation is added in the third file. After the addition is completed, the second annotation is added to obtain the first file.

[0076] Specifically, the first file is generated in the following manner: a DatabaseController.java file is created, the DatabaseController.java file is annotated with a Spring's @RestController and a @RequestMapping to make the DatabaseController.java file have an ability to provide an interface to the outside, and the path of the interface is defined as / datebase. In the DatabaseController.java file, a setLoggerLevel method is added, the setLoggerLevel method is annotated with a @PostMapping, and the path of the method is defined as / logger / level. The parameters include: name and level.

[0077] Wherein name is the package name or class name of the first log, for example cn.demo. Level is the first level, and the optional value can be at least one of the following packages: Error, Warn, Info, Debug.

[0078] Step B2, construct a fourth file and configure a second subprogram in the fourth file to obtain a second file; the fourth file can be injected and called by the control class, and the level of the first log can be modified through the second subprogram configured therein.

[0079] Wherein the second subprogram comprises: a second annotation, a third annotation and a first class.

[0080] Wherein the third annotation is used to define the fourth file as a management service component. The third annotation can adopt the @Service annotation.

[0081] Wherein the first class is used to provide different log operation interfaces for the fourth file.

[0082] Specifically, a fourth file is created, the third annotation is added to the fourth file to define the fourth file as a management service component. Then the first class is injected into the fourth file, and the second annotation is added to the first class to obtain a second file.

[0083] Illustratively, a DatabaseService.java file is created, the @Service annotation is added to make it managed by spring, the LoggingSystem class of spring is injected into the file, and the setLoggerLevel method is added, the parameters of which include: name and level. The log level is modified online in the method by the following method:

[0084] loggingSystem.setLogLevel(name, LogLevel.valueOf(level));

[0085] Wherein LogLevel is a log enumeration class of Spring, which is used to convert the log level of the first log into a log level name conforming to the spring format.

[0086] Step B3, connect the first file with the second file, and encapsulate with the second program layer to obtain the first program.

[0087] Specifically, the second file is added to the first file through the fourth annotation, and the interface statement of the second file is added to the second annotation in the first file, so that the first file can call the second file. After the addition is completed, the second program layer is encapsulated, and a jar file is generated to obtain the first program.

[0088] Exemplarily, the DatabaseService object is injected in the first file DatabaseController through the @AutoWired annotation, and a statement for calling the service interface is added in the setLoggerLevel method in the DatabaseController: databaseService.setLoggerLevel(name, level).

[0089] Exemplarily, if the first program is demo.jar, the first program is started through the java -jar demo.jar command.

[0090] Optionally, the first subprogram is configured in the third file to obtain the first file, including steps C1-C2:

[0091] Step C1, adding the first annotation in the third file to obtain the third subprogram; the first annotation is the base path information of the controller class.

[0092] Specifically, the first annotation is added in the third file through Spring, so that the third file has the ability to interface externally, and the interface path is defined to obtain the third subprogram.

[0093] Step C2, adding the second annotation in the third subprogram to obtain the first file; the second annotation is used to add the base path of the application log in the third file.

[0094] Specifically, the first method is added in the third subprogram, and the mapping annotation is added in the first method to obtain the first file.

[0095] The mapping annotation is used to map the HTTP POST request, and the main function is to bind the HTTP POST request with the first method.

[0096] The first method can use the setLoggerLevel method. The setLoggerLevel method is used to dynamically adjust the log record output level, and the output granularity of the log is precisely controlled to achieve the goal of outputting the log on demand.

[0097] Exemplarily, the determination process of the first file is as follows: in the DatabaseController.java file, the setLoggerLevel method is added, the @PostMapping annotation is added to the method, and the path of the method is defined as / logger / level.

[0098] Optionally, the second subprogram is configured in the fourth file to obtain the second file, including steps D1-D3:

[0099] Step D1, adding a third annotation in the fourth file to obtain a fourth subprogram; the third annotation is used to define the fourth file as a management service component.

[0100] Specifically, adding a third annotation on the class definition in the fourth file to define the fourth file as a management service component to obtain a fourth subprogram,

[0101] Step D2, adding a first class in the fourth subprogram; the first class is used to provide a management operation of the first log for the fourth subprogram.

[0102] Specifically, declaring a first class object in the fourth subprogram and adding an application log operation instance annotation to enable the fourth file to call the application log operation instance.

[0103] Step D3, adding a second annotation to the first class to obtain a second file.

[0104] Specifically, after adding the first class, a first method is added to the first class, and a mapping annotation is added to the first method to obtain the second file.

[0105] Optionally, the first file is connected with the second file, including steps E1-E2:

[0106] Step E1, adding the second file in the first file through a fourth annotation; the fourth annotation can add an instance of the second file to the first file.

[0107] Specifically, adding an object instance of the second file in the first file through the fourth annotation.

[0108] Step E2, adding a calling program in the second annotation of the first file; the calling program is an interface file for calling the second file.

[0109] Specifically, after adding the object instance of the second file in the first file, an interface file capable of calling the second file is added in the second annotation of the first file to complete the connection between the first file and the second file.

[0110] Illustratively, the calling program can be: databaseService.setLoggerLevel(name, level).

[0111] Optionally, after modifying the first log level according to the first program, including steps F1-F2:

[0112] Step F1, obtaining first information in response to a second instruction; the second instruction is an instruction for verifying whether the application log modification is completed; the first information is used to record the change of the first log level.

[0113] Specifically, the second instruction is acquired, and a preset website is accessed according to the second instruction, the first log level record is called through the preset website, and log information of the first log in a preset time interval is acquired to obtain first information.

[0114] The preset website is a preset website used to access the first log level information.

[0115] For example, the preset website can be represented as: http: / / XXXXXXXX:XXXX / database / logger / level?name=cn.demo&level=Debug.

[0116] For example, the information recorded in the first information can be represented as:

[0117] xxxx-xx-xx YY:10:10, 030 [INFO] cn.demo.TestLogger.testLogger is an Info level log.

[0118] xxxx-xx-xx YY:10:10, 145 [DEBUG] cn.demo.TestLogger.testLogger is a Debug level log.

[0119] xxxx-xx-xx YY:15:10, 342 [INFO] cn.demo.TestLogger.testLogger is an Info level log.

[0120] xxxx-xx-xx YY:15:10, 628 [DEBUG] cn.demo.TestLogger.testLogger is a Debug level log.

[0121] xxxx-xx-xx YY:20:10, 176 [INFO] cn.demo.TestLogger.testLogger is an Info level log.

[0122] xxxx-xx-xx YY:20:10, 447 [DEBUG] cn.demo.TestLogger.testLogger is a Debug level log.

[0123] For example, the preset time interval is: YY:10:10-YY:20:10.

[0124] Step F2, determining whether the modification is successful according to the change of the level information in the first information.

[0125] Specifically, according to whether the level information of the first log in the preset time interval in the first information changes and whether the change is the first level, it is judged whether the first log level is modified successfully.

[0126] Further, the specific judgment method is that if the first log level is changed from the original log level to the first level in the preset time interval, the first log level is modified successfully. If the first log level is switched between the original log level and the first level in the preset time interval, the first log level is modified successfully. If the first log level is changed from the original log level to the first level and then changed to the original log level in the preset time interval, the first log level is modified successfully. If the first log level always remains the original log level, the first log level is modified unsuccessfully.

[0127] The technical scheme of the embodiment determines a first instruction; calls a first program according to the first instruction, the first program is a separately packaged program package, can exist independently of an application program, and does not affect the running of other modules; and modifies a first log level according to the first program. The first log level is modified by the first program, more detailed log information can be obtained without affecting the running of the application program, so that the running condition of the application program is quickly obtained. The method modifies the log level of the first log through the first program, detailed log information can be obtained without affecting the running of the application program, so that the running condition of the application program is confirmed, and the problem of the application program is quickly located.

[0128] Figure 4 A structural schematic diagram of a database application log level modification device provided by the embodiment is shown. The embodiment can be applied to the case of modifying the log level of a database. The database application log level modification device can be realized in the form of hardware and / or software, and can be configured in any electronic device with network communication function. As shown in the figure, the device includes a first instruction determination module 210, a first program calling module 220, and a modification module 230. Figure 4

[0129] The first instruction determination module 210 is used to determine a first instruction. The first instruction is used to instruct to modify a first log level, and the first instruction includes a first identifier and a first level. The first log level is the log level of an application log which needs to be modified. The first identifier is used to represent the name of a data package corresponding to the first log. The first level is the log level to which the first log needs to be modified.

[0130] ​The first program calling module 220 is configured to call the first program according to the first instruction; the first program is configured with a first program layer and a second program layer; the first program layer is composed of a first file and a second file; the first file is configured to generate an execution path according to a first identifier and a first level; the second file is configured to execute the execution path generated by the first file and modify the first log level; the execution path is a specific sequence of a series of statements, instructions or function calls experienced by the first program from the beginning to the end in the running process; the second program layer is configured to record the change of the first log level and the processing process of the first program in real time when the first program modifies the first log level, and the second program layer is also configured to determine whether the first program modifies the first log level as expected by simulating different operation scenarios.

[0131] The modification module 230 is configured to modify the first log level according to the first program.

[0132] Optionally, the modification module 230 comprises:

[0133] The modification information determining unit is configured to obtain the modification information in the first instruction by the first program;

[0134] The first path determining unit is configured to generate the first path according to the modification information;

[0135] The modification unit is configured to call the first log according to the first path and modify the level of the first log.

[0136] Optionally, the first program calling module 220 comprises:

[0137] The first file determining unit is configured to construct a third file, configure a first subprogram in the third file, and obtain the first file; the third file is configured to provide an interface connected with the outside of the program; the first subprogram is configured to map the first program and the interface;

[0138] The second file determining unit is configured to construct a fourth file, configure a second subprogram in the fourth file, and obtain the second file; the fourth file can be controlled and injected and called, and the level of the first log can be modified through the second subprogram configured therein;

[0139] The first program determining unit is configured to connect the first file and the second file, and encapsulate the second program layer to obtain the first program.

[0140] Optionally, the first file determining unit comprises:

[0141] The third subprogram determining subunit is configured to add a first annotation in the third file to obtain the third subprogram; the first annotation is basic path information of the controller class;

[0142] The first file determining subunit is configured to add a second annotation in the third subprogram to obtain a first file; and the second annotation is configured to add a basic path of the application log in the third file.

[0143] Optionally, the second file determining unit comprises:

[0144] The fourth subprogram determining subunit is configured to add a third annotation in the fourth file to obtain a fourth subprogram; and the third annotation is configured to define the fourth file as a management service component.

[0145] The first variable adding subunit is configured to add a first class in the fourth subprogram; and the first class is configured to provide a first log management operation for the fourth subprogram.

[0146] The second file determining subunit is configured to add a second annotation for the first class to obtain a second file.

[0147] Optionally, the first program determining unit comprises:

[0148] The fourth annotation adding subunit is configured to add the second file in the first file through a fourth annotation; and the fourth annotation is configured to add an instance of the second file to the first file.

[0149] The calling program adding subunit is configured to add a calling program in the second annotation of the first file; and the calling program is configured to be an interface file for calling the second file.

[0150] Optionally, the database application log level modifying apparatus comprises:

[0151] The first information obtaining module is configured to obtain first information in response to a second instruction; the second instruction is an instruction for verifying whether the application log modification is completed; and the first information is configured to record the change of the first log level.

[0152] The verifying module is configured to determine whether the modification is successful according to the change of the level information in the first information.

[0153] The database application log level modifying apparatus provided in the embodiments of the present application can execute the database application log level modifying method provided in any of the embodiments of the present application, and has the corresponding functions and beneficial effects of executing the database application log level modifying method; and the detailed process can be referred to the related operations of the database application log level modifying method in the foregoing embodiments.

[0154] Figure 5A structure schematic diagram of an electronic device for implementing the database application log level modification method of the embodiments of the present application. The electronic device is intended to represent a variety of forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (e.g., headsets, glasses, watches, etc.), and other similar computing devices. The components shown here, their connections, and their functions, as described above, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed herein.

[0155] As shown in Figure 5 The electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., connected in communication with the at least one processor 11, wherein the memory stores a computer program executable by the at least one processor 11, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or loaded into the random access memory (RAM) 13 from the storage unit 18. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0156] A plurality of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunications networks.

[0157] The processor 11 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the database application log level modification method.

[0158] In some embodiments, the database application log level modification method can be implemented as a computer program tangibly embodied in a computer readable storage medium, e.g., storage unit 18. In some embodiments, parts or all of the computer program can be loaded and / or installed onto electronic device 10 via, e.g., ROM 12 and / or communication unit 19. When the computer program is loaded onto RAM 13 and executed by processor 11, one or more steps of the above-described database application log level modification method can be performed. Alternatively, in other embodiments, processor 11 can be configured to perform the database application log level modification method by other means, e.g., with the aid of firmware.

[0159] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0160] Computer programs used to implement the methods of the present application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the computer program, when executed by the processor, implements the functions / acts specified in the flowcharts and / or block diagrams. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as part of a standalone software package, partially on a machine and partially on a remote machine or entirely on a remote machine or server.

[0161] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer-readable storage medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of a machine-readable storage medium will include one or more lines of a program of instructions in a transitory signal, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.

[0162] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.

[0163] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), blockchain network, and the Internet.

[0164] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.

[0165] It should be understood that the various forms of flow shown above can be reordered, added to, or have steps deleted. For example, the steps described in the present application can be performed in parallel, in series, or in a different order, as long as the desired results of the technical solutions of the present application can be achieved, which are not limited herein.

[0166] The above detailed description does not constitute a limitation on the protection scope of the present application. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A database application log level modification method, characterized by, The application comprises: determining a first instruction; the first instruction is used to indicate modification of a first log level, and the first instruction contains a first identifier and a first level; the first log level is a log level of an application log that needs to be modified; the first identifier is used to represent the name of a data packet corresponding to the first log; and the first level is a log level to which the first log needs to be modified; calling a first program according to the first instruction; the first program is configured with a first program layer and a second program layer; the first program layer is composed of a first file and a second file; the first file is used to generate an execution path according to the first identifier and the first level; the second file is used to execute the execution path generated by the first file and modify the first log level; the execution path is a specific sequence of a series of statements, instructions or function calls experienced by the first program from the beginning to the end in the running process; the second program layer records the changes of the first log level and the processing process of the first program in real time when the first program modifies the first log level, and the second program layer can also determine whether the first program modifies the first log level as expected by simulating different operation scenarios; modifying the first log level according to the first program.

2. The method of claim 1, wherein, The modification of the first log level according to the first program comprises: the first program acquires modification information in the first instruction; generating a first path according to the modification information; calling the first log according to the first path and modifying the level of the first log.

3. The method of claim 1, wherein, At least one construction process of the first program comprises: constructing a third file and configuring a first subprogram in the third file to obtain a first file; the third file is used to provide an interface connected with the outside of the program; and the first subprogram is used for mapping the first program and the interface; constructing a fourth file and configuring a second subprogram in the fourth file to obtain a second file; the fourth file can be injected and called by a control class, and the level of the first log can be modified through the second subprogram configured therein; connecting the first file and the second file and encapsulating them with a second program layer to obtain the first program.

4. The method of claim 3, wherein, The configuration of the first subprogram in the third file to obtain the first file comprises: adding a first annotation in the third file to obtain a third subprogram; the first annotation is basic path information of a controller class; adding a second annotation in the third subprogram to obtain the first file; the second annotation is used to add a basic path of an application log in the third file.

5. The method of claim 3, wherein, The configuration of the second subprogram in the fourth file to obtain the second file comprises: adding a third annotation in the fourth file to obtain a fourth subprogram; the third annotation is used to define the fourth file as a management service component; adding a first class in the fourth subprogram; the first class is used to provide a management operation of the first log for the fourth subprogram; adding a second annotation to the first class to obtain the second file.

6. The method of claim 3, wherein, The connection of the first file and the second file comprises: adding a second file in the first file through a fourth annotation; the fourth annotation is capable of adding an instance of the second file into the first file; adding a calling program in the second annotation of the first file; the calling program is an interface file for calling the second file.

7. The method of claim 1, wherein, after the first program modifies the first log level, comprising: in response to a second instruction, obtaining first information; the second instruction is an instruction for verifying whether the application log modification is completed; the first information is used for recording the change of the first log level; determining whether the modification is successful according to the change of the level information in the first information.

8. A database application log level modification apparatus characterized by comprising: comprising: a first instruction determination module for determining a first instruction; the first instruction is used for indicating to modify the first log level, and the first instruction contains a first identifier and a first level; the first log level is the log level of the application log which needs to be modified; the first identifier is used for representing the name of the data packet corresponding to the first log; the first level is the log level which the first log needs to be modified to; a first program calling module for calling a first program according to the first instruction; the first program is configured with a first program layer and a second program layer; the first program layer is composed of a first file and a second file; the first file is used for generating an execution path according to the first identifier and the first level; the second file is used for executing the execution path generated by the first file and modifying the first log level; the execution path is a specific sequence of a series of statements, instructions or function calls experienced by the first program from the beginning to the end in the running process; the second program layer records the change of the first log level and the processing process of the first program in real time when the first program modifies the first log level, and the second program layer can also determine whether the first program modifies the first log level as expected by simulating different operation scenarios; a modification module for modifying the first log level according to the first program.

9. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected with the at least one processor in communication; wherein the memory stores a computer program which can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the database application log level modification method in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions, and the computer instructions are used to enable the processor to execute the database application log level modification method in any one of claims 1-7 when executed. The computer readable storage medium stores computer instructions, and the computer instructions are used to enable the processor to execute the database application log level modification method in any one of claims 1-7 when executed.

Citation Information

Patent Citations

  • Modular log management method and device based on Spring log framework and medium

    CN115729722A

  • Dynamic adjustment method, device and system for log level and computer program product

    CN118467291A