Multi-threaded log management method and multi-threaded log management device

A multi-threading and logging technology, applied in electrical digital data processing, special data processing applications, instruments, etc., can solve problems such as performance degradation, system waiting, and poor system real-time performance, and achieve the effect of avoiding system waiting and improving system performance.

Active Publication Date: 2013-09-18
SHENZHEN TENCENT COMP SYST CO LTD
View PDF3 Cites 21 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] However, when the existing technology is used for log file operations, it will cause the system to wait, resulting in poor real-time performance of the system and performance degradation

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Multi-threaded log management method and multi-threaded log management device
  • Multi-threaded log management method and multi-threaded log management device
  • Multi-threaded log management method and multi-threaded log management device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0026] The embodiment of the present invention provides a multi-threaded log management method, such as figure 1 As shown, the method includes the following steps:

[0027] Step 101: Obtain the system file descriptor FD, writing level and writing content of the log written by the thread;

[0028] Before step 101, a log file creation process in the main thread is also included, and the process includes:

[0029] Setting attributes of the log object in the main thread, the attributes including the log file name of the log file;

[0030] Open or create a log file corresponding to the log file name;

[0031] A system file descriptor FD corresponding to the log file is set in the main thread.

[0032] Step 102: When the write level is greater than a preset level, write the written content into a log file corresponding to the FD.

[0033] Optionally, when the write level is greater than a preset level, obtain the current write time and the current thread number;

[0034] The reusable thread-safe...

Embodiment 2

[0045] Such as image 3 As shown, the embodiment of the present invention provides a schematic diagram of the overall structure of a multi-threaded log management and use mechanism, which mainly includes a file system, a log management module, and a log call (write) module. The file system, the log management module, and the log call (write) module are named according to the function of each module, which are different from the modules in the device used in the method of multithreaded log management in the present invention.

[0046] File system refers to the file that is recorded in the file system and viewed as subsequent logs. In the file system, each opened log file corresponds to an FD, and the file can be written, switched, etc. through the FD corresponding to the log file operating.

[0047] The log management module includes log object management, log creation, log writing, log switching, log configuration and other modules. According to the log configuration, the log mana...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a multi-threaded log management method and a multi-threaded log management device, and relates to the technical field of business processing logic application. System waiting can be prevented, so that the system is processed in real time, and the system performance is improved. According to the embodiment of the invention, by obtaining the file descriptor FD, write-in level and write-in content of the system of a threaded write-in log, when the write-in level is greater than a preset level, the write-in content is written in the corresponding log file of the FD. The scheme provided by the embodiment of the invention is suitable for being applied to multi-threaded log management.

Description

Technical field [0001] The present invention relates to the technical field of business processing logic application, in particular to a method and device for multithreaded log management. Background technique [0002] In the business processing process, usually multiple threads are processed at the same time, and the processing results are recorded in the log file at the key logical step. Threads control the processing flow in a single order in the business processing logic. Running multiple threads in a single business processing logic to complete different tasks at the same time is called multithreading. Log refers to a collection of certain operations and their operation results on objects specified by the system in a chronological order. Logs are very important for system monitoring, query, reporting, and security auditing. Therefore, in addition to meeting the requirements of basic log management and use, the system must further ensure thread safety without serious perform...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F17/30
Inventor 黄明生
Owner SHENZHEN TENCENT COMP SYST CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products