CN100395725C - Journal output system and output method - Google Patents

Journal output system and output method Download PDF

Info

Publication number
CN100395725C
CN100395725C CNB2006100758541A CN200610075854A CN100395725C CN 100395725 C CN100395725 C CN 100395725C CN B2006100758541 A CNB2006100758541 A CN B2006100758541A CN 200610075854 A CN200610075854 A CN 200610075854A CN 100395725 C CN100395725 C CN 100395725C
Authority
CN
China
Prior art keywords
module
output
log information
information
file destination
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
CNB2006100758541A
Other languages
Chinese (zh)
Other versions
CN1967499A (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 CNB2006100758541A priority Critical patent/CN100395725C/en
Publication of CN1967499A publication Critical patent/CN1967499A/en
Application granted granted Critical
Publication of CN100395725C publication Critical patent/CN100395725C/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention relates to a log information export system, including a log output, a controller and a document checker. It also involves a log information export method, including: register each application module, and get the only controller object of each module; run the application module, and according to the output control information of each module, controller object outputs log information of each module. The invention controls log information exports of each module in the means of dynamically checking documents; it can close the log information of the modules that is not important but very large log information, thereby to improve client performance; it can control the output of each module log information by dynamically checking the target files, and not have to close client application when the application encounters error, and it can dynamically modify the log export control information in the target files, to quick access to positioning information, and shorten the time of positioning problem by developers, and reduce costs.

Description

Log information output system and output intent
Technical field
The present invention relates to the log information export technique, relating in particular to can be to log information the log information output system and the output intent controlled of output.
Background technology
In the overall process of application development, no matter write what good test cases of design, even minimum application program also can be after being deployed to production environment under cover one or more mistakes.Though exploitation and quality assessment (Quality Assessment that test drives, abbreviation QA) means can improve code quality and strengthen the confidence of application programs, but when certain system or function failure, developer and system manager need understand the Debugging message such as relevant execution context of system, suitable information has been arranged, could also deal with problems fast by the essential of problem identificatioin, thereby save time and money.
Under the Java environment, although emerged the means of many debugging utilities, but directly Debugging message is outputed to file (perhaps other places) and remain very important means, especially in debugging during distributed application program, or even unique utilizable method.In application program, add log record generally speaking based on three purposes: monitor the situation of change of variable in the code, periodically record in the file and carry out statistical study work for other application; Track when following the tracks of the code operation is as the foundation of auditing in the future; The effect of taking on the debugger in the Integrated Development Environment is to the Debugging message of file or control desk print code.
Information is outputed to screen, the System.out.println (systems approach that Java provides, output information is to screen) that the simplest method just is to use JDK (Java Developer ' s Kitjava development kit) to provide.But, there are some problems like this: the output underaction of information, and loaded down with trivial details.For example, the content of output is the filename of execution place, and line number, seems very original at the current time etc.If change the content and the form of output, need to recompilate source program.More seriously, if a lot of such output statements are arranged in the program, can seriously influence the performance of program.
In order to solve top problem, people have developed the software package of some special record Debugging message, for example, and Log4j (Log4j=Log for java).Log4j can be used for the output of Debugging message by Apache (software organization's name) organization development.Existing Log4j mainly is made of three important assemblies: the priority of log information, the output destination of log information, the output format of log information.The priority of log information is used for specifying the significance level of this log information, can be defined by the user, in the typical case uses, priority can be set at from high to low four kinds of ERROR (mistake), WARN (warning), INFO (information), DEBUG (Debugging message); It still is in the file that the output destination of log information has specified daily record will print to control desk; The output format of log information has then been controlled the format and content of log information.As shown in Figure 1,, during print log information, obtain log record device object for a kind of daily record follower structural drawing of the prior art, and output information; The daily record follower is done as a whole, each module all is directly to call the daily record follower debugging log is printed, and there are the following problems for this:
(1) can't control the Debugging message switch respectively at different modules.
Can't discriminating module, also can't specify the log information of certain module whether to need to print.In large-scale application program, can print a large amount of log informations, if the daily record of all modules is all exported, then influence performance, cause the client response speed slow.
(2) can't change the Debugging message switch in the runtime.
Can't when program run, change daily record and whether need the switch setting of printing.If open daily record Debugging message switch, then reduce client performance, if closing journal Debugging message switch, then can't the very first time obtain log information, when going wrong,, then need to close client-side program if open the Debugging message switch, revise runtime parameter or configuration file, just can come into force after restarting client-side program.After restarting client-side program, can't reduce at that time running environment fully, knotty problem all can't be reappeared usually, after restarting client, problem usually can not reappeared again, thereby can't the very first time obtain log information, influences orientation problem, prolong the time of developer's orientation problem, improved cost.
Summary of the invention
The objective of the invention is to control respectively at different modules the problem of Debugging message switch at existing in prior technology, a kind of output system and output intent of application log information are provided, control the output of the log information of each module by the mode of dynamic chek file.
To achieve these goals, the invention provides a kind of log information output system, comprising:
The daily record follower is used for output journal information;
Controller is connected with described daily record follower, is used to control the log information of each module of daily record follower output application program; And
The file checking device is connected with described controller, is used for checking and exporting control information to the daily record of controller export target file.
This system also can comprise the output switch, the output switch is connected with described file checking device and controller, the file checking device is according to the output of the daily record in file destination control information, and control is exported switch opens or closed, and controller is according to the State Control daily record follower output journal information of output switch.Compare with checking file destination, check that exporting on off state can save the plenty of time, therefore the output by output on off state control log information has good real-time performance.The number of the module that the number of output switch can comprise with application program is identical, and the output switch is corresponding one by one with module.
This system also can comprise timer, and this timer is connected with the file checking device, and described file checking device is according to the temporal information quantitative check file destination of this timer.
To achieve these goals, the present invention also provides a kind of log information output intent, may further comprise the steps:
Step 1, application modules are registered, and obtain unique controller object of each module;
Step 2, operation application module, controller object is exported the log information of each module according to the output control information of each module.
This method also can comprise the step of checking file destination, and controller object is exported the log information of each module according to the daily record output control information of file destination record; Perhaps, control the output switch opens of each module or close, export the log information of each module according to the state of the output switch of each module according to the daily record output control information of file destination record.
The output switch opens of described each module of control or the step of closing can be specially: judge whether the log-on message of each module and file destination mate, for the module of coupling, open the output switch of this module; For unmatched module, close the output switch of this module.The step that described state according to the output switch is exported the log information of each module can be specially: if the output switch is an open mode, then export the log information of this module, if the output switch is a closed condition, then do not export the log information of this module.The time of reading judgement output on off state will be significantly shorter than the time of checking file destination, thereby can save the plenty of time by the output of on off state control log information, has good real-time performance.
Behind the unique controller object that obtains each module, start timer, according to the temporal information quantitative check file destination of timer, dynamically adjust the output control information of the module that needs output journal information, thus the log information of output corresponding module.When application program is moved, can pass through modify target file, control each module log information and whether export.
The present invention controls the output of the log information of each module by the mode of dynamic chek file; Module is distinguished, and whether daily record is set needs to print, and very many and log information unessential module is closed with log information, thereby improves client performance; Pass through the dynamic chek file destination in the runtime, control the output of each module log information, when application program goes wrong, needn't close client-side program, the dynamically output of the daily record in modify target file control information, obtain locating information fast, shorten the time of developer's orientation problem, reduce cost; Regulate the output switch according to file destination, and then, read the time of judging control information in the time of can significantly reducing output journal information, have good real-time performance according to the output of the State Control log information of output switch.
Below by drawings and Examples, technical scheme of the present invention is described in further detail.
Description of drawings
Fig. 1 is existing daily record follower structural drawing.
Fig. 2 is a log information output system structural representation of the present invention;
Fig. 3 is a log information output intent process flow diagram of the present invention;
Fig. 4 is log information output system one a specific embodiment structural representation of the present invention;
Fig. 5 is log information output intent one a specific embodiment process flow diagram of the present invention.
Embodiment
The present invention has mainly realized realizing that in the following mode by the dynamic chek file runtime controls the Debugging message of each module.
As shown in Figure 2, be log information output system structural representation of the present invention.This system comprises controller 11, file checking device 12 and daily record follower 13.Controller 11 is connected with daily record follower 13 with file checking device 12; File checking device 12 is used for checking the daily record output control information of file destination, and this daily record output control information is exported to controller 11; Controller 11 is used to control the log information of daily record follower output each module of application program (hereinafter referred to as application module), daily record follower 13 is identical with existing daily record follower, program test log information output system of the present invention is on the basis of existing daily record follower, controller 11 and file checking device 12 have been added, each module of application program is when output journal information, no longer directly call the daily record follower, but call by controller, whether controller is exported according to the daily record output control information control log information of file destination record.
Each application module is at first registered at controller, and by registration, each module obtains the unique object at the controller of each module, and promptly each application module has a controller object, and the controller object between each module has nothing in common with each other.By controller object, distinguish each application module.When each application module carried out log information output by calling controller, controller was checked file destination, and according to the wherein daily record output control information of record, whether decision exports the log information of this module.
File destination has write down the daily record output control information of each application module, and for example, whether the log information that writes down each module needs output, when being recorded as " A module=OK ", export the log information of this A module, when being recorded as " B module=No ", do not export the log information of B module; File destination also can only write down the log-on message of each application module that needs output journal information, and when each application module called controller object, controller object was checked the information that whether has this module in the file destination earlier, if exist, then output if do not exist, is not then exported.The program test personnel can be according to the content of test needs setting and modify target file.
As shown in Figure 3, the output intent process flow diagram for log information of the present invention comprises the steps:
Step 1, application modules are registered, and obtain unique controller object of each module;
Step 2, operation application module, each module invokes controller object, controller object are exported the log information of each module according to the output control information of each module.
The output control information can be by checking that file destination obtains, and controller object calls the file checking device and checks file destination after being called, and according to the daily record output control information of writing down in the file destination, exports the log information of each module.
Because the time that the inspection file destination needs is long, therefore, many at application module, and when file destination is long, if each controller object is all checked file destination after being called, can need the long time so, the real-time that information is exported has certain influence.Therefore, in a specific embodiment of log information output system, added the output switch, the state of output switch is determined according to file destination.Can be each application module one output switch all is set, the file checking device is checked file destination, and adjusts the state of the output switch of each module according to the content of file destination.For example, the file destination record needs the log-on message of each module of output journal information, and for each module that exists in the file destination, module log-on message and file destination mate, and open the output switch of these modules; For non-existent each module in the file destination, module log-on message and file destination do not match, and close the output switch of these modules.When controller object was called, the state of the output switch by checking corresponding module determined whether to export the log information of this module.Compare with checking file destination, check that exporting the used time of on off state has shortened greatly, therefore can guarantee good real-time performance.
In log information output system one specific embodiment of the present invention, further added timer, as shown in Figure 4, be the present embodiment structural representation.Every through the predetermined time, this timer 16 will send temporal information, file checking device 12 whenever receives temporal information, just file destination is checked, thereby can realize quantitative check, and can in time upgrade the state of the output switch 15 of each module according to file destination to file destination.
When working procedure, can close the output switch of each module by the content that file destination is set, do not export the log information of each module, improve client performance; When program goes wrong, the content of artificial or automatic modify target file, file checking device quantitative check file destination, in time according to amended file destination dynamic opening output switch, obtain locating information, can shorten the time of developer's orientation problem like this, reduced cost.
As shown in Figure 5, for application log information output method one specific embodiment process flow diagram of the present invention, comprise
Step 101, each application module is registered, and obtained unique controller object of each module;
Step 102, startup timer move each application module;
Step 103, quantitative check file destination, and adjust the state of the output switch of each module according to file destination;
Step 104, each module invokes controller object, controller object is checked the output switch of each module, according to the state output journal information of output switch, if the output switch opens, then will information is gone in output, if the output switch cuts out, output journal information not then.
In the process of application program operation, can or close the output switch by the modify target file dynamic opening, thereby the developer can control the output of log information easily as required.
Application modules of the present invention is distinguished, and whether daily record is set needs to print, and very many and log information unessential module is closed with log information, thereby improves client performance; Pass through the dynamic chek file destination in the runtime, control the output of each module log information, when application program goes wrong, needn't close client-side program, by on-the-fly modifying the daily record output control information in the file destination, obtain locating information fast, shorten the time of developer's orientation problem, reduce cost; Regulate the output switch according to file destination, and then, read the time of judging control information in the time of can significantly reducing output journal information, have good real-time performance according to the output of the State Control log information of output switch.
Should be noted that at last: above embodiment is only in order to illustrate that technical scheme of the present invention is not intended to limit; Although with reference to preferred embodiment the present invention is had been described in detail, those of ordinary skill in the field should be appreciated that still and can make amendment or the part technical characterictic is equal to replacement the specific embodiment of the present invention; And not breaking away from the spirit of technical solution of the present invention, it all should be encompassed in the middle of the technical scheme scope that the present invention asks for protection.

Claims (9)

1. a log information output system is characterized in that, comprising:
The file checking device is connected with controller, is used to check file destination, and according to the output of the daily record in file destination control information, control is exported switch opens or closed;
Controller is connected with the daily record follower, is used for exporting according to the State Control daily record follower of described output switch the log information of each application module;
The daily record follower is used for output journal information.
2. system according to claim 1, wherein, this system also comprises timer, and this timer is connected with the file checking device, and described file checking device is according to the temporal information quantitative check file destination of this timer.
3. the output intent of a log information is characterized in that, may further comprise the steps:
Step 1, application modules are registered, and obtain unique controller object of each module;
Step 2, operation are checked file destination during application module, according to the daily record output control information of each module that writes down in the file destination, control the output switch opens of each module or close; Controller object is exported the log information of each module according to the state of the output switch of each module.
4. method according to claim 3, the output switch opens of wherein said each module of control or the step of closing are specially: judge whether the log-on message of each module and file destination mate, for the module of coupling, open the output switch of this module; For unmatched module, close the output switch of this module.
5. according to claim 3 or 4 described methods, described step 2 further comprises step:
According to the temporal information quantitative check file destination of timer, dynamically adjust the output control information of the module that needs output journal information, thus the log information of output corresponding module.
6. according to claim 3 or 4 described methods, the step that wherein said state according to the output switch is exported the log information of each module is specially: if the output switch is an open mode, then export the log information of this module, if the output switch is a closed condition, then do not export the log information of this module.
7. according to claim 3 or 4 described methods, wherein also comprise: when application module moves, revise described file destination, be used to adjust opening or closing of output switch.
8. method according to claim 5 wherein also comprises: when application module moves, revise described file destination, be used to adjust opening or closing of output switch.
9. method according to claim 6 wherein also comprises: when application module moves, revise described file destination, be used to adjust opening or closing of output switch.
CNB2006100758541A 2006-04-24 2006-04-24 Journal output system and output method Expired - Fee Related CN100395725C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2006100758541A CN100395725C (en) 2006-04-24 2006-04-24 Journal output system and output method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2006100758541A CN100395725C (en) 2006-04-24 2006-04-24 Journal output system and output method

Publications (2)

Publication Number Publication Date
CN1967499A CN1967499A (en) 2007-05-23
CN100395725C true CN100395725C (en) 2008-06-18

Family

ID=38076282

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2006100758541A Expired - Fee Related CN100395725C (en) 2006-04-24 2006-04-24 Journal output system and output method

Country Status (1)

Country Link
CN (1) CN100395725C (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101369250B (en) * 2008-10-08 2010-09-29 上海闻泰电子科技有限公司 Execution method for tape log based on Shell
CN101483561B (en) * 2009-02-12 2011-06-08 杭州华三通信技术有限公司 Method for controlling information output of network appliance system and network appliance
CN101661424B (en) * 2009-09-01 2011-09-14 卡斯柯信号有限公司 Self-adaptive efficient output processing method of log file
CN102831047A (en) * 2011-06-16 2012-12-19 上海聚力传媒技术有限公司 Method, device and equipment for dynamically regulating log information output of monitoring object
CN104281515B (en) * 2013-07-09 2019-01-11 腾讯科技(深圳)有限公司 A kind of method of adjustment and device of daily record data
CN105279074A (en) * 2014-06-05 2016-01-27 腾讯科技(深圳)有限公司 Method and device for displaying log information on terminal through NSLog
CN104881351A (en) * 2015-05-29 2015-09-02 惠州Tcl移动通信有限公司 Method and system for controlling journal output of mobile terminal
CN105045594A (en) * 2015-07-30 2015-11-11 汉柏科技有限公司 Program output control method and system
CN105975383A (en) * 2015-09-28 2016-09-28 乐视致新电子科技(天津)有限公司 Method and device for processing log information
CN109218740B (en) * 2017-06-29 2022-01-04 武汉斗鱼网络科技有限公司 Display method, storage medium, electronic device and system of double-screen video stream
CN109582532B (en) * 2018-10-25 2022-07-22 平安科技(深圳)有限公司 Electronic device, log switch control method, and computer-readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1115692A (en) * 1997-06-19 1999-01-22 Nec Software Ltd Debug information output controlling method
JPH11296415A (en) * 1998-04-09 1999-10-29 Toshiba Tec Corp Log output control method, log output controller and recording medium storing log output control program

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH1115692A (en) * 1997-06-19 1999-01-22 Nec Software Ltd Debug information output controlling method
JPH11296415A (en) * 1998-04-09 1999-10-29 Toshiba Tec Corp Log output control method, log output controller and recording medium storing log output control program

Also Published As

Publication number Publication date
CN1967499A (en) 2007-05-23

Similar Documents

Publication Publication Date Title
CN100395725C (en) Journal output system and output method
CN100555240C (en) The method and system that is used for diagnosis of application program
CN104281520B (en) Tracking and method, the apparatus and system of debugging
US20050223360A1 (en) System and method for providing a generic user interface testing framework
CN102760090B (en) Debugging method and computer system
CN101458725B (en) Microcontroller chip and debug method thereof
US20050229161A1 (en) Generic user interface testing framework with load-time libraries
US20050228644A1 (en) Generic user interface testing framework with rules-based wizard
CN109542444B (en) JAVA application monitoring method, device, server and storage medium
US8762781B2 (en) Method and apparatus useful in manufacturing test case operations
CN112363897A (en) Full link log tracking method, device and storage medium
CN112685212A (en) Debugging and tracking method, device and system for processor exception
CN111881056A (en) Automatic test framework and test method
CN113760290A (en) Program control method and device, computer equipment and storage medium
CN101237350A (en) Global variant exception alteration and positioning method for multi-task environment single board machine
CN100517265C (en) Microcontroller emulation system
CN100472987C (en) Communication system program fault detecting method
CN105868092A (en) Log file processing method and device
CN113986263A (en) Code automation test method, device, electronic equipment and storage medium
CN112559336A (en) Method, device and system for adaptively debugging heterogeneous computing chip and mainboard chip
CN112035300A (en) Server BMC automatic test system, method, storage medium and electronic device
CN113688055B (en) Single DSP equipment testing arrangement based on DSS
CN109522244A (en) A kind of embedded device Debugging message acquisition methods and system
CN113031574B (en) Equipment operation process reproduction method and system
CN114756217B (en) Plug-in based script generation 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
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20080618

Termination date: 20170424

CF01 Termination of patent right due to non-payment of annual fee