CN105426453A - Method for controlling log output grade through configuration item - Google Patents

Method for controlling log output grade through configuration item Download PDF

Info

Publication number
CN105426453A
CN105426453A CN201510768139.5A CN201510768139A CN105426453A CN 105426453 A CN105426453 A CN 105426453A CN 201510768139 A CN201510768139 A CN 201510768139A CN 105426453 A CN105426453 A CN 105426453A
Authority
CN
China
Prior art keywords
configuration item
daily record
log
configuration
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.)
Withdrawn
Application number
CN201510768139.5A
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.)
G Cloud Technology Co Ltd
Original Assignee
G Cloud 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 G Cloud Technology Co Ltd filed Critical G Cloud Technology Co Ltd
Priority to CN201510768139.5A priority Critical patent/CN105426453A/en
Publication of CN105426453A publication Critical patent/CN105426453A/en
Withdrawn legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/1734Details of monitoring file system events, e.g. by the use of hooks, filter drivers, logs

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention relates to the technical field of software log output, in particular to a method for controlling a log output grade through a configuration item. The method comprises: firstly, recording a log by an application through log4j, and using a configuration file with a variable such as a variable in a dollar sign {a variable name} form for log4j; constructing a monitor, reading a configuration item corresponding to the configuration file of the application, and initializing a system variable according to a default process if the configuration item does not conform to a rule predefined by business; and if the configuration item conforms to the rule, calling a module of the corresponding system variable according to the configuration item to perform initialization, generating a lowest grade and a highest grade of log output, and starting a log record by log4j according to the system variable. The monitor starts working when the web application is started, the output grade of the log is controlled by modifying the value of the configuration item corresponding to the configuration file, and the log of the corresponding grade is output to a log file in a specific path when the log works normally. According to the method, the problem about log output quantity of logs generated by the web application during operation is solved; and the method can be used for log output control of the web application.

Description

A kind of method being controlled daily record output level by configuration item
Technical field
The present invention relates to software log export technique field, particularly a kind of method being controlled daily record output level by configuration item.
Background technology
Web application generally separates various grades, debug, info, error, wam for the printing of daily record.And for different functional modules, also have different journal file records.In application operational process, because log recording, a lot of problem can be produced:
One is that log recording lower grade, can produce a large amount of daily records, cause hard drive space in short supply, even full, causes application normally to run;
Two is be applied in production environment or development environment, when needing the daily record exporting different brackets, revise a large amount of configuration items, inefficiency.
Summary of the invention
The technical matters that the present invention solves is to provide a kind of method being controlled daily record output level by configuration item, and to meet the demand that different environment and needs export different daily records, easy-to-read, saves space.
The technical scheme that the present invention solves the problems of the technologies described above is:
Described method comprises the steps:
Step 1:web application uses log4j log;
Step 2: create the xml configuration file being applicable to log4j with system variable;
Step 3: create the configuration file of application and add daily record configuration item;
Step 4:web application increases audiomonitor;
Step 5: add the module obtaining application configuration file in audiomonitor;
Step 6: the module of adding generation system variable in audiomonitor;
Step 7: add the initialized module of log recording;
Step 8: start web application, audiomonitor initial configuration item;
Step 9: terminate.
Described step 1 application item is imported log4j to be correlated with jar.
The form of described xml profile system variable uses $ { variable name } represents; Configuration item can write in any text or other files facilitating program to read.
The value obtaining corresponding key in the file in application profile module automatic acquisition particular path leaves in internal memory; Then obtain the value of corresponding key in internal memory, judge whether the value obtained meets the rule of agreement, if do not meet, then load logger module according to the rule of acquiescence, if meet, analyze corresponding logging level according to the value obtained, obtain corresponding logger module and load.
Described log recording initialization module analyzes corresponding record grade, the lowest class that assignment log recording is corresponding, highest ranking according to importing value into; Daily record output can export and be more than or equal to the lowest class, in the particular path file that the daily record being less than or equal to highest ranking is arranged in step 2.
The present invention, by configuration file configuration log grade, uses audiomonitor to go read configuration file and carry out initialization to log4j.The multiple journal file of multiple module can be reached by a configuration item and can control daily record output level.Daily record can easily be reduced export, also can switch different logging mode fast as required.At software development phase, amendment configuration item, relaxes daily record output level, can check daily record type informations all in running software, be conducive to location defect.Software, when production environment, arranges higher daily record output level, only exports the information of mistake in running, reduces daily record amount, be conducive to software long-play, reduce the maintenance workload of operation maintenance personnel.
Accompanying drawing explanation
Below in conjunction with accompanying drawing, the present invention is further described:
Fig. 1 is the inventive method process flow diagram;
Embodiment
As shown in Figure 1, method of the present invention is specifically implemented in such a way.
First use log4j to carry out log, and to configure log4j logging level configuration item be variable:
Here logging level variable log4j.gcloud_debug.min and log4j.gcloud_debug.max is defined;
Add audiomonitor in Web application, audiomonitor code is as follows
Obtain configuration module in application configuration file
Different according to the value getting key, load different system variable initialization.
Generation system variable module
The logging level generated is loaded in system variable, for daily record initialization.

Claims (7)

1. controlled a method for daily record output level by configuration item, it is characterized in that: described method comprises the steps:
Step 1:web application uses log4j log;
Step 2: create the xml configuration file being applicable to log4j with system variable;
Step 3: create the configuration file of application and add daily record configuration item;
Step 4:web application increases audiomonitor;
Step 5: add the module obtaining application configuration file in audiomonitor;
Step 6: the module of adding generation system variable in audiomonitor;
Step 7: add the initialized module of log recording;
Step 8: start web application, audiomonitor initial configuration item;
Step 9: terminate.
2. the method being controlled daily record output level by configuration item according to claim 1, be is characterized in that: described step 1 application item is imported log4j to be correlated with jar.
3. the method being controlled daily record output level by configuration item according to claim 1, be is characterized in that: the form of described xml profile system variable uses $ { variable name } represents; Configuration item can write in any text or other files facilitating program to read.
4. the method being controlled daily record output level by configuration item according to claim 2, be is characterized in that: the form of described xml profile system variable uses $ { variable name } represents; Configuration item can write in any text or other files facilitating program to read.
5. the method being controlled daily record output level by configuration item according to any one of Claims 1-4, be is characterized in that: the value obtaining corresponding key in the file in application profile module automatic acquisition particular path leaves in internal memory; Then obtain the value of corresponding key in internal memory, judge whether the value obtained meets the rule of agreement, if do not meet, then load logger module according to the rule of acquiescence, if meet, analyze corresponding logging level according to the value obtained, obtain corresponding logger module and load.
6. the method being controlled daily record output level by configuration item according to any one of Claims 1-4, it is characterized in that: described log recording initialization module analyzes corresponding record grade according to importing value into, the lowest class that assignment log recording is corresponding, highest ranking; Daily record output can export and be more than or equal to the lowest class, in the particular path file that the daily record being less than or equal to highest ranking is arranged in step 2.
7. the method being controlled daily record output level by configuration item according to claim 5, be is characterized in that: described log recording initialization module analyzes corresponding record grade, the lowest class that assignment log recording is corresponding, highest ranking according to importing value into; Daily record output can export and be more than or equal to the lowest class, in the particular path file that the daily record being less than or equal to highest ranking is arranged in step 2.
CN201510768139.5A 2015-11-10 2015-11-10 Method for controlling log output grade through configuration item Withdrawn CN105426453A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510768139.5A CN105426453A (en) 2015-11-10 2015-11-10 Method for controlling log output grade through configuration item

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510768139.5A CN105426453A (en) 2015-11-10 2015-11-10 Method for controlling log output grade through configuration item

Publications (1)

Publication Number Publication Date
CN105426453A true CN105426453A (en) 2016-03-23

Family

ID=55504665

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510768139.5A Withdrawn CN105426453A (en) 2015-11-10 2015-11-10 Method for controlling log output grade through configuration item

Country Status (1)

Country Link
CN (1) CN105426453A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108170585A (en) * 2017-12-26 2018-06-15 广东欧珀移动通信有限公司 log processing method, device, terminal device and storage medium
CN108897663A (en) * 2018-06-19 2018-11-27 新华三技术有限公司 log output control method and device
CN109739735A (en) * 2018-12-04 2019-05-10 东软集团股份有限公司 Log generation method and device
CN117742783A (en) * 2024-02-19 2024-03-22 成都九洲电子信息系统股份有限公司 Cross-language automatic log data recording method for software system

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010224705A (en) * 2009-03-23 2010-10-07 Hitachi Software Eng Co Ltd Log retrieval system
CN102984680A (en) * 2012-12-19 2013-03-20 南京中兴软创科技股份有限公司 Method for realizing number tracking in external interface of telecommunication operation system
CN103905223A (en) * 2012-12-26 2014-07-02 腾讯科技(北京)有限公司 Data packet acquisition method, system and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010224705A (en) * 2009-03-23 2010-10-07 Hitachi Software Eng Co Ltd Log retrieval system
CN102984680A (en) * 2012-12-19 2013-03-20 南京中兴软创科技股份有限公司 Method for realizing number tracking in external interface of telecommunication operation system
CN103905223A (en) * 2012-12-26 2014-07-02 腾讯科技(北京)有限公司 Data packet acquisition method, system and device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108170585A (en) * 2017-12-26 2018-06-15 广东欧珀移动通信有限公司 log processing method, device, terminal device and storage medium
CN108897663A (en) * 2018-06-19 2018-11-27 新华三技术有限公司 log output control method and device
CN109739735A (en) * 2018-12-04 2019-05-10 东软集团股份有限公司 Log generation method and device
CN109739735B (en) * 2018-12-04 2022-05-31 东软集团股份有限公司 Log generation method and device
CN117742783A (en) * 2024-02-19 2024-03-22 成都九洲电子信息系统股份有限公司 Cross-language automatic log data recording method for software system

Similar Documents

Publication Publication Date Title
CN105426453A (en) Method for controlling log output grade through configuration item
US20120089562A1 (en) Methods and Apparatus for Integrated Management of Structured Data From Various Sources and Having Various Formats
CN102810057A (en) Log recording method
CN104360951B (en) A kind of script method of testing and device
CN104133772A (en) Automatic test data generation method
CN101187894A (en) Automatic test method based on key word drive and its test system
CN106224278B (en) A kind of compressor control system automatic generation method and device
CN103714290B (en) A kind of software action obtains, monitors and verification method
CN105573774B (en) Application Parameters management and configuration method
CN102611576B (en) Method and device for generating network management configuration model file
CN104063495A (en) Form extension method and form extension device
CN101753971A (en) Journal system and journal recording method in content management system in uniform video management platform
CN106484624A (en) The method of testing of interface automatic test
CN103886444A (en) Provenance-oriented agricultural capital invoicing system
CN101634946B (en) Generation method of RFID member
CN102567413A (en) System and method for data filtering
CN103544107A (en) Method and device for generating test case document
CN107015812A (en) A kind of bios code design method based on INTEL ME
CN102521551B (en) Personalized IC (integrated circuit) card issuing device and method
CN115941464A (en) Intelligent network card power supply state control method and device, electronic equipment and storage medium
CN106547861A (en) A kind of method and device of the data base of intelligent management machine node
CN104700187A (en) Bill generation method
CN103559464B (en) Social security IC-card personalization method, Apparatus and system
CN106775885A (en) A kind of daily record output control method and system and bank management system
CN105100372A (en) Conference recording method and mobile terminal

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20160323

WW01 Invention patent application withdrawn after publication