CN102609484A - General method for managing log of system - Google Patents

General method for managing log of system Download PDF

Info

Publication number
CN102609484A
CN102609484A CN2012100181192A CN201210018119A CN102609484A CN 102609484 A CN102609484 A CN 102609484A CN 2012100181192 A CN2012100181192 A CN 2012100181192A CN 201210018119 A CN201210018119 A CN 201210018119A CN 102609484 A CN102609484 A CN 102609484A
Authority
CN
China
Prior art keywords
log
daily record
file
current
write
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
CN2012100181192A
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.)
BEIJING DIGITAL CHINA SI-TECH INFORMATION TECHNOLOGY Co Ltd
Original Assignee
BEIJING DIGITAL CHINA SI-TECH INFORMATION 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 BEIJING DIGITAL CHINA SI-TECH INFORMATION TECHNOLOGY Co Ltd filed Critical BEIJING DIGITAL CHINA SI-TECH INFORMATION TECHNOLOGY Co Ltd
Priority to CN2012100181192A priority Critical patent/CN102609484A/en
Publication of CN102609484A publication Critical patent/CN102609484A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a general method for managing a log of a system. The general method includes creating three shared log internal memories with the same sizes and three log file set with the same sizes; automatically switching to a next shared internal memory when the current shared internal memory is fully written, clearing the shared internal memory fully written, and recording content of relevant log into the log files; and automatically switching to the next log file set when the current log file is fully written, and archiving the log files. The general method has the advantages that the method for managing log provides a unified log writing function to be called by various modules in the application system, a unified log inquiry interface is provided, accordingly formats of the log of the integral system is completely unified assuredly, and the log can be conveniently analyzed and checked.

Description

A kind of general-purpose system blog management method
Technical field
The present invention relates to a kind of general-purpose system blog management method, write for each module of software systems provides unified, query interface, the standard journal format.
Background technology
At present, in the software systems of a complicacy, can comprise the plurality of applications module, each module all need be write the daily record of oneself.Inquiry log for ease, the day that needs each module to write aims at will unifying on the form as far as possible, and location mode is concentrated as far as possible, and history log can be preserved for a long time.
In existing systems, generally be the mode that adopts the direct written document of each module.At first,, receive the IO of system Effect on Performance, some efficient that directly written document will inevitably loss system because operation file is slow more than the operation internal memory.Secondly, owing to there are a lot of modules in the system, they will inevitably concurrently write daily record; If adopt the mode of different journal files separately of writing; Then journal file relatively disperses, and size is inhomogeneous, also can't represent the ruuning situation of all modules at a time intuitively; If adopt the mode of writing same journal file, since concurrent, the file lock need be increased again, certainly will influence the efficient of system more.
Summary of the invention
Technical matters to be solved by this invention is a kind of general-purpose system blog management method of design; Provide unified and write the supply of daily record function with each module invokes in the system; Unified log query interface is provided simultaneously; Thereby the journal format that guarantees total system is unified and standard fully, is convenient to analyze and check.
The technical scheme that the present invention solves the problems of the technologies described above is following: a kind of general-purpose system blog management method comprises the steps:
Step 1: create three onesize daily record shared drives and three onesize journal files in advance;
Step 2: when writing daily record, search the current daily record shared drive that is using;
Step 3: judge whether current daily record shared drive is write full;
Step 4: if not, the log content current daily record shared drive that writes direct finishes then; If log content writes next daily record shared drive, and change the current memory block sequence number of using into next piece; Execution in step 5;
Step 5: if all daily record shared drives have been write full daily record; Judge whether current journal file is write completely, if not, the log content of will being correlated with automatically records in the current journal file; The content of Clear Log shared drive is prepared against when switching next time and is used then; If, execution in step 6;
Step 6: write because of current journal file and full then to automatically switch to next journal file, and change the current file sequence number of using into the next one; Execution in step 7;
Step 7: if all journal files have been write full daily record, the log content of will being correlated with automatically records in the archive file, and the Clear Log file is prepared against when switching next time and used then; Each journal file is written in the independent archive file, contains current system time in the archive file name, finishes then.
The invention has the beneficial effects as follows: all module invokes are unified writes the daily record function, guarantees that the journal format of total system is unified and standard fully, is convenient to analyze and check.Application module directly writes shared drive with log content, and than the mode of traditional written document, speed of the present invention is faster.Through recycling the mode of three shared drives, make the log management process log information in the temporary transient untapped shared drive transferred in the journal file between can be at one's leisure, avoid application modules to produce and disturb.Owing to be that three internal memories recycle, so only need taking less Installed System Memory, the present invention gets final product, can not cause waste to memory headroom.
Further, journal file also adopts the journal file of three unified sizes, recycles, and each journal file can be write log content in the archive file after writing and expiring automatically, is convenient to permanent preservation.
Further, each journal file is written in the independent archive file, contains current system time in the archive file name, searches according to the time period when being convenient to log query, and the controllable size of each archive file conveniently reads fast.
Description of drawings
Fig. 1 is a process flow diagram of writing daily record of the present invention;
Fig. 2 is the process flow diagram of log management of the present invention;
Embodiment
Below in conjunction with accompanying drawing principle of the present invention and characteristic are described, institute gives an actual example and only is used to explain the present invention, is not to be used to limit scope of the present invention.
General-purpose system blog management method of the present invention comprises the steps:
Step 1: create three onesize daily record shared drives and three onesize journal files in advance;
Step 2: when writing daily record, search the current daily record shared drive that is using;
Step 3: judge whether current daily record shared drive is write full;
Step 4: if not, the log content current daily record shared drive that writes direct finishes then; If log content writes next daily record shared drive, and change the current memory block sequence number of using into next piece; Execution in step 5;
Step 5: if all daily record shared drives have been write full daily record; Judge whether current journal file is write completely, if not, the log content of will being correlated with automatically records in the current journal file; The content of Clear Log shared drive is prepared against when switching next time and is used then; If, execution in step 6;
Step 6: write because of current journal file and full then to automatically switch to next journal file, and change the current file sequence number of using into the next one; Execution in step 7;
Step 7: if all journal files have been write full daily record, the log content of will being correlated with automatically records in the archive file, and the Clear Log file is prepared against when switching next time and used then; Each journal file is written in the independent archive file, contains current system time in the archive file name, finishes then.
In step 4, as shown in Figure 1, application module calls the following daily record function of writing and writes daily record:
void?APIWriteLog(int?log_code,long?procid,int?module,int?level,int?type,char*logbuf);
Each parameter declaration is following:
Figure BDA0000132451310000041
Above-mentioned function at first judge current daily record memory block whether write full, if write full, then with the log content current daily record memory block that writes direct; Otherwise, log content is write next piece internal memory, and change current daily record internal memory sequence number into next piece, realize recycling of three daily record memory blocks.
In step 4~6; As shown in Figure 2, through special log management process, the user mode of daily record memory block and journal file is monitored in real time; There is daily record data if find other two internal memories of non-current memory block; Then the log information in the memory block is write journal file, while Clear Log memory block is in order to recycle next time.In writing the process of journal file, write completely if find current journal file, then switch to next journal file, simultaneously the journal file of writing full log content is carried out archive operation, generate the permanent daily record archive file of preserving.
Below for adopting the profile information of the inventive method, the presents configuration be the process operation time essential information used, adopt the ini file form.
Figure BDA0000132451310000051
The above is merely preferable case study on implementation of the present invention, and is in order to restriction the present invention, not all within spirit of the present invention and principle, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (6)

1. general-purpose system blog management method comprises:
Step 1: create three onesize daily record shared drives and three onesize journal files in advance;
Step 2: when writing daily record, search the current daily record shared drive that is using;
Step 3: judge whether current daily record shared drive is write full;
Step 4: if not, the log content current daily record shared drive that writes direct finishes then; If log content writes next daily record shared drive, and change the current memory block sequence number of using into next piece; Execution in step 5;
Step 5: if all daily record shared drives have been write full daily record; Judge whether current journal file is write completely, if not, the log content of will being correlated with automatically records in the current journal file; The content of Clear Log shared drive is prepared against when switching next time and is used then; If, execution in step 6;
Step 6: write because of current journal file and full then to automatically switch to next journal file, and change the current file sequence number of using into the next one; Execution in step 7;
Step 7: if all journal files have been write full daily record, the log content of will being correlated with automatically records in the archive file, and the Clear Log file is prepared against when switching next time and used then; Each journal file is written in the independent archive file, contains current system time in the archive file name, finishes then.
2. general-purpose system blog management method according to claim 1 is characterized in that: when application program is write daily record, only operate shared drive, do not relate to written document, the efficient that the action of guaranteeing to write daily record can application programs impacts.
3. general-purpose system blog management method according to claim 1 is characterized in that: three shared drives recycle, one write full after, then switch to next piece.
4. general-purpose system blog management method according to claim 1 is characterized in that: three journal files recycle, and a journal file then switches to the next one after writing and expiring.
5. general-purpose system blog management method according to claim 1 is characterized in that: each journal file can be write log content in the archive file after writing and expiring automatically, so that permanent the preservation.
6. general-purpose system blog management method according to claim 1; It is characterized in that: each journal file is written in the independent archive file; Contain current system time in the archive file name; Search according to the time period when being convenient to log query, the controllable size of each archive file can read fast.
CN2012100181192A 2012-01-19 2012-01-19 General method for managing log of system Pending CN102609484A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2012100181192A CN102609484A (en) 2012-01-19 2012-01-19 General method for managing log of system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2012100181192A CN102609484A (en) 2012-01-19 2012-01-19 General method for managing log of system

Publications (1)

Publication Number Publication Date
CN102609484A true CN102609484A (en) 2012-07-25

Family

ID=46526856

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2012100181192A Pending CN102609484A (en) 2012-01-19 2012-01-19 General method for managing log of system

Country Status (1)

Country Link
CN (1) CN102609484A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103049546A (en) * 2012-12-27 2013-04-17 华为技术有限公司 Method and device for managing and accessing system logs
CN106503250A (en) * 2016-11-10 2017-03-15 广东浪潮大数据研究有限公司 A kind of log tracks method and apparatus
CN107180051A (en) * 2016-03-11 2017-09-19 华为技术有限公司 A kind of blog management method, server
CN107193721A (en) * 2017-03-30 2017-09-22 武汉斗鱼网络科技有限公司 A kind of method and apparatus for generating daily record
CN107273460A (en) * 2017-06-01 2017-10-20 郑州云海信息技术有限公司 A kind of storage method for storing product systems daily record
CN109522316A (en) * 2018-11-02 2019-03-26 东软集团股份有限公司 Log processing method, device, equipment and storage medium
CN114443442A (en) * 2022-04-08 2022-05-06 希诺麦田技术(深圳)有限公司 Log storage method and electronic equipment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567248A (en) * 2003-07-01 2005-01-19 华为技术有限公司 Log recording method and system for application program
CN101072124A (en) * 2007-06-22 2007-11-14 中兴通讯股份有限公司 Log obtaining method
CN101320348A (en) * 2008-06-25 2008-12-10 中兴通讯股份有限公司 Log function implementing method of embedded system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1567248A (en) * 2003-07-01 2005-01-19 华为技术有限公司 Log recording method and system for application program
CN101072124A (en) * 2007-06-22 2007-11-14 中兴通讯股份有限公司 Log obtaining method
CN101320348A (en) * 2008-06-25 2008-12-10 中兴通讯股份有限公司 Log function implementing method of embedded system

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103049546A (en) * 2012-12-27 2013-04-17 华为技术有限公司 Method and device for managing and accessing system logs
CN103049546B (en) * 2012-12-27 2016-01-13 华为技术有限公司 The method and apparatus of a kind of management, access system daily record
CN107180051A (en) * 2016-03-11 2017-09-19 华为技术有限公司 A kind of blog management method, server
CN107180051B (en) * 2016-03-11 2021-02-12 华为技术有限公司 Log management method and server
CN106503250A (en) * 2016-11-10 2017-03-15 广东浪潮大数据研究有限公司 A kind of log tracks method and apparatus
CN106503250B (en) * 2016-11-10 2019-09-27 广东浪潮大数据研究有限公司 A kind of log tracks method and apparatus
CN107193721A (en) * 2017-03-30 2017-09-22 武汉斗鱼网络科技有限公司 A kind of method and apparatus for generating daily record
CN107273460A (en) * 2017-06-01 2017-10-20 郑州云海信息技术有限公司 A kind of storage method for storing product systems daily record
CN109522316A (en) * 2018-11-02 2019-03-26 东软集团股份有限公司 Log processing method, device, equipment and storage medium
CN114443442A (en) * 2022-04-08 2022-05-06 希诺麦田技术(深圳)有限公司 Log storage method and electronic equipment
CN114443442B (en) * 2022-04-08 2022-07-22 希诺麦田技术(深圳)有限公司 Log storage method and electronic equipment

Similar Documents

Publication Publication Date Title
CN102609484A (en) General method for managing log of system
AU2012347883B2 (en) System and method for restoring application data
CN102135963B (en) Data transfer method and system
US8108446B1 (en) Methods and systems for managing deduplicated data using unilateral referencing
Al Kez et al. Exploring the sustainability challenges facing digitalization and internet data centers
US8495022B1 (en) Systems and methods for synthetic backups
US9658925B1 (en) Systems and methods for restoring application data
EP2916240A1 (en) Database storage system based on compact disk and method using the system
US20160055189A1 (en) Database Storage System based on Optical Disk Library, and Method Using Same
CN101582076A (en) Data de-duplication method based on data base
CN102609337A (en) Rapid data recovery method for memory database
CN105701190A (en) Data synchronizing method and device
CN101989305A (en) Data incremental backup method and system
ATE458229T1 (en) ARRANGEMENT WITH A TACHOGRAPH
CN103916459A (en) Big data filing and storing system
CN102521114A (en) File system log storage system under virtualization environment
CN103176867A (en) Fast file differential backup method
CN103927215A (en) kvm virtual machine scheduling optimization method and system based on memory disk and SSD disk
CN104376099A (en) Flash-memory-based file system implementation method and device
US8650160B1 (en) Systems and methods for restoring multi-tier applications
CN102609486A (en) Data reading/writing acceleration method of Linux file system
US8595271B1 (en) Systems and methods for performing file system checks
US10311021B1 (en) Systems and methods for indexing backup file metadata
CN103207916A (en) Metadata processing method and device
CN102855327B (en) Small embedded file storage management system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C53 Correction of patent of invention or patent application
CB02 Change of applicant information

Address after: 100085 Haidian District, Zhongguancun, South Street, No. 6,, building information, floor, No. 16

Applicant after: SI-TECH Information Technology Ltd.

Address before: 100085 Haidian District, Zhongguancun, South Street, No. 6,, building information, floor, No. 16

Applicant before: Beijing Digital China SI-TECH Information Technology Co., Ltd.

COR Change of bibliographic data

Free format text: CORRECT: APPLICANT; FROM: BEIJING DIGITAL CHINA SI-TECH INFORMATION TECHNOLOGY LTD. TO: BEIJING SI-TECH INFORMATION TECHNOLOGY LTD.

C12 Rejection of a patent application after its publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20120725