Log processing method for database, storage medium, and device

By writing logs to shared memory before the log configuration is fully parsed and then asynchronously writing them to the log file after parsing, the log loss problem is solved, and writing efficiency and performance are improved.

CN115982118BActive Publication Date: 2026-07-28CETC JINCANG (BEIJING) TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
CETC JINCANG (BEIJING) TECH CO LTD
Filing Date
2023-01-09
Publication Date
2026-07-28

AI Technical Summary

Technical Problem

If the log configuration has not been fully parsed, there is a problem of missing log output, which results in the inability to record log information in a timely manner.

Method used

If the log configuration is not yet set, the log entries to be written are assigned the preset level, and the entry number is generated according to the log level. The logs are written to shared memory. After the log configuration is parsed, the logs are retrieved from shared memory and written to the log file.

Benefits of technology

This avoids data loss before log configuration parsing is complete, improves writing efficiency and performance, and ensures the integrity of log information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115982118B_ABST
    Figure CN115982118B_ABST
Patent Text Reader

Abstract

The application provides a log processing method of a database, a storage medium and equipment. The log processing method comprises: obtaining log configuration information, and determining whether log configuration has been completed according to the log configuration information; if not, assigning a preset level to a log entry to be written; generating an entry number according to the log level; and writing the log into a pre-set shared memory according to the entry number. Therefore, even if the log configuration has not been completely parsed, the log can be written into the pre-set shared memory by assigning a preset level to the log entry, thereby avoiding the problem of log loss before the log configuration is completely parsed. Moreover, because the log exists in the shared memory, even if the program is interrupted, the log in the shared memory will not be lost, and the log that has been written in advance can still be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of database technology, and in particular to a database log processing method, storage medium, and device. Background Technology

[0002] Log files are used to record database update operations performed by transactions. A complete log entry includes a log level (e.g., DEBUG, INFO, WARNING, ERROR, CRITICAL). By outputting logs at specific log levels, users can easily troubleshoot the database's operation. The log output process requires first parsing the log configuration, which sets the log level and log file output path. After parsing the log configuration, the required log level and log file output path can be obtained and recorded in global variables. Then, during log writing, the log level can be retrieved and compared with the log level recorded in the global variables. If they match, the current log entry is written to the specified log file.

[0003] However, parsing the log configuration takes time, and log output cannot be completed before the configuration is fully parsed. In other words, logs from before the configuration takes effect cannot be output, resulting in log loss. Summary of the Invention

[0004] One object of the present invention is to provide a log processing method, storage medium, and device that can solve any of the above problems.

[0005] A further objective of this invention is to improve write efficiency.

[0006] Another further objective of this invention is to improve write performance.

[0007] Specifically, the present invention provides a database log processing method, comprising:

[0008] Obtain log configuration information and determine whether the log configuration has been set based on the log configuration information;

[0009] If not, the log entries to be assigned are at the default level;

[0010] Generate entry numbers based on log levels;

[0011] Logs are written to pre-configured shared memory according to entry numbers.

[0012] Optionally, the step of writing the log to shared memory according to the entry number includes:

[0013] Determine if the entry number already exists in shared memory. If so, write the variable part of the log entry to be written to the corresponding entry number; otherwise, write the log entry to be written with the entry number to shared memory.

[0014] Optionally, the step of generating entry numbers based on log levels includes:

[0015] Get the number of times the log writing function is called, and determine the base number of the log entry to be written based on the incrementing number of calls. The number of calls records the first call of the log writing function in different locations; the base number and the log level together form the entry number.

[0016] Optionally, after determining whether the logging configuration has been set up, the steps include:

[0017] If so, retrieve the log information in shared memory and write the log entries that match the log configuration to the log file specified in the log configuration.

[0018] Optionally, after the log configuration has been set up, the following can be included:

[0019] Based on the log configuration, assign the corresponding level to the log entries to be written, and execute the steps of generating entry numbers based on the log levels and writing the logs to the pre-configured shared memory according to the entry numbers.

[0020] Optionally, the step of retrieving log information from the shared memory includes, prior to:

[0021] Determine if logging is configured. If yes, proceed to retrieve log information from shared memory; otherwise, release shared memory.

[0022] Optionally, the step of releasing the shared memory includes, prior to:

[0023] The default write log flag is set to no. The write log flag is used to indicate whether or not logs need to be written, and the initial value of the write log flag is yes.

[0024] Optionally, the steps to obtain log configuration information may include:

[0025] Determine whether logging is required. If yes, proceed to retrieve log configuration information; otherwise, end the logging process.

[0026] In another aspect of the invention, a machine-readable storage medium is also provided, on which a machine-executable program is stored, which, when executed by a processor, implements a log processing method for a database according to any of the preceding claims.

[0027] In another aspect of the invention, a computer device is also provided, including a memory, a processor, and a machine-executable program stored in the memory and running on the processor, wherein the processor, when executing the machine-executable program, implements a log processing method for a database according to any of the preceding claims.

[0028] The log processing method of this invention assigns a preset level to the log entries to be written even when the log configuration is not fully set, generates entry numbers based on the log levels, and writes the logs to shared memory according to the entry numbers. In other words, even if the log configuration has not been fully parsed, logs can still be written to the pre-set shared memory by assigning preset levels to log entries. Therefore, logs before the log configuration is fully parsed are not lost. Once the log configuration is parsed, the logs from before the parsing is complete can still be found in the shared memory. Thus, the problem of log loss before the log configuration is fully parsed is avoided. Furthermore, because the logs reside in shared memory, even if the program is unexpectedly interrupted, the logs will not be lost unless the shared memory is actively cleared, and the pre-written logs can still be retrieved using relevant tools.

[0029] Furthermore, the log processing method of this invention processes the current log entry by determining whether the entry number already exists in shared memory. If so, the variable portion of the log entry to be written is written under the corresponding entry number; otherwise, the log entry to be written with the entry number is written to shared memory. In other words, during the process of writing logs to shared memory, only a fixed amount from one log entry is output, and then only the variable portions of subsequent log entries with the same fixed amount are written under the corresponding entry number. This reduces the writing of a large number of repetitive words, improves writing efficiency, and helps save memory. Moreover, numbered logs facilitate subsequent data capture and analysis.

[0030] Furthermore, the log processing method of the present invention, after the log configuration has been set, assigns the corresponding level to the log entries to be written according to the log configuration content, and performs the steps of generating entry numbers according to the log levels and writing the logs to a pre-set shared memory according to the entry numbers. That is, after the log configuration is completed, the logs are still written to shared memory, rather than directly to the log file. Because writing logs to memory is faster than writing them to the log file, writing the logs to shared memory first, and then asynchronously writing the logs that need to be written to the log file later, helps improve write performance. Moreover, since the logs in shared memory all have entry numbers, writing to the log file by indexing the entry numbers is also more efficient.

[0031] The above and other objects, advantages and features of the present invention will become more apparent to those skilled in the art from the following detailed description of specific embodiments of the invention in conjunction with the accompanying drawings. Attached Figure Description

[0032] The following sections will describe some specific embodiments of the invention in a detailed manner by way of example and not limitation, with reference to the accompanying drawings. The same reference numerals in the drawings denote the same or similar parts or portions. Those skilled in the art should understand that these drawings are not necessarily drawn to scale. In the drawings:

[0033] Figure 1 This is a schematic flowchart of a log processing method according to an embodiment of the present invention;

[0034] Figure 2 This is a schematic flowchart illustrating the step of writing logs to a pre-set shared memory according to entry numbers in a log processing method according to an embodiment of the present invention.

[0035] Figure 3 This is a schematic flowchart of a log processing method according to another embodiment of the present invention;

[0036] Figure 4 This is a schematic flowchart of the log processing method according to an embodiment of the present invention, prior to the step of retrieving log information in shared memory;

[0037] Figure 5 This is a schematic flowchart of a log processing method according to yet another embodiment of the present invention;

[0038] Figure 6 This is a schematic diagram of a database system according to an embodiment of the present invention;

[0039] Figure 7 This is a schematic block diagram of a storage medium according to an embodiment of the present invention;

[0040] Figure 8 This is a schematic block diagram of a computer device according to an embodiment of the present invention. Detailed Implementation

[0041] Those skilled in the art should understand that the embodiments described below are merely a part of the embodiments of the present invention, and not all of the embodiments of the present invention. These partial embodiments are intended to explain the technical principles of the present invention and are not intended to limit the scope of protection of the present invention. Based on the embodiments provided by the present invention, all other embodiments obtained by those skilled in the art without creative effort should still fall within the scope of protection of the present invention.

[0042] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus or device (such as a computer-based system, a processor-included system or other system that can fetch and execute instructions from, an instruction execution system, apparatus or device).

[0043] like Figure 1 As shown, in this embodiment, the log processing method generally includes:

[0044] Step S101: Obtain log configuration information and determine whether the log configuration has been set up correctly based on the log configuration information. If not, proceed to step S102. Specifically, this involves obtaining the log configuration parsing status to determine whether the log configuration parsing is complete.

[0045] Step S102: Assign the default level to the log entry to be written. Specifically, if the log configuration has not yet been set, then assign the default level to the current log entry, which is preset.

[0046] Step S103: Generate entry numbers based on log levels. Specifically, this step includes obtaining the number of times the log writing function is called, determining the base number of the log entry to be written based on the incrementing number of calls, wherein the call count records the first call of the log writing function at different locations; the base number and the preset level determine the entry number.

[0047] In other words, the entry number is composed of both the log level and the base number. The base number is obtained based on the number of times the log writing function is called. The call count records the first call to the log writing function at different locations; specifically, the call count is incremented by 1 only when the log writing function is first called at a certain location. For example, if the initial call count is 0, firstly, the log writing function is called at location A, so the base number of the log at that location is 1. Then, the log writing function is called at location B, so the base number of the log at that location is 2. Then, the log writing function is called again at location A, so the call count remains the same, and the base number of the log at that location is 1. Finally, the log writing function is called at location C, so the base number of the log at that location is 3.

[0048] Step S104: Write the log to the pre-configured shared memory according to the entry number. (See reference...) Figure 2 As shown, specifically, this step includes:

[0049] Step S201: Determine whether the entry number already exists in the shared memory. If yes, proceed to step S202; otherwise, proceed to step S203.

[0050] Step S202: Write the variable part of the log entry to be written to the corresponding entry number.

[0051] Step S203: Write the log entries to be written, which have the entry numbers, to the shared memory.

[0052] Specifically, each log entry at the same location has the same fixed-value portion. Because the base number and log level are the same, the entry number is also a fixed-value portion shared by all log entries. When a log entry needs to be written to shared memory, it is first checked whether the entry number already exists in shared memory. If the entry number already exists, it means that the fixed-value portion of the log entry to be written already exists in shared memory. Therefore, only the variable portion of the log entry needs to be written under the corresponding entry number.

[0053] If the entry number does not exist in shared memory, it means that the fixed-value portion of the log entry to be written does not exist in shared memory. Therefore, both the fixed-value portion and the variable portion of the log entry need to be written to shared memory, that is, the complete log entry needs to be written to shared memory.

[0054] In this embodiment, even if the log configuration is not fully set, the log entries to be written are assigned a preset level, an entry number is generated based on the log level, and the logs are written to shared memory according to the entry number. That is, even if the log configuration has not been fully parsed, the logs can still be written to the pre-set shared memory by assigning a preset level to the log entries. Therefore, logs before the log configuration is fully parsed are not lost. Once the log configuration is parsed, the logs before the parsing is complete can still be found in the shared memory. Thus, the problem of losing logs before the log configuration is fully parsed is avoided. Moreover, because the logs exist in shared memory, even if the program is unexpectedly interrupted, the logs will not be lost if the shared memory is not actively cleared, and the pre-written logs can still be retrieved using relevant tools.

[0055] Furthermore, by determining whether the entry number already exists in shared memory, if so, the variable portion of the log entry to be written is written to the corresponding entry number; otherwise, the log entry to be written, including the entry number, is written to shared memory. In other words, during the process of writing logs to shared memory, only a fixed amount from one log entry is output, and then only the variable portions of subsequent log entries with the same fixed amount are written to the corresponding entry number. This reduces the writing of a large number of repetitive words, improving writing efficiency and saving memory.

[0056] like Figure 3 As shown, in this embodiment, the log processing method generally includes:

[0057] Step S301: Obtain log configuration information and determine whether the log configuration has been set based on the log configuration information. If yes, proceed to step S302. If no, proceed to step S304.

[0058] Step S302: Retrieve log information from shared memory and write log entries that match the log configuration to the log file specified in the log configuration. Specifically, since the log configuration has been parsed, the required log level and the log output path (i.e., the log file) are now determined. Therefore, by retrieving the pre-written logs from shared memory, logs that meet the requirements can be written to the configured log file.

[0059] Step S303: Based on the log configuration, assign the corresponding log levels to the log entries to be written. Specifically, since the log configuration has been parsed, the corresponding log levels to be written can now be determined. Then proceed to step S305.

[0060] Step S304: Assign the log entry to be written to the preset level, and then proceed to step S305.

[0061] Step S305: Generate entry numbers based on log levels. Specifically, both the preset level and the corresponding level determined after the log configuration is set are log levels, thus enabling the generation of entry numbers.

[0062] Step S306: Write the log to the pre-configured shared memory according to the entry number. This step is the same as in the above embodiment and will not be repeated here.

[0063] In this embodiment, after the log configuration is completed, the log entries to be written are assigned corresponding levels according to the log configuration content. Then, the steps of generating entry numbers based on the log levels and writing the logs to the pre-configured shared memory according to the entry numbers are executed. That is, after the log configuration is complete, the logs are still written to shared memory instead of directly to the log file. Because writing logs to memory is faster than writing them to the log file, writing the logs to shared memory first, and then asynchronously writing the logs that need to be written to the log file later, helps improve write performance. Furthermore, since the logs in shared memory all have entry numbers, writing to the log file by indexing the entry numbers is also more efficient.

[0064] It should be noted that there is no specific order between steps S302 and S303. The shared memory can be retrieved even when no log is being written.

[0065] like Figure 4 As shown, in this embodiment, before the step of retrieving log information in shared memory, the method includes: determining whether logging is configured; if yes, performing the step of retrieving log information in shared memory; if no, releasing shared memory.

[0066] Specifically, the log processing method of this embodiment generally includes:

[0067] Step S401: Determine whether logging is configured. If yes, proceed to step S402; otherwise, proceed to step S403. Specifically, after the log configuration is parsed, if logging is configured, the parsed log configuration will be used for writing logs. If logging is not configured, there is no need to write logs.

[0068] Step S402: Retrieve log information from shared memory and write log entries that match the log configuration to the log file specified in the log configuration. Specifically, when log writing is required, the pre-written logs in shared memory are retrieved, and the logs that meet the requirements are written to the configured log file.

[0069] Step S403: Release shared memory. If logging is no longer required, then release the shared memory; that is, the logging process can be skipped.

[0070] In this embodiment, the system determines whether logging is configured. If so, it retrieves log information from shared memory and writes log entries matching the log configuration to the specified log file. If not, it releases the shared memory. In other words, shared memory is released when logging is not required, thereby reducing memory usage.

[0071] Specifically, before releasing the shared memory, the process includes: setting a preset write log flag to "No". The write log flag indicates whether logging is required, and its initial value is "Yes". In this embodiment, a write log flag is predefined with an initial value of "TURE", indicating that logging is required. If the log flag changes to "FALSE", logging is no longer required, thus ending the log writing process. Therefore, before releasing the shared memory, the log flag is first set to "FALSE".

[0072] In another embodiment, before the step of obtaining log configuration information, the process includes: determining whether logging is required; if so, proceeding with the step of obtaining log configuration information; otherwise, ending the log writing process. Specifically, determining whether logging is required involves determining whether the log identifier is TRUE or FALSE.

[0073] like Figure 5 As shown, in one embodiment, the log processing method generally includes:

[0074] Step S501, execute the log. Specifically, this means generating the log.

[0075] Step S502: Is logging required? If yes, proceed to step S503; otherwise, end. Specifically, a logging flag is predefined, with an initial value of TRUE (yes). This means logging is required by default. If the logging flag changes to FALSE (no), logging is no longer required, and the logging process ends. If logging is required, proceed to the next step; if logging is not required, the logging process ends.

[0076] Step S503: Has the log configuration been set up? If not, proceed to step S504; if yes, proceed to step S505. Specifically, this involves obtaining the log configuration parsing status to determine whether the log configuration parsing is complete.

[0077] Step S504: Assign the default level to the log entry to be written, and then proceed to step S510. Specifically, if the log configuration has not yet been completed, then assign the default level to the current log entry, which is preset.

[0078] Step S505: Determine whether logging is configured. If yes, proceed to step S506; otherwise, proceed to step S508. Specifically, after the log configuration is parsed, if logging is configured, the parsed log configuration will be used for writing logs. If logging is not configured, there is no need to write logs.

[0079] Step S506: Retrieve log information from shared memory and write log entries that match the log configuration to the log file specified in the log configuration. Specifically, since the log configuration has been parsed, the log level to be output and the log output path (i.e., the log file) are now determined. When writing logs is required, the pre-written logs in shared memory are retrieved, and the logs that meet the requirements are written to the configured log file.

[0080] Step S507: Based on the log configuration, assign the corresponding level to the log entries to be written. Specifically, since the log configuration has been parsed, the corresponding level of the logs to be written can be determined at this point.

[0081] Step S508: Set the write log flag to "No". This means that writing logs is no longer required.

[0082] Step S509: Release the shared memory. If logging is no longer required, release the shared memory. Then end the logging operation.

[0083] Step S510: Generate entry numbers based on log levels. Specifically, both the preset level and the corresponding level determined after the log configuration is set are log levels, thus enabling the generation of entry numbers. The entry numbering is described in the example above and will not be repeated here.

[0084] Step S511: Determine whether the entry number already exists in shared memory. If yes, proceed to step S512; otherwise, proceed to step S513. Specifically, each log entry at the same location has the same fixed portion. Because the base number and log level are the same, the entry number is also the same fixed portion of the log entries. Therefore, determining whether the fixed portion of the log entry already exists in shared memory can be used to determine if the entry number already exists.

[0085] Step S512: Write the current log according to the entry number. If the entry number already exists in shared memory, it means that the fixed portion of the log entry to be written already exists in shared memory. Therefore, simply write the variable portion of the log entry under the corresponding entry number.

[0086] Step S513: Write the log entry with the entry number to the shared memory. If the entry number does not exist in the shared memory, it means that the fixed-value portion of the log entry to be written does not exist in the shared memory. In this case, both the fixed-value portion and the variable portion of the log entry need to be written to the shared memory, that is, the complete log entry with the entry number needs to be written to the shared memory.

[0087] In this embodiment, even if the log configuration is not fully set, the log entries to be written are assigned a preset level, an entry number is generated based on the log level, and the logs are written to shared memory according to the entry number. That is, even if the log configuration has not been fully parsed, the logs can still be written to the pre-set shared memory by assigning a preset level to the log entries. Therefore, logs before the log configuration is fully parsed are not lost. Once the log configuration is parsed, the logs before the parsing is complete can still be found in the shared memory. Thus, the problem of losing logs before the log configuration is fully parsed is avoided. Moreover, because the logs exist in shared memory, even if the program is unexpectedly interrupted, the logs will not be lost if the shared memory is not actively cleared, and the pre-written logs can still be retrieved using relevant tools.

[0088] Furthermore, after the log configuration is complete, the log entries to be written are assigned corresponding levels according to the log configuration, and the steps of generating entry numbers based on the log levels and writing the logs to the pre-configured shared memory according to the entry numbers are executed. In other words, after the log configuration is complete, the logs are still written to shared memory instead of directly to the log file. Because writing logs to memory is faster than writing them to the log file, writing the logs to shared memory first, and then asynchronously writing the logs that need to be written to the log file later, helps improve write performance. Moreover, since the logs in shared memory all have entry numbers, writing to the log file by indexing the entry numbers is also more efficient.

[0089] Reference Figure 6 As shown, specifically, the database system in this embodiment includes a write log function 10, a log preprocessor 20, and a log file 30. The write log function 10 outputs logs when called. The log preprocessor 20 preprocesses the logs before the log configuration is fully parsed. The log file 30 is the log write location obtained after the log configuration is parsed.

[0090] Therefore, the arrow pointing from the log preprocessor 20 to the log preprocessor 10 indicates that the log preprocessor 20 is called before the log configuration is fully parsed, and the log is processed by the log preprocessor 20 and stored in shared memory. The arrows pointing from the log preprocessor 20 to the log preprocessor 10 and from the log preprocessor 10 to the log file 30 indicate that the log preprocessor 10 is called after the log configuration is fully parsed, and the log pre-written by the log preprocessor 20 is written to the log file 30.

[0091] In one embodiment, a machine-readable storage medium 40 and a computer device 50 are also provided.

[0092] The machine-readable storage medium 40 stores a machine-executable program 41 thereon, which, when executed by a processor, implements the log processing method of any of the above embodiments.

[0093] Computer device 50 may include memory 510, processor 520 and machine-executable program 41 stored on memory 510 and running on processor 520, and processor 520 implements the log processing method of any of the above embodiments when executing machine-executable program 41.

[0094] It should be noted that the logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any machine-readable storage medium for use by, or in conjunction with, an instruction execution system, apparatus or device (such as a computer-based system, a processor-based system or other system that can fetch and execute instructions from, an instruction execution system, apparatus or device).

[0095] For the purposes of this embodiment, the machine-readable storage medium 40 can be any means capable of containing, storing, communicating, propagating, or transmitting a program for use by or in conjunction with an instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of computer-readable media include: an electrical connection having one or more wires (electronic device), a portable computer disk drive (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and editable read-only memory (EPROM or flash memory), fiber optic devices, and portable optical disc read-only memory (CDROM). Furthermore, the machine-readable storage medium 40 can even be paper or other suitable media on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, interpreting, or otherwise processing as necessary, and then stored in a computer memory.

[0096] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented using software or firmware stored in memory and executed by a suitable instruction execution system.

[0097] Computer device 50 can be, for example, a server, desktop computer, laptop computer, tablet computer, or smartphone. In some examples, computer device 50 can be a cloud computing node. Computer device 50 can be described in the general context of computer system executable instructions (such as program modules) executed by a computer system. Typically, program modules can include routines, programs, object programs, components, logic, data structures, etc., that perform specific tasks or implement specific abstract data types. Computer device 50 can be implemented in a distributed cloud computing environment where tasks are performed by remote processing devices linked through a communication network. In a distributed cloud computing environment, program modules can reside on local or remote computing system storage media, including storage devices.

[0098] Computer device 50 may include a processor 520 adapted to execute stored instructions and a memory 510 that provides temporary storage space for the operation of said instructions during operation. The processor 520 may be a single-core processor, a multi-core processor, a computing cluster, or any other configuration. The memory 510 may include random access memory (RAM), read-only memory, flash memory, or any other suitable storage system.

[0099] The processor 520 can be connected via a system interconnect (e.g., PCI, PCI-Express, etc.) to an I / O interface (input / output interface) suitable for connecting the computer device 50 to one or more I / O devices (input / output devices). I / O devices may include, for example, a keyboard and indicating devices, where indicating devices may include a touchpad or touchscreen, etc. I / O devices may be built into the computer device 50 or may be external devices connected to the computing device.

[0100] The processor 520 can also be linked via a system interconnect to a display interface suitable for connecting the computer device 50 to a display device. The display device may include a display screen that is a built-in component of the computer device 50. The display device may also include an external computer monitor, television, or projector connected to the computer device 50. Furthermore, a network interface controller (NIC) may be adapted to connect the computer device 50 to a network via a system interconnect. In some embodiments, the NIC may use any suitable interface or protocol (such as an Internet Minicomputer System Interface) to transmit data. The network may be a cellular network, a radio network, a wide area network (WAN), a local area network (LAN), or the Internet, etc. Remote devices can connect to the computing device via the network.

[0101] The flowcharts provided in this embodiment are not intended to indicate that the operations of the method will be performed in any particular order, or that all operations of the method are included in every case. Furthermore, the method may include additional operations. Within the scope of the technical concept provided by the method in this embodiment, additional variations can be made to the above method.

[0102] Therefore, those skilled in the art should recognize that although numerous exemplary embodiments of the present invention have been shown and described in detail herein, many other variations or modifications conforming to the principles of the present invention can be directly determined or derived from the disclosure of the present invention without departing from the spirit and scope of the invention. Thus, the scope of the present invention should be understood and construed as covering all such other variations or modifications.

Claims

1. A database log processing method, comprising: Obtain log configuration information and determine whether the log configuration has been set based on the log configuration information; If not, the log entries to be assigned are at the default level; Generate entry numbers based on log levels; Write the log to the pre-configured shared memory according to the entry number; The step of writing the log to the pre-configured shared memory according to the entry number includes: Determine whether the entry number already exists in the shared memory. If yes, write the variable part of the log entry to be written to the corresponding entry number; otherwise, write the log entry to be written with the entry number to the shared memory. The step of generating entry numbers based on log levels includes: Obtain the number of times the log writing function is called, and determine the base number of the log entry to be written based on the incrementing number of calls, wherein the number of calls records the first call of the log writing function at different locations; The base number and the log level together constitute the entry number.

2. The log processing method of a database according to claim 1, wherein, After determining whether the log configuration has been set, the following steps are included: If so, retrieve the log information in the shared memory and write the log entries that match the log configuration to the log file specified by the log configuration.

3. The log processing method of a database according to claim 2, wherein, After the log configuration has been set up, the following will be included: Based on the log configuration, the log entries to be written are assigned the corresponding levels, and the steps of generating entry numbers based on log levels and writing logs to pre-configured shared memory according to the entry numbers are executed.

4. The log processing method of a database according to claim 2, wherein, Prior to the step of retrieving log information from the shared memory, the following steps are included: Determine whether logging is configured. If yes, execute the step of retrieving log information from the shared memory; otherwise, release the shared memory.

5. The database log processing method according to claim 4, wherein, Prior to the step of releasing the shared memory, the following includes: The preset write log flag is assigned the value "no". The write log flag is used to indicate whether a log needs to be written, and the initial value of the write log flag is "yes".

6. The database log processing method according to claim 1, wherein, Before the step of obtaining log configuration information, the following steps are included: Determine whether logging is required. If yes, proceed with the steps to obtain log configuration information. If no, end the logging process.

7. A machine-readable storage medium having a machine-executable program stored thereon, the machine-executable program, when executed by a processor, implementing the database log processing method according to any one of claims 1 to 6.

8. A computer device comprising a memory, a processor, and a machine-executable program stored in the memory and running on the processor, wherein the processor, when executing the machine-executable program, implements a database log processing method according to any one of claims 1 to 6.