CN109491974A - Asynchronous blog management method and system and computer readable storage medium - Google Patents

Asynchronous blog management method and system and computer readable storage medium Download PDF

Info

Publication number
CN109491974A
CN109491974A CN201811191006.6A CN201811191006A CN109491974A CN 109491974 A CN109491974 A CN 109491974A CN 201811191006 A CN201811191006 A CN 201811191006A CN 109491974 A CN109491974 A CN 109491974A
Authority
CN
China
Prior art keywords
log
journal file
buffer
asynchronous
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201811191006.6A
Other languages
Chinese (zh)
Inventor
吕军亮
田超超
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Golden Master Network Technology Co Ltd
Original Assignee
Shanghai Golden Master Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shanghai Golden Master Network Technology Co Ltd filed Critical Shanghai Golden Master Network Technology Co Ltd
Priority to CN201811191006.6A priority Critical patent/CN109491974A/en
Publication of CN109491974A publication Critical patent/CN109491974A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The present invention provides a kind of asynchronous blog management method and systems, and logging level setting module: to output journal interface division log rank, the log rank includes at least 2, and the rank of journal file and the log rank of output journal interface are corresponding;Buffer memory module: being stored in buffer journal file to be written, when buffer capacity reaches maximum capacity, execution journal file writing module;Log writing module: log library thread is individually distributed to the write-in of journal file.The present invention is based on more producer's list Consumer models, by rating dynamic filtration, log content is classified, API is simply easily used, compact and flexible, multithreading safety, it supports several operation systems, such as Windows, Linux, supports the customized way of output, simply easily used by level dynamic filtering, interface, development efficiency is greatly improved, code issue place is found out.

Description

Asynchronous blog management method and system and computer readable storage medium
Technical field
The present invention relates to cross-platform programming fields, and in particular, to a kind of asynchronous blog management method and system and calculating Machine readable storage medium storing program for executing, especially a kind of High-Performance Asynchronous blog management method and system and computer readable storage medium.
Background technique
The interface that existing major part log library is supplied to user is more, and does not support multiple operating system, does not support by rank, mark Label carry out dynamic filtration.
The interface that synchronization log is supplied to user is cumbersome, using complexity, much fails to accomplish categorical filtering and log head Storage, and journal file can be written in log API system of every callings, certainly this log generation infrequently in the case where not yet It can be problematic.If log generates very frequent, it is necessary to the support in a set of High-Performance Asynchronous log library.
Summary of the invention
For the defects in the prior art, the object of the present invention is to provide a kind of asynchronous blog management method and system and meters Calculation machine readable storage medium storing program for executing.
A kind of asynchronous Log Administration System provided according to the present invention, comprises the following modules, logging level setting module: right Output journal interface division log rank, the rank of journal file and the log rank of output journal interface are corresponding;buffer Memory module: the journal file being written into is stored in locally buffered district's groups, and when local buffer, pool-size reaches maximum appearance When amount, journal file writing module is triggered;Log writing module: log library thread is individually distributed to the write-in of journal file.
Preferably, the asynchronous Log Administration System further includes that log locks module: to the transmission in the thread of log library Journal file carries out locking setting, described to lock setting using the thread lock mechanism for introducing exclusive variable.
Preferably, the asynchronous Log Administration System, further includes journal file creation module: to journal file to be written Determine file size, if journal file is greater than the set value, replication log file simultaneously creates new journal file, otherwise, then marks The file that keeps a diary is less than setting value.
A kind of asynchronous blog management method provided according to the present invention, includes the following steps, logging level setting procedure: right Output journal interface division log rank, the rank of journal file and the log rank of output journal interface are corresponding;buffer Storing step: the journal file being written into is stored in locally buffered district's groups, and when local buffer, pool-size reaches maximum appearance When amount, journal file write step is triggered;Log write step: log library thread is individually distributed to the write-in of journal file.
Preferably, the asynchronous blog management method further includes that log locks step: to the transmission in the thread of log library Journal file carries out locking setting, described to lock setting using the thread lock mechanism for introducing exclusive variable.
Preferably, the asynchronous blog management method, further includes journal file foundation step: to journal file to be written Determine file size, if journal file is greater than the set value, replication log file simultaneously creates new journal file, otherwise, then marks The file that keeps a diary is less than setting value.
Preferably, the log to be written includes log content information, log head information;Log write-in includes log content Information, the write-in of the information of log head information;The locally buffered district's groups include current buffer buffer, at least two free time Buffer, described two free time buffer are denoted as the first free time buffer, the second free time buffer respectively, if current buffer quilt It writes completely, then the first free time buffer is written into current buffer buffer, it, will using the second free time buffer as current buffer Journal file is written in first free time buffer;The log rank includes 2.
Preferably, the log head information includes write time, the affiliated rank of log, log library thread information, file line Number any one of or appoint it is a variety of.
A kind of computer readable storage medium for being stored with computer program provided according to the present invention, the computer journey The step of above method is realized when sequence is executed by processor.
Compared with prior art, the present invention have it is following the utility model has the advantages that
1, API is simply easily used, compact and flexible, and multithreading safety supports several operation systems, such as Windows, Linux Deng;
2, it supports the customized way of output, simply easily used by level dynamic filtering, interface.Greatly improve exploitation effect Rate is found the problem.
3, log content is classified by rating dynamic filtration based on more producer's list Consumer models.
Detailed description of the invention
Upon reading the detailed description of non-limiting embodiments with reference to the following drawings, other feature of the invention, Objects and advantages will become more apparent upon:
Fig. 1 is structural framing figure of the invention.
Specific embodiment
The present invention is described in detail combined with specific embodiments below.Following embodiment will be helpful to the technology of this field Personnel further understand the present invention, but the invention is not limited in any way.It should be pointed out that the ordinary skill of this field For personnel, without departing from the inventive concept of the premise, several changes and improvements can also be made.These belong to the present invention Protection scope.
A kind of disclosed asynchronous blog management method according to the present invention, comprising the following steps: logging level setting procedure: right Output journal interface division log rank, the log rank include at least 2, the rank and output journal interface of journal file Log rank it is corresponding;Buffer storing step: the journal file being written into is stored in locally buffered district's groups, works as local When buffer set capacity reaches maximum capacity, journal file write step is triggered;Log write step: the write-in to journal file Individually distribution log library thread.
Specifically, the asynchronous blog management method further includes that log locks step: to the transmission in the thread of log library Journal file carries out locking setting, described to lock setting using the thread lock mechanism for introducing exclusive variable.
Specifically, the asynchronous blog management method further includes journal file foundation step: to journal file to be written Determine file size, if journal file is greater than the set value, replication log file simultaneously creates new journal file, otherwise, then marks The file that keeps a diary is less than setting value.
Specifically, the log to be written includes log content information, log head information;Log write-in includes log content Information, the write-in of the information of log head information;The local buffer group includes current buffer buffer, at least two free time Buffer, described two free time buffer are denoted as the first free time buffer, the second free time buffer respectively, if current buffer quilt It writes completely, then the first free time buffer is written into current buffer buffer, it, will using the second free time buffer as current buffer Journal file is written in first free time buffer.
Specifically, the log head information includes write time, the affiliated rank of log, log library thread information, file line Number any one of or appoint it is a variety of.
Disclosed a kind of computer readable storage medium for being stored with computer program according to the present invention, the computer journey The step of above method is realized when sequence is executed by processor.
Disclosed a kind of asynchronous Log Administration System according to the present invention, comprises the following modules: logging level setting module: right Output journal interface division log rank, the log rank include at least 2, the rank and output journal interface of journal file Log rank it is corresponding;Buffer memory module: the journal file being written into is stored in locally buffered district's groups, works as local When buffer set capacity reaches maximum capacity, journal file writing module is triggered;Log writing module: the write-in to journal file Individually distribution log library thread.
Specifically, the asynchronous Log Administration System further includes that log locks module: to the transmission in the thread of log library Journal file carries out locking setting, described to lock setting using the thread lock mechanism for introducing exclusive variable.
Specifically, the asynchronous Log Administration System further includes journal file creation module: to journal file to be written Determine file size, if journal file is greater than the set value, replication log file simultaneously creates new journal file.
Asynchronous Log Administration System provided by the invention can be realized by the step process of asynchronous blog management method. Asynchronous blog management method can be interpreted as the preference of the asynchronous Log Administration System by those skilled in the art.
The present invention relates to there is a High-Performance Asynchronous log library, High-Performance Asynchronous log library is the list of the producer more than one The model of consumer provides a set of lightweight, high performance C log library to developer, embeddable to arrive any client or clothes It is engaged in device.It can be used in windows and Linux system.It is not only suitable for general PC operating system project, also can operate with To in the exigent embedded system of Memory Allocation.For front end interface user, accomplish non-obstruction addition, then first day of the lunar year will Write-in it is noted that disk I/O bottleneck.The present invention provides 0~4 totally 5 output journal grade interfaces, respectively BASEDEBUG, Rating is arranged when initializing log in DEBUG, WARN, ERROR and FAULT.Log calls write frequently to will lead to Expense of uniting is very big, therefore designs a buffer and store log content, the one-time write after buffer is full.This hair Bright is to apply for muti-piece buffer when initializing with local multiple buffer technology, using main thread call log interface to Data in buffer are extracted write-in file by number completion evidence in buffer, backstage log.Content is embodied: first to file is worked as Preceding buffer area buffer and two pieces of idle buffer, respectively buffer1, buffer2.When current buffer is fully written, first Current buffer is moved into buffer1, then buffer2 is converted into current buffer, then buffer1 write-in log text Part.The effect of this realization withouts waiting for disk I/O operation when being mainly reflected in newly-built log information, reduce and wait.It writes It may be blocked in current location when entering log, to guarantee that main thread is not blocked, need individually to apply for thread process log IO write-in.The model of more producer's list consumers is being that log itself is used as a background thread to go to complete by the example in invention Journalizing, here as the consumer of log.And the main thread being applied to is to be responsible for passing through printing for the producer of log Interface removes production daily record data.Such model mechanism cooperate more buffer bufferings can make to call using main thread log interface at For non-blocking operation.
Log library also stores log head information, such as time, affiliated not only by the write-in disk of content intact Module, specific thread information, file line number etc..Therefore each grade interfaces need to realize its head and body.To guarantee log library Thread-safe needs to be added log lock.When journal file is more than the maximum length of setting, file is replicated and creates new file.
In specific implementation, PC client software needs developer to carry out white-box testing to different block codes. Firstly, data are sent server by HTTP by developer, http response time-out or normal response are wondered.Then, in mould This log library is initialized in block, calls respective level interface.After executing code white-box testing, catalogue where log, exhibition are opened Log file is opened, program flow logic can be analyzed.
One skilled in the art will appreciate that in addition to realizing system provided by the invention in a manner of pure computer readable program code It, completely can be by the way that method and step be carried out programming in logic come so that provided by the invention other than system, device and its modules System, device and its modules are declined with logic gate, switch, specific integrated circuit, programmable logic controller (PLC) and insertion The form of controller etc. realizes identical program.So system provided by the invention, device and its modules may be considered that It is a kind of hardware component, and the knot that the module for realizing various programs for including in it can also be considered as in hardware component Structure;It can also will be considered as realizing the module of various functions either the software program of implementation method can be Hardware Subdivision again Structure in part.
Specific embodiments of the present invention are described above.It is to be appreciated that the invention is not limited to above-mentioned Particular implementation, those skilled in the art can make a variety of changes or modify within the scope of the claims, this not shadow Ring substantive content of the invention.In the absence of conflict, the feature in embodiments herein and embodiment can any phase Mutually combination.

Claims (9)

1. a kind of asynchronous Log Administration System, which is characterized in that comprise the following modules:
Logging level setting module: to output journal interface division log rank, the rank and output journal interface of journal file Log rank it is corresponding;
Buffer memory module: the journal file being written into is stored in locally buffered district's groups, when local buffer pool-size When reaching maximum capacity, journal file writing module is triggered;
Log writing module: log library thread is individually distributed to the write-in of journal file.
2. asynchronous Log Administration System according to claim 1, which is characterized in that further include:
Log locks module: carrying out locking setting to the journal file of the transmission in the thread of log library, the locking setting uses Introduce the thread lock mechanism of exclusive variable.
3. asynchronous Log Administration System according to claim 1, which is characterized in that further include:
Journal file creation module: determining file size to journal file to be written, multiple if journal file is greater than the set value Journal file processed simultaneously creates new journal file, otherwise, then journal file is marked to be less than setting value.
4. a kind of asynchronous blog management method, which comprises the following steps:
Logging level setting procedure: to output journal interface division log rank, the rank and output journal interface of journal file Log rank it is corresponding;
Buffer storing step: the journal file being written into is stored in locally buffered district's groups, when local buffer pool-size When reaching maximum capacity, journal file write step is triggered;
Log write step: log library thread is individually distributed to the write-in of journal file.
5. asynchronous blog management method according to claim 4, which is characterized in that further include that log locks step: to day The journal file of transmission in the thread of will library carries out locking setting, described to lock setting using the thread lock machine for introducing exclusive variable System.
6. asynchronous blog management method according to claim 4, which is characterized in that further include journal file foundation step: File size, if journal file is greater than the set value, replication log file are determined to journal file to be written and created newly Otherwise journal file then marks journal file to be less than setting value.
7. asynchronous Log Administration System according to claim 1 or asynchronous log management according to claim 4 Method, which is characterized in that the log to be written includes log content information, log head information;
Log write-in includes log content information, the write-in of the information of log head information;
The locally buffered district's groups include current buffer buffer, at least two free time buffer, described two free time Buffer is denoted as the first free time buffer, the second free time buffer respectively, if current buffer is fully written, by current buffer The first free time buffer is written in buffer, and using the second free time buffer as current buffer, the first free time buffer is written Journal file;The log rank includes 2.
8. asynchronous Log Administration System according to claim 3 or asynchronous log management according to claim 6 Method, which is characterized in that the log head information includes write time, the affiliated rank of log, log library thread information, file line Number any one of or appoint it is a variety of.
9. a kind of computer readable storage medium for being stored with computer program, which is characterized in that the computer program is located Manage the step of method described in any one of claim 4 to 8 is realized when device executes.
CN201811191006.6A 2018-10-12 2018-10-12 Asynchronous blog management method and system and computer readable storage medium Pending CN109491974A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811191006.6A CN109491974A (en) 2018-10-12 2018-10-12 Asynchronous blog management method and system and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811191006.6A CN109491974A (en) 2018-10-12 2018-10-12 Asynchronous blog management method and system and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN109491974A true CN109491974A (en) 2019-03-19

Family

ID=65689700

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811191006.6A Pending CN109491974A (en) 2018-10-12 2018-10-12 Asynchronous blog management method and system and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN109491974A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112306980A (en) * 2020-10-30 2021-02-02 深圳市元征科技股份有限公司 Log processing method and terminal equipment
CN112732522A (en) * 2020-12-31 2021-04-30 东风汽车集团有限公司 Configurable log storage and analysis method and system for vehicle-mounted MCU
CN113342276A (en) * 2021-06-13 2021-09-03 苏州浪潮智能科技有限公司 Log saving method, system, device and medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6101504A (en) * 1998-04-24 2000-08-08 Unisys Corp. Method for reducing semaphore contention during a wait to transfer log buffers to persistent storage when performing asynchronous writes to database logs using multiple insertion points
CN106407028A (en) * 2016-08-26 2017-02-15 佛山智能装备技术研究院 Double-buffering type robot software log storage method
CN106708578A (en) * 2016-12-23 2017-05-24 北京五八信息技术有限公司 Dual-thread-based journal output method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6101504A (en) * 1998-04-24 2000-08-08 Unisys Corp. Method for reducing semaphore contention during a wait to transfer log buffers to persistent storage when performing asynchronous writes to database logs using multiple insertion points
CN106407028A (en) * 2016-08-26 2017-02-15 佛山智能装备技术研究院 Double-buffering type robot software log storage method
CN106708578A (en) * 2016-12-23 2017-05-24 北京五八信息技术有限公司 Dual-thread-based journal output method and device

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112306980A (en) * 2020-10-30 2021-02-02 深圳市元征科技股份有限公司 Log processing method and terminal equipment
CN112732522A (en) * 2020-12-31 2021-04-30 东风汽车集团有限公司 Configurable log storage and analysis method and system for vehicle-mounted MCU
CN113342276A (en) * 2021-06-13 2021-09-03 苏州浪潮智能科技有限公司 Log saving method, system, device and medium
CN113342276B (en) * 2021-06-13 2023-01-06 苏州浪潮智能科技有限公司 Log saving method, system, device and medium

Similar Documents

Publication Publication Date Title
CN109491974A (en) Asynchronous blog management method and system and computer readable storage medium
US10346381B2 (en) Atomic update operations in a data storage system
CN109522029A (en) A kind of method and device for disposing cloud platform technology component
CN102054034A (en) Implementation method for business basic data persistence of enterprise information system
US20140237554A1 (en) Unified platform for big data processing
CN110737504B (en) Fault-tolerant method, system, terminal and storage medium for deep learning model training
CN102455909A (en) Method for asynchronously loading power point documents
Miller et al. Open source big data analytics frameworks written in scala
CN109634569A (en) Process implementation method, device, equipment and readable storage medium storing program for executing based on note
CA3203793C (en) System and method for real-time, dynamic creation, delivery, and use of customizable web applications
CN103365926A (en) Method and device for storing snapshot in file system
CN104049947A (en) Dynamic Rename Based Register Reconfiguration Of A Vector Register File
WO2018022303A1 (en) Capturing commands in a multi-engine graphics processing unit
CN109507991A (en) A kind of two axis servo control platform debugging system and method
CN104123104B (en) Daily record control system and method
CN109656868A (en) A kind of internal storage data transfer method between CPU and GPU
CN112948136A (en) Method for implementing asynchronous log record of embedded operating system
Popovic et al. Formal verification of distributed transaction management in a SOA based control system
Raynal Concurrent crash-prone shared memory systems: a few theoretical notions
CN106250154A (en) Visual programming system based on the storage of stream data real-time cloud
Ferreira et al. Formal verification of object-oriented graph grammars specifications
CN105183491A (en) Cross-platform desktop GIS and starting method thereof
CN110245148A (en) A kind of date storage method, device, system and medium
Park Improving the performance of HDFS by reducing I/O using adaptable I/O system
CN110008281A (en) Method and device for processing visualized data based on Redis database

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190319