CN1295613C - Method for general windows program to operate journal information record - Google Patents

Method for general windows program to operate journal information record Download PDF

Info

Publication number
CN1295613C
CN1295613C CNB02146331XA CN02146331A CN1295613C CN 1295613 C CN1295613 C CN 1295613C CN B02146331X A CNB02146331X A CN B02146331XA CN 02146331 A CN02146331 A CN 02146331A CN 1295613 C CN1295613 C CN 1295613C
Authority
CN
China
Prior art keywords
log information
interface function
memory block
memory
raw data
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.)
Expired - Fee Related
Application number
CNB02146331XA
Other languages
Chinese (zh)
Other versions
CN1492330A (en
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CNB02146331XA priority Critical patent/CN1295613C/en
Publication of CN1492330A publication Critical patent/CN1492330A/en
Application granted granted Critical
Publication of CN1295613C publication Critical patent/CN1295613C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Abstract

The present invention discloses a method for recording the running log information of a general windows program, which comprises the steps that a log information interface function is invoked according to the type of log information, the initial data of the log information is placed in a log information queue by the corresponding log information interface function, and a log information data processing notice is sent to a log processing module and then directly returned; after the log information data processing module receives the log information data processing notice, the log information in the log information queue is stored, displayed and formatted. The separate execution of the log information interface function and the log information data processing ensures that the processing of the log information can not block the normal running of a program, and the execution of normal process can not be influenced because of abnormities in the log information processing. Various types of log information interface functions provide a universal agile log information recording method. A memory managing function efficiently manages a memory, and thereby, a large quantity of memory fragments caused by frequent distribution of the memory can be avoided.

Description

General Windows program run log information recording method
Technical field
The present invention relates to program run log information recording technical field, be meant program run log information recording method under a kind of general Windows environment especially.
Background technology
Running log information record is program debug and positioning problems method commonly used.General log information recording mode all is to realize by the character string information that directly program will the be write down mode with written document.If directly applying in the business software product, this mode will have a lot of disadvantages.
At first, the mode of this log information recording is not with the log information classification.When debug version and released version, if do not revise code, the log information recording in the time of then can't be with debugged program is removed, and therefore can take a lot of memory headrooms, causes the waste of resource.
Secondly, under the situation that a large amount of log information recording operations are arranged, the runnability of program will be had a strong impact on, even can cause the obstruction of the normal operation of program.The user always wishes to call log information recording and can finish as early as possible, but the processing of log information is always very consuming time usually.
Once more, the log informational needs is applied for continually internal memory and is discharged, and will produce a large amount of memory fragmentations, causes the Installed System Memory utilization rate to reduce, even the situation of no free memory occurs.
Summary of the invention
In view of this, the object of the present invention is to provide a kind of general Windows program run log information recording method, realize general, efficiently, running log information record flexibly.
In order to achieve the above object, the invention provides a kind of general Windows program run log information recording method, it is characterized in that may further comprise the steps:
A, call the log information interface function, the log information raw data is put into the log information formation, directly return after log information data processing notice is sent to the log information processing module by the log information interface function that calls according to the log information type;
B, log information data processing module comprise preservation, demonstration, formative processing to the log information in the log information formation after receiving log information data processing notice.
Steps A further comprises:
A, invoke memory management function to available memory space of system's application, are divided into more than one little memory block with this section memory headroom by the memory management function management of calling; These little memory blocks are numbered, and by the user mode of the little memory block of service marking " free time " or " being used " expression is set;
The numbering of little memory block of b, the up-to-date distribution of record with the log information original data storage wherein, and is changed to " being used " with its service marking by " free time ";
When c, storage allocation, number the direction search that increases to the little memory block of up-to-date distribution, finding a service marking is the little memory block storing daily record information raw data of " free time ", and its service marking is changed to " being used " by " free time ";
Described step B further comprises: in the releasing memory piece during stored log information raw data, the invoke memory management function, find needs to discharge the little memory block of log information raw data by the memory management function that calls according to the little memory block numbering of distributing, after the release log information raw data its service marking is changed to " free time " by " being used ".
According to the context of log information raw data the little memory block of storing daily record information raw data is lined up and to form described log information formation.
Steps A further comprises: log information is set handles the log information rank that the rank interface function is used for determining needs processing, comprise fatal, mistake, warning, prompting; Log information is handled the rank interface function and is judged whether log information is the rank that needs processing, when needing to handle, this log information raw data is put into the log information formation, and when not needing to handle, log information is handled the rank interface function and called end.
Preferably, the log information interface function comprises: carry variable element character string log information interface function, memory block log information interface function, self-defined frame log information interface function, custom formats log information interface function, log information processing rank interface function is set.
System is by readjustment custom formats log information interface function structure log information form.
The present invention separates with the log information data processing and carries out by calling the log information interface function, carry out exchanges data by the log information formation between log information interface function and log information data processing module, guaranteed that the processing of log information can not block the normal operation of program, guaranteed to occur also can not influencing unusually the execution of normal flow simultaneously in the log information processing procedure.Polytype log information interface function for the user provide general, efficiently, log information recording method flexibly, the user can have the log information of specific (special) requirements by custom formats log information interface function structure to display format.The log information raw data is being put into log information formation and log information data handling procedure, do not had the memory allocation method of using system, but the application memory management function internally deposits into capable advantages of simplicity and high efficiency management.By the invoke memory management function, reduced the distribution number of times of internal memory, improved the selected probability of free memory, a large amount of memory fragmentations of having avoided the frequent distribution because of internal memory to cause.
Description of drawings
Fig. 1 shows according to the process flow diagram that calls the log information interface function of the present invention;
Fig. 2 shows the process flow diagram according to log information data handling procedure of the present invention;
Fig. 3 shows the method synoptic diagram according to memory management function managing internal memory of the present invention.
Embodiment
In order to make the purpose, technical solutions and advantages of the present invention clearer, the present invention is described in further detail below in conjunction with accompanying drawing.
Log information is extremely important concerning safety, and it has write down the various incidents that system takes place every day, and the user can check the wrong reason that takes place, the vestige that the assailant stays when perhaps under attack by it.And each large-scale application program is in exploitation, test and all need the usage log information utility in the commercialization cycle.The major function of log information is audit and monitoring.Log information is the monitoring system state in real time, monitors invador's invasion and follows the trail of invador or the like.
The content of log information mainly comprises: several parts such as the time of log information, rank, filename, code line number, log information main body.That log information generally is divided into is fatal, mistake, warning and four ranks of prompting.
The present invention carries out log information recording, demonstration and processing for the user provides multiple mode.The user can define respectively needs storage, show which other log information of level.In use log information is become several log information interface functions according to type package, each log information interface function is handled one type log information, for example: carry variable element character string log information interface function, memory block log information interface function (content stores in certain section continuation address space in the internal memory is got off), self-defined frame log information interface function etc.Therefore, at needs recording different types log information or when wishing with multi-form log information, the log information interface function that only need simply call respective type gets final product.Some other log information of level that need store for the user can call and log information is set handles the rank interface function and need to determine stored log information.When the user has specific (special) requirements to the display format of log information, can adopt custom formats log information interface function to carry out freely customizing.
The present invention separates the method for carrying out by calling the log information interface function with the log information data processing, the processing of assurance log information can not blocked the normal operation of program, guarantees the unusual execution that yet can not influence normal flow that occurs in the log information processing procedure simultaneously.
Carry out exchanges data by a log information formation between log information interface function and log information data processing module.The user is after calling the log information interface function, the log information interface function is just put into the log information formation with the raw data of log information, and log information is handled notice be sent to the log information data processing module, the log information interface function is just out of service then.So just can guarantee that the processing procedure of log information can not take the time of original flow process, the unusual execution that also can not influence normal flow wherein.
The log information data processing module just takes out the log information raw data and handles, the readable strong log information of structure after obtaining log information processing notice from the log information formation.The log information data processing module comprises format, storage, demonstration etc. to the processing of log information raw data.Call and log information is set handles the rank interface function and need to determine stored log information, according to being provided with of user log information is stored in the log information file, or be presented in the window of appointment, or handle according to the mode of customization.Format is meant the form that data configuration is become to need, as hexadecimal data-switching is become metric data.
Fig. 1 shows according to the process flow diagram that calls the log information interface function of the present invention, as shown in Figure 1:
Step 101~step 102: the user calls the log information interface function of respective type according to the log information type, and the log information interface function receives the log information raw data.The log information interface function of the type is according to the rank of log information and log information is set handles the rank interface function and judge that this log information raw data whether handle by needs, handles execution in step 103 if desired; Do not handle execution in step 106 if do not need.
Step 103~step 105: log information interface function invoke memory management function, memory management function are log information raw data storage allocation storage space.The log information interface function is put into the log information formation with the log information raw data, and log information processing notice is sent to the log information data processing module.
Step 106: the log information interface function calls end.
Fig. 2 shows the process flow diagram according to log information data handling procedure of the present invention, as shown in Figure 2:
Step 201~step 203: the log information data processing module is handled the readable strong log information of structure, storage, show log information then after receiving that log information that the log information interface function sends is handled notice to the log information raw data.
Step 204~step 205: the log information original data processing finishes, log information data processing module invoke memory management function, and the memory management function discharges the memory block of storing daily record information raw data.The operation of log information data processing module finishes.
Step 101~step 106 is for calling the process of log information interface function, step 201~step 205 is the process of log information data processing, two processes separation are carried out, so just can guarantee that the processing procedure of log information can not take the time of original flow process, the unusual execution that also can not influence normal flow wherein.
In to the description of calling log information interface function and log information data handling procedure, mentioned the memory management function.Do not adopt the method for system assignment internal memory among the present invention, but adopt the memory management function to carry out the memory management of oneself.
The memory management function is to free memory of system's application, and is divided into some little memory blocks, each little memory block is numbered, and the service marking of " free time " and " being used " is set.When needs used internal memory, then finding a service marking from these little memory blocks was the little memory block storing daily record information raw data of " free time ", and its service marking is changed to " being used " by " free time ".
In whole memory management process, the number record of the little memory block of up-to-date distribution is got off.During storage allocation, search for backward, find a service marking to be the little memory block of " free time ", with the log information original data storage wherein, and its service marking is changed to " being used " from this Position Number.And during releasing memory,, find the numbering of the little memory block that will discharge then according to the numbering of little memory block, and the content of its storage is discharged, then its service marking is changed to " free time ".
Fig. 3 shows the method synoptic diagram according to memory management function managing internal memory of the present invention, as shown in Figure 3:
The memory management function is divided into N little memory block to free memory 301 of system's application with internal memory 301, this N little memory block is numbered, from 0 to N little memory block 304 numbering N-1 of first little memory block 302 numberings.All be changed to " free time " at initial service marking with each little memory block.When needs used internal memory, finding a service marking from the little memory block of internal memory 301 was the little memory block memory contents of " free time ", and its service marking is changed to " being used " by " free time ".
If the little memory block that little memory block 303 is up-to-date distribution, the memory management function writes down the numbering of little memory block 303, and the service marking of little memory block 303 is changed to " being used " by " free time ".During storage allocation, little memory block to up-to-date distribution is numbered the direction search that increases, and promptly searches for along the direction of arrow 306, finds the little memory block of a service marking for " free time ", with the log information original data storage wherein, and with its service marking be changed to " being used ".When internal memory discharges, find needs to discharge the little memory block of log information raw data according to the little memory block numbering of distributing, release finishes, and its service marking is changed to " free time " by " being used ".
This EMS memory management process internally deposits into has gone the advantages of simplicity and high efficiency management, can guarantee can hit free memory block very soon when the needs storage allocation; And when releasing memory, also can find the position of the little memory block that needs the release content very soon.Significantly reduce the distribution number of times of internal memory like this, guaranteed the probability that free memory is selected simultaneously.A large amount of memory fragmentations of having avoided the frequent distribution because of internal memory to cause in this way.
User for preferring system log information form also provides custom formats log information interface function flexibly among the present invention, construct the special information that meets customer requirements by the form of readjustment custom formats log information interface function.So-called call back function is exactly that user oneself writes satisfactory function, behind this function of system call, constructs the form of meeting consumers' demand.As:
W2L(BYTE?byLevel,PVOID?pData,MAKESTRPROC?MakeStrProc)
Wherein pData is the log information initial data structure that needs processing;
MakeStrProc is the pointer of the function of structure log information user-defined format.
If calling top custom formats log information interface function, the user comes log information, then when actual treatment log information raw data, the log information data processing module can be given log information raw data pData MakeStrProc and handle, at last with result storage and demonstration.
The user constructs the log information that meets own demand by custom formats log information interface function, and custom formats log information interface function guarantees that for the user provides operation flexibly the log information interface function has the extensibility of height.
In a word, the above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.

Claims (6)

1, a kind of general Windows program run log information recording method is characterized in that may further comprise the steps:
A, call the log information interface function, the log information raw data is put into the log information formation, directly return after log information data processing notice is sent to the log information processing module by the log information interface function that calls according to the log information type;
B, log information data processing module comprise preservation, demonstration, formative processing to the log information in the log information formation after receiving log information data processing notice.
2, general Windows program run log information recording method as claimed in claim 1 is characterized in that described steps A further comprises:
A, invoke memory management function to available memory space of system's application, are divided into more than one little memory block with this section memory headroom by the memory management function that calls; These little memory blocks are numbered, and by the user mode of the little memory block of service marking " free time " or " being used " expression is set;
The numbering of little memory block of b, the up-to-date distribution of record with the log information original data storage wherein, and is changed to " being used " with its service marking by " free time ";
When c, storage allocation, number the direction search that increases to the little memory block of up-to-date distribution, finding a service marking is the little memory block storing daily record information raw data of " free time ", and its service marking is changed to " being used " by " free time ";
Described step B further comprises: in the releasing memory piece during stored log information raw data, the invoke memory management function, find needs to discharge the little memory block of log information raw data by the memory management function that calls according to the little memory block numbering of distributing, after the release log information raw data its service marking is changed to " free time " by " being used ".
3, general Windows program run log information recording method as claimed in claim 2 is characterized in that: according to the context of log information raw data the little memory block of storing daily record information raw data being lined up forms described log information formation.
4, general Windows program run log information recording method as claimed in claim 1, it is characterized in that described steps A further comprises: log information is set handles the log information rank that the rank interface function is used for determining needs processing, comprise fatal, mistake, warning, prompting; Log information is handled the rank interface function and is judged whether log information is the rank that needs processing, when needing to handle, this log information raw data is put into the log information formation, and when not needing to handle, log information is handled the rank interface function and called end.
5, general Windows program run log information recording method as claimed in claim 1 is characterized in that described log information interface function comprises: carry variable element character string log information interface function, memory block log information interface function, self-defined frame log information interface function, custom formats log information interface function, log information processing rank interface function is set.
6, general Windows program run log information recording method as claimed in claim 1 is characterized in that: system is by readjustment custom formats log information interface function structure log information form.
CNB02146331XA 2002-10-24 2002-10-24 Method for general windows program to operate journal information record Expired - Fee Related CN1295613C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB02146331XA CN1295613C (en) 2002-10-24 2002-10-24 Method for general windows program to operate journal information record

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB02146331XA CN1295613C (en) 2002-10-24 2002-10-24 Method for general windows program to operate journal information record

Publications (2)

Publication Number Publication Date
CN1492330A CN1492330A (en) 2004-04-28
CN1295613C true CN1295613C (en) 2007-01-17

Family

ID=34232687

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB02146331XA Expired - Fee Related CN1295613C (en) 2002-10-24 2002-10-24 Method for general windows program to operate journal information record

Country Status (1)

Country Link
CN (1) CN1295613C (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101216800B (en) * 2008-01-02 2010-12-29 中兴通讯股份有限公司 LINUX log controller and method

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006099442A (en) 2004-09-29 2006-04-13 Canon Inc Information processor, history file creation method, and program
CN1315041C (en) * 2004-12-29 2007-05-09 华为技术有限公司 Implement method and system for raising understandability of running information of program
US7664995B2 (en) * 2006-07-31 2010-02-16 International Business Machines Corporation Transfer of application loggin status information across subsystem nodes
CN101369250B (en) * 2008-10-08 2010-09-29 上海闻泰电子科技有限公司 Execution method for tape log based on Shell
CN102681931A (en) * 2012-05-15 2012-09-19 天津市天元新泰科技发展有限公司 Realization method of log and abnormal probe
CN102981943B (en) * 2012-10-29 2016-05-11 新浪技术(中国)有限公司 The method and system of monitoring application daily record
CN103942150A (en) * 2014-04-01 2014-07-23 上海网达软件股份有限公司 Memory management method for real-time streaming media transmission system
CN105260315B (en) * 2015-11-13 2018-04-06 上海斐讯数据通信技术有限公司 A kind of method of the debugging log in embedded system process
CN106529679B (en) * 2016-10-14 2020-01-14 腾讯科技(上海)有限公司 Machine learning method and system
CN113656358A (en) * 2020-05-12 2021-11-16 网联清算有限公司 Database log file processing method and system
CN115048046B (en) * 2022-05-26 2022-11-25 北京华昱卓程软件有限公司 Log file system and data management method

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1361489A (en) * 2000-12-28 2002-07-31 深圳市中兴通讯股份有限公司 Automatic circular daily record information storing method and system
WO2002073465A2 (en) * 2001-03-09 2002-09-19 Oracle Corporation System and method for maintaining large-grained database concurrency with a log monitor incorporating dynamically redefinable business logic

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1361489A (en) * 2000-12-28 2002-07-31 深圳市中兴通讯股份有限公司 Automatic circular daily record information storing method and system
WO2002073465A2 (en) * 2001-03-09 2002-09-19 Oracle Corporation System and method for maintaining large-grained database concurrency with a log monitor incorporating dynamically redefinable business logic

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101216800B (en) * 2008-01-02 2010-12-29 中兴通讯股份有限公司 LINUX log controller and method

Also Published As

Publication number Publication date
CN1492330A (en) 2004-04-28

Similar Documents

Publication Publication Date Title
CN1295613C (en) Method for general windows program to operate journal information record
US5740354A (en) Method and system for associating related errors in a computer system
EP2724269B1 (en) System, method and data structure for fast loading, storing and access to huge data sets in real time
US7882223B2 (en) System and method for saving dump data of a client in a network
US20070011428A1 (en) System and method for auditing memory
CN1924851A (en) Data storage method and data storage structure
JP2003114816A (en) Data structure storing indexes in computer memory
CN1773449A (en) Method, apparatus, and computer program product for implementing enhanced circular queue using loop counts
US20100030994A1 (en) Methods, systems, and computer readable media for memory allocation and deallocation
CN1928873A (en) System and method for database access for implementing load sharing
US7565645B2 (en) Method and apparatus for marking code for data versioning
CN102541925A (en) Method and device for rapidly storing and retrieving detailed tickets
CN1862482A (en) FIFO memory and method for output empty full marker thereof
CN1532708A (en) Static internal storage management method
CN1896957A (en) Method for leaking memory of positioning virtual operation system
US7890934B2 (en) System and method for performance monitoring
US7653672B2 (en) Heap dump acquiring method
CN100489855C (en) Apparatus and method for journaling database changes using minimized journal entries
US7484068B2 (en) Storage space management methods and systems
CN1324481C (en) Data aging method for network processor
US7587513B1 (en) Efficient storage of network and application data
US20070067358A1 (en) Method and apparatus for restoring versionable objects
CN1567249A (en) Internal memory managerial approach for computer system
CN1975701A (en) Master machine driving external equipment method and system
CN1897629A (en) Mass toll-ticket fast cross rearrangement based on memory

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20070117

Termination date: 20131024