Log calling method and device, computer equipment, readable storage medium and program product
By using ring buffers and memory mapping technology to store logs in high concurrency and multi-threaded environments, the problems of log storage efficiency and performance in the existing technology are solved, and efficient log processing of the system is realized.
Patent Information
- Application Number
- CN202411678031.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-02-07
AI Technical Summary
Existing log storage technology leads to system processing efficiency and performance degradation in high concurrency and multi-threading environments.
By initializing the system configuration, calling the log interface to generate logs, and determining the ring buffer based on the static variable pointer of the thread corresponding to the log, storing the logs into the ring buffer, and memory mapping is performed in the process virtual address space of the process processing process, and storing it The mapping relationship between the file disk address of the log and the virtual address.
Memory mapping enables the system to access data directly through memory addresses, avoiding traditional file read and write operations, and improving the efficiency of system accessing data.
Smart Images

Figure CN119396673A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of IT technology, and in particular to a log calling method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Art
[0002] With the continuous development of information networks, various devices, systems and servers are also developing continuously. Logs will be generated when various devices, systems and servers are operating. Whether it is system operation, background operation, fault analysis, etc., it is necessary to obtain relevant information based on log records. How to write logs and the high reliability and high performance operation of logs are basic scenarios that every system needs to consider.
[0003] Logging is an essential feature in modern applications. It plays a vital role in debugging, monitoring, and performance analysis. However, existing log storage technologies can only adapt to basic logging, and the system's processing efficiency and performance will decrease in high-concurrency, multi-threaded environments. Summary of the invention
[0004] Based on this, it is necessary to provide a log calling method, device, computer equipment, computer readable storage medium and computer program product that can improve the processing efficiency of the system in response to the above technical problems.
[0005] In a first aspect, the present application provides a log calling method, comprising:
[0006] Initialize system configuration and call the log interface to generate logs;
[0007] Determine a corresponding ring buffer based on a static variable pointer of the thread corresponding to the log;
[0008] The log is stored in the ring buffer, and a mapping relationship between a file disk address and a virtual address of the log is stored in a memory mapping portion in a process virtual address space of a processing process;
[0009] Based on the mapping relationship, the log is processed by the processing process.
[0010] In one of the embodiments, determining the corresponding ring buffer based on the static variable pointer of the thread corresponding to the log further includes:
[0011] When the static variable pointer of the thread corresponding to the log is a null pointer, a corresponding ring buffer is created.
[0012] In one of the embodiments, the initialization of the system configuration, before calling the log interface to generate logs, includes: setting the ring buffer to a lock-free ring buffer based on atomic operations and memory barriers.
[0013] In one of the embodiments, the memory mapping portion in the process virtual address space of the processing process stores the mapping relationship between the file disk address and the virtual address of the log, and further includes:
[0014] When the memory mapping part is full, the system function is called to release the mapping relationship, a new memory mapping part is created, and the remaining mapping relationship is stored in the newly created memory mapping part.
[0015] In one embodiment, the method further comprises:
[0016] When all memory mapping parts are full, the system function is called to release the mapping relationship, and the latest mapping relationship overwrites the mapping relationship in the initially created memory mapping part.
[0017] In one embodiment, the initialization of system configuration, before calling the log interface to generate logs, includes:
[0018] Use the thread's static variable pointer to construct a singleton pattern so that each thread corresponds to a ring buffer.
[0019] In a second aspect, the present application also provides a log calling device, including:
[0020] The production module is used to initialize system configuration and call the log interface to generate logs;
[0021] A determination module, used to determine a corresponding ring buffer based on a static variable pointer of a thread corresponding to the log;
[0022] A storage module, used for storing the log in the ring buffer, and storing a mapping relationship between a file disk address and a virtual address of the log in a memory mapping portion in a process virtual address space of a processing process;
[0023] A processing module is used to process the log through the processing process based on the mapping relationship.
[0024] In a third aspect, the present application further provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are implemented:
[0025] Initialize system configuration and call the log interface to generate logs;
[0026] Determine a corresponding ring buffer based on a static variable pointer of the thread corresponding to the log;
[0027] The log is stored in the ring buffer, and a mapping relationship between a file disk address and a virtual address of the log is stored in a memory mapping portion in a process virtual address space of a processing process;
[0028] Based on the mapping relationship, the log is processed by the processing process.
[0029] In a fourth aspect, the present application further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the following steps are implemented:
[0030] Initialize system configuration and call the log interface to generate logs;
[0031] Determine a corresponding ring buffer based on a static variable pointer of the thread corresponding to the log;
[0032] The log is stored in the ring buffer, and a mapping relationship between a file disk address and a virtual address of the log is stored in a memory mapping portion in a process virtual address space of a processing process;
[0033] Based on the mapping relationship, the log is processed by the processing process.
[0034] In a fifth aspect, the present application further provides a computer program product, including a computer program, which implements the following steps when executed by a processor:
[0035] Initialize system configuration and call the log interface to generate logs;
[0036] Determine a corresponding ring buffer based on a static variable pointer of the thread corresponding to the log;
[0037] The log is stored in the ring buffer, and a mapping relationship between a file disk address and a virtual address of the log is stored in a memory mapping portion in a process virtual address space of a processing process;
[0038] Based on the mapping relationship, the log is processed by the processing process.
[0039] The log calling method, device, computer equipment, computer readable storage medium and computer program product generate logs by calling the log interface through initializing the system configuration; determine the corresponding ring buffer based on the static variable pointer of the thread corresponding to the log; store the log in the ring buffer, and store the mapping relationship between the file disk address and the virtual address of the log in the memory mapping part in the process virtual address space of the processing process; and process the log through the processing process based on the mapping relationship. Therefore, the system can be accessed directly through the memory address through memory mapping without the need for traditional file read and write operations, thereby improving the efficiency of the system in accessing data. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the drawings required for use in the embodiments of the present application or related technical descriptions will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0041] FIG1 is a schematic diagram of a flow chart of a log calling method in one embodiment;
[0042] FIG2 is a schematic diagram of a storage module based on memory mapping in a log calling method in another embodiment;
[0043] FIG3 is a structural block diagram of a log calling device in one embodiment;
[0044] FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0045] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0046] The log calling method provided in the embodiment of the present application can be applied to the log processing process of any system.
[0047] In one embodiment, as shown in FIG1 , a log calling method is provided. This embodiment uses the method applied to a terminal as an example. It is understandable that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. Among them, the terminal can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, Internet of Things devices and portable wearable devices. The Internet of Things devices can be smart speakers, smart TVs, smart air conditioners, smart car devices, projection devices, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, etc. The head-mounted device can be a virtual reality (VR) device, an augmented reality (AR) device, smart glasses, etc. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud computing services. In this embodiment, the method includes the following steps:
[0048] Step 102, initialize system configuration and call the log interface to generate logs.
[0049] Among them, system configuration includes the configuration of the operating system, the configuration of network services and the configuration of applications; the log interface is a mechanism used in software development to record and track the running status of the program.
[0050] In some embodiments, the terminal will initialize the configuration of the operating system, the configuration of the network service, and the configuration of the application, and generate corresponding logs based on each thread through the embedded code calling the log interface. Among them, the thread is the smallest unit that the operating system can calculate and schedule, and is the actual operation unit in the process.
[0051] Step 104: Determine the corresponding ring buffer based on the static variable pointer of the thread corresponding to the log.
[0052] Among them, the static variable pointer is a variable declared using the static keyword in the code, and the corresponding variable can be accessed through the static variable pointer; the ring buffer is a special data structure suitable for storing and processing data in a fixed-size buffer.
[0053] Specifically, after generating the log corresponding to each thread, the terminal determines the corresponding ring buffer according to the static variable pointer of each thread.
[0054] Step 106: store the log in the ring buffer, and store the mapping relationship between the file disk address and the virtual address of the log in the memory mapping part in the process virtual address space of the processing process.
[0055] Among them, the file disk address refers to the physical location of the file on the disk; the process virtual address space refers to a set of virtual memory addresses allocated to each process by the operating system when it is running.
[0056] In some specific embodiments, after determining the circular buffer corresponding to each log, the terminal stores the log in the corresponding circular buffer, starts a thread to read the log, and stores the mapping relationship between the log's file disk address and virtual address in the memory mapping part of the process virtual address space.
[0057] Step 108: Based on the mapping relationship, the log is processed by the processing process.
[0058] In some embodiments, the file socket is opened, the system function mmap (memory mapping) is called, and the file disk address corresponding to the corresponding log is directly opened.
[0059] In the above log calling method, first, by initializing the system configuration, the log interface is called to generate a log; based on the static variable pointer of the thread corresponding to the log, the corresponding ring buffer is determined; the log is stored in the ring buffer, and the mapping relationship between the file disk address and the virtual address of the log is stored in the memory mapping part in the process virtual address space of the processing process; based on the mapping relationship, the log is processed by the processing process. Therefore, through memory mapping, the system can be accessed directly through the memory address without the need for traditional file read and write operations, which improves the efficiency of the system accessing data.
[0060] In some exemplary embodiments, determining the corresponding ring buffer based on the static variable pointer of the thread corresponding to the log further includes: creating a corresponding ring buffer when the static variable pointer of the thread corresponding to the log is a null pointer.
[0061] In actual implementation, the terminal will determine the ring buffer corresponding to the thread through the static variable pointer of the thread corresponding to the log, and further store the corresponding log in the corresponding ring buffer. When the static variable pointer of the thread corresponding to the log is a null pointer, it means that the thread is writing a log for the first time, so a ring buffer corresponding to the thread is created and the corresponding log is stored in the ring buffer.
[0062] In the above embodiment, by creating a corresponding ring buffer when storing logs once, the time for subsequent log storage is reduced and the processing efficiency of the system is improved.
[0063] In some exemplary embodiments, initializing the system configuration, before calling the log interface to generate logs, includes: setting the ring buffer to a lock-free ring buffer based on atomic operations and memory barriers.
[0064] In actual implementation, before the terminal generates logs, the terminal will design a ring buffer, and through atomic operations and memory barriers, the ring buffer will be turned into a lock-free ring buffer. Among them, the memory barrier is a type of synchronization barrier instruction used to control the order of memory operations; the atomic operation refers to an operation that cannot be terminated or divided during execution.
[0065] In the above embodiment, by setting the ring buffer as a lock-free ring buffer, lock-free operation of the ring buffer can be achieved, so that the ring buffer is a single-producer and single-consumer queue, ensuring that data reading and writing operations can still be performed efficiently under high concurrency conditions, thereby improving the processing performance of the system.
[0066] In some exemplary embodiments, the mapping relationship between the file disk address and the virtual address of the log is stored in a memory mapping part in the process virtual address space of the processing process, and also includes: when the memory mapping part is full, calling a system function to release the mapping relationship, creating a new memory mapping part, and storing the remaining mapping relationship in the newly created memory mapping part.
[0067] In actual implementation, the terminal continuously stores the mapping relationship between the file disk address and the virtual address of the log in the process memory mapping part. When the memory mapping part is full, the system mapping memory function is called to release the mapping relationship, a new memory mapping part is created, and the mapping relationship not stored in the memory mapping part is then stored in the newly created memory mapping part.
[0068] In some exemplary embodiments, the mapping relationship between the file disk address and the virtual address of the log is stored in the memory mapping part in the process virtual address space of the processing process, and also includes: when all memory mapping parts are full, calling the system function to release the mapping relationship and overwriting the mapping relationship in the initially created memory mapping part with the latest mapping relationship.
[0069] In actual implementation, after all memory mapping parts are fully stored, the system mapping memory function is called to release the mapping relationship, and the latest mapping relationship overwrites the mapping relationship in the initially created memory mapping part.
[0070] In the above embodiment, when the memory mapping part is full, the terminal calls the system mapping memory function to release the mapping relationship, overwrites the mapping relationship in the initially created memory mapping part with the latest mapping relationship, and re-establishes the mapping relationship.
[0071] In the above embodiment, the mapping relationship in the memory mapping part is continuously updated, so that the log address in the system is always valid.
[0072] In some exemplary embodiments, initializing the system configuration and before calling the log interface to generate logs includes: constructing a singleton mode using a static variable pointer of a thread so that each thread corresponds to a ring buffer.
[0073] In actual implementation, before the terminal initializes the system configuration and calls the log interface to generate logs, it will use the thread's static variable pointer to construct a singleton pattern so that each thread corresponds to a ring buffer.
[0074] In the above embodiment, by constructing a singleton pattern, different threads have their own ring buffer, so as to further reduce lock contention and improve system performance.
[0075] To explain the log calling method in the present application in detail, an embodiment is used for explanation below. By way of example, the present application is explained with a log calling method in a specific scenario.
[0076] First, the terminal will initialize the configuration of the operating system, network services, and applications, and call the log interface through embedded code to generate corresponding logs based on each thread. Among them, the thread is the smallest unit that the operating system can calculate and schedule, and is the actual operation unit in the process. After generating the log corresponding to each thread, the corresponding ring buffer will be determined based on the static variable pointer of each thread.
[0077] The log is stored in the corresponding ring buffer, a thread is started to read the log, and the mapping relationship between the log file disk address and the virtual address is stored in the memory mapping part of the process virtual address space. The specific storage module based on memory mapping is shown in Figure 2. Among them, offset represents the current file disk address, len represents the length, the bss data segment is used to store the memory area of the uninitialized global variables in the program, and the text data segment represents the size of the program segment.
[0078] When the static variable pointer of the thread corresponding to the log is a null pointer, it means that the thread is writing a log for the first time, so a ring buffer corresponding to the thread is created and the corresponding log is stored in the ring buffer.
[0079] Furthermore, the terminal opens the file socket, calls the system function mmap (memory mapping), and directly opens the file disk address corresponding to the corresponding log.
[0080] This application uses a static variable singleton design, and a lock-free ring buffer is used in the log cache area, so that lock-free operation and thread safety can be achieved under multi-threaded high concurrency, effectively improving the performance of the log system; mmap memory mapping is used in the storage layer, and an mmap expansion solution is designed in the mmap mode to achieve high-performance reading and writing of log files and no log loss.
[0081] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0082] Based on the same inventive concept, the embodiment of the present application also provides a log calling device for implementing the log calling method involved above. The implementation scheme for solving the problem provided by the device is similar to the implementation scheme recorded in the above method, so the specific limitations in one or more log calling device embodiments provided below can refer to the limitations on the log calling method above, and will not be repeated here.
[0083] In an exemplary embodiment, as shown in FIG3 , a log calling device is provided, including: a production module 301, a determination module 302, a storage module 303 and a processing module 304, wherein:
[0084] The production module is used to initialize system configuration and call the log interface to generate logs;
[0085] A determination module, used to determine a corresponding ring buffer based on a static variable pointer of a thread corresponding to the log;
[0086] A storage module, used for storing the log in the ring buffer, and storing a mapping relationship between a file disk address and a virtual address of the log in a memory mapping portion in a process virtual address space of a processing process;
[0087] A processing module is used to process the log through the processing process based on the mapping relationship.
[0088] In some embodiments, the device further includes a creation module, which is used to create a corresponding ring buffer when the static variable pointer of the thread corresponding to the log is a null pointer.
[0089] In some embodiments, the apparatus further comprises a setting module for setting the ring buffer as a lock-free ring buffer based on an atomic operation and a memory barrier.
[0090] In some embodiments, the creation module is also used to call a system function to release the mapping relationship when the memory mapping part is full, create a new memory mapping part, and store the remaining mapping relationship in the newly created memory mapping part.
[0091] In some embodiments, the device further includes an overwriting module for calling a system function to release the mapping relationship when all memory mapping parts are full, and overwriting the mapping relationship in the initially created memory mapping part with the latest mapping relationship.
[0092] In some embodiments, the device further comprises a construction module for constructing a singleton pattern using a static variable pointer of a thread, so that each thread corresponds to a circular buffer.
[0093] Each module in the above-mentioned log calling device can be implemented in whole or in part by software, hardware and their combination. Each module can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each module above.
[0094] In an exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be shown in FIG4. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. The processor, the memory, and the input / output interface are connected via a system bus, and the communication interface, the display unit, and the input device are connected to the system bus via the input / output interface. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used to exchange information between the processor and an external device. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner may be implemented through WIFI, a mobile cellular network, near field communication (NFC) or other technologies. When the computer program is executed by the processor, a log calling method is implemented. The display unit of the computer device is used to form a visually visible picture, which may be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covering the display screen, or a button, trackball or touchpad set on the computer device shell, or an external keyboard, touchpad or mouse.
[0095] Those skilled in the art will understand that the structure shown in FIG. 4 is merely a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.
[0096] In an exemplary embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0097] Initialize system configuration and call the log interface to generate logs;
[0098] Determine a corresponding ring buffer based on a static variable pointer of the thread corresponding to the log;
[0099] The log is stored in the ring buffer, and a mapping relationship between a file disk address and a virtual address of the log is stored in a memory mapping portion in a process virtual address space of a processing process;
[0100] Based on the mapping relationship, the log is processed by the processing process.
[0101] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0102] Initialize system configuration and call the log interface to generate logs;
[0103] Determine a corresponding ring buffer based on a static variable pointer of the thread corresponding to the log;
[0104] The log is stored in the ring buffer, and a mapping relationship between a file disk address and a virtual address of the log is stored in a memory mapping portion in a process virtual address space of a processing process;
[0105] Based on the mapping relationship, the log is processed by the processing process.
[0106] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0107] Initialize system configuration and call the log interface to generate logs;
[0108] Determine a corresponding ring buffer based on a static variable pointer of the thread corresponding to the log;
[0109] The log is stored in the ring buffer, and a mapping relationship between a file disk address and a virtual address of the log is stored in a memory mapping portion in a process virtual address space of a processing process;
[0110] Based on the mapping relationship, the log is processed by the processing process.
[0111] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant regulations.
[0112] A person of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment method can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, an artificial intelligence (AI) processor, etc., but are not limited to this.
[0113] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0114] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A log calling method, characterized in that: The method comprises: Initialize system configuration and call the log interface to generate logs; Determine a corresponding ring buffer based on a static variable pointer of the thread corresponding to the log; The log is stored in the ring buffer, and a mapping relationship between a file disk address and a virtual address of the log is stored in a memory mapping portion in a process virtual address space of a processing process; Based on the mapping relationship, the log is processed by the processing process.
2. The method according to claim 1, characterized in that The determining of the corresponding ring buffer based on the static variable pointer of the thread corresponding to the log further includes: When the static variable pointer of the thread corresponding to the log is a null pointer, a corresponding ring buffer is created.
3. The method according to claim 1, characterized in that The initialization system configuration, before calling the log interface to generate logs, includes: setting the ring buffer as a lock-free ring buffer based on atomic operations and memory barriers.
4. The method according to claim 1, characterized in that: The memory mapping part in the process virtual address space of the processing process stores the mapping relationship between the file disk address and the virtual address of the log, and also includes: When the memory mapping part is full, the system function is called to release the mapping relationship, a new memory mapping part is created, and the remaining mapping relationship is stored in the newly created memory mapping part.
5. The method according to claim 4, characterized in that The method further comprises: When all memory mapping parts are full, the system function is called to release the mapping relationship, and the latest mapping relationship overwrites the mapping relationship in the initially created memory mapping part.
6. The method according to claim 1, characterized in that The initialization system configuration, before calling the log interface to generate logs, includes: Use the thread's static variable pointer to construct a singleton pattern so that each thread corresponds to a ring buffer.
7. A log calling device, characterized in that: The device comprises: The production module is used to initialize system configuration and call the log interface to generate logs; A determination module, used to determine a corresponding ring buffer based on a static variable pointer of a thread corresponding to the log; A storage module, used for storing the log in the ring buffer, and storing a mapping relationship between a file disk address and a virtual address of the log in a memory mapping portion in a process virtual address space of a processing process; A processing module is used to process the log through the processing process based on the mapping relationship.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.