CN109032881A - A kind of log level dynamic method of adjustment and device - Google Patents

A kind of log level dynamic method of adjustment and device Download PDF

Info

Publication number
CN109032881A
CN109032881A CN201710433094.5A CN201710433094A CN109032881A CN 109032881 A CN109032881 A CN 109032881A CN 201710433094 A CN201710433094 A CN 201710433094A CN 109032881 A CN109032881 A CN 109032881A
Authority
CN
China
Prior art keywords
log
frame
host
interface
level dynamic
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
CN201710433094.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.)
Wuhan Douyu Network Technology Co Ltd
Original Assignee
Wuhan Douyu Network Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuhan Douyu Network Technology Co Ltd filed Critical Wuhan Douyu Network Technology Co Ltd
Priority to CN201710433094.5A priority Critical patent/CN109032881A/en
Publication of CN109032881A publication Critical patent/CN109032881A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
    • G06F11/3093Configuration details thereof, e.g. installation, enabling, spatial arrangement of the probes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/865Monitoring of software

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a kind of log level dynamic method of adjustment and devices, applied to field of software development, the step of this method is executed based on the log level dynamic adjustment component after starting includes: to identify that host applies the log frame of current bindings, and load the realizations class of the log management interface to match with log frame and the realization class of interface is modified in log that log frame matches;The blog management method in the realization class of log management interface is called, loads all log objects of log frame management into target container, and takes out all log objects of log frame management from target container;Call the log amending method in the realization class of log modification interface, to needing to modify the other log object of journal stage in target container from all log objects for the log frame management taken out, log rank of modifying.The present invention improves the efficiency of problem on the line of positioning host's application, while log amount will not be made to explode again and added, therefore will not reduce system performance.

Description

A kind of log level dynamic method of adjustment and device
Technical field
The present invention relates to field of software development more particularly to a kind of log level dynamic method of adjustment and devices.
Background technique
As software developer, when above-the-line project when something goes wrong, we allow for rapidly and efficiently find problem Root and solution.How the efficiency of investigation problem is improved? most effective way is by analysis system log.If system Log is comprehensive, can check for us and solve the problems, such as to bring help big absolutely on line, but to guarantee that system log is comprehensive, just must All system or business diary must be printed.It can bring about another problem in this way, that is, log amount rises suddenly and sharply, largely Although log can help outside we solve the problems, such as, system performance decline can be directly contributed, under extreme case, or even can lead Cause system failure.
Summary of the invention
It is excessive and make to solve log by providing a kind of log level dynamic method of adjustment and device for the embodiment of the present invention The technical issues of declining at system performance.
In a first aspect, being applied to be added with log the embodiment of the invention provides a kind of log level dynamic method of adjustment The step of level dynamic adjusts host's application of component, is executed based on the log level dynamic adjustment component after starting is wrapped It includes:
It identifies that the host applies the log frame of current bindings, and loads the log to match with the log frame The realization class for the log modification interface that the realization class of management interface and the log frame match;
The blog management method in the realization class of the log management interface is called, to load the log frame management All log objects take out from the target container all logs pair of the log frame management into target container As;
The log amending method in the realization class of the log modification interface is called, to take out to from the target container The log frame management all log objects in need to modify the other log object of journal stage, journal stage of modifying Not.
Optionally, before the log frame for identifying the host using current bindings, the method also includes:
When detecting host's application starting, host's application is followed to open log level dynamic adjustment component It is dynamic;
Component instance log context interface and starting log server are adjusted based on the log level dynamic after starting, Wherein, the log server is externally provided for inquiring and modifying the other interface of journal stage.
Optionally, it when detecting host's application starting, is added based on being adjusted in component in the log level dynamic Inventory file start the log level dynamic and adjust component.
Optionally, the log frame for identifying the host and applying current bindings, and load and the log frame The realization class for the log modification interface that the realization class of the log management interface to match and the log frame match, packet It includes:
Load the realization class of the log context interface;
Identify that the host applies the log frame of current bindings;
The method in the realization class of the log context interface is called, to apply the day of current bindings according to the host The realization class of log management interface described in will framework instantiation, and the realization class of the instantiation log modification interface.
Optionally, in the log management interface, at least definition is just like minor function:
For load the host using function of all log objects into target container, and
For return the host using current bindings log frame type function, and
The other function of journal stage for batch modification log object.
Optionally, in the log modification interface, at least definition is just like minor function:
The host is converted into unified journal stage using the log rank of the log object of the log frame of current bindings Other function, and
Specified day is respectively modified into using the log rank of the log object of the log frame of current bindings in the host The function of will rank.
Second aspect, the embodiment of the invention provides a kind of log level dynamics to adjust component, adds in host's application, The log level dynamic adjusts component
Log frame recognition unit, for identification out the host apply current bindings log frame, and load and institute The log modification interface that the realization class and the log frame for stating the log management interface that log frame matches match Realize class;
Log object acquiring unit, the blog management method in realization class for calling the log management interface, with All log objects of the log frame management are loaded into target container, and take out the log from the target container All log objects of frame management;
Log level modification unit calls the log amending method in the realization class of log modification interface, with to from Need to modify the other log pair of journal stage in the target container in all log objects for the log frame management taken out As log rank of modifying.
Optionally, the component further include:
Start unit, for detecting institute before the log frame for identifying the host using current bindings When stating host's application starting, log level dynamic adjustment component is followed into host's application starting;
Component instance log context interface and starting log server are adjusted based on the log level dynamic after starting, Wherein, the log server is externally provided for inquiring and modifying the other interface of journal stage.
Optionally, the start unit, is used for: when detecting host's application starting, based in the log rank The inventory file added in dynamic adjustment component starts the log level dynamic adjustment component.
Optionally, the log frame recognition unit, is specifically used for:
Load the realization class of the log context interface;
Identify that the host applies the log frame of current bindings;
The method in the realization class of the log context interface is called, the log of current bindings is applied according to the host Framework instantiation realization class corresponding with the log management interface, and instantiation reality corresponding with log modification interface Existing class.
Optionally, it is at least defined just like minor function in the log management interface:
For load the host using function of all log objects into target container, and
For return the host using current bindings log frame type function, and
The other function of journal stage for batch modification log object.
Optionally, it is at least defined just like minor function in the log modification interface:
The host is converted into unified journal stage using the log rank of the log object of the log frame of current bindings Other function, and
Specified day is respectively modified into using the log rank of the log object of the log frame of current bindings in the host The function of will rank.
The third aspect, the embodiment of the invention provides a kind of computer readable storage mediums, are stored thereon with computer journey Sequence, program include host's application added with log level dynamic adjustment component, which realizes first when being executed by processor Step described in any implementation in aspect.
Fourth aspect the embodiment of the invention provides a kind of computer equipment, including memory, processor and is stored in On reservoir and the computer program that can run on a processor, the program include the place added with log level dynamic adjustment component Main application, the processor realize step described in any implementation in first aspect when executing described program.
The one or more technical solutions provided in the embodiment of the present invention, have at least the following technical effects or advantages:
Component is adjusted by developing log level dynamic, identifies that host applies the log frame of current bindings, and add Carry the realization class of the log management interface to match with log frame, the realization class of log modification interface;Log management is called to connect Mouthful realization class in blog management method, to load all log objects that log frame is managed into target container, from All log objects that log frame is managed are taken out in target container;The log in the realization class of log modification interface is called to repair Change method, with to needing to modify journal stage other day in target container from all log objects for the log frame management taken out Will object, log rank of modifying, so that adjusting component by the log level dynamic can need to solve host's application Line on problem when adjust the output level of log on line in real time, the host can be obtained using comprehensive debugging log, mention The efficiency of problem on the high line of positioning host's application, while log amount will not be made to explode again, therefore system performance will not be reduced.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 is the flow chart of log level dynamic method of adjustment in the embodiment of the present invention;
Fig. 2 is the structural schematic diagram that log level dynamic adjusts component in the embodiment of the present invention;
Fig. 3 is the structural schematic diagram of computer readable storage medium in the embodiment of the present invention.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is A part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art Every other embodiment obtained without creative efforts, shall fall within the protection scope of the present invention.
Refering to what is shown in Fig. 1, a kind of log level dynamic method of adjustment provided in an embodiment of the present invention, is applied to be added with day Will level dynamic adjusts host's application of component, adjusts the step of component executes based on the log level dynamic after starting and includes:
Firstly, executing S101, identifying that host applies the log frame of current bindings, and loads and currently tied up with host's application The realization class for the log management interface that fixed log frame matches and the log frame phase that current bindings are applied with host The realization class for the log modification interface matched.
Identify host using current bindings log frame be Log4j log frame, Log4j2 log frame and One of Logback log frame.
Specifically, log level dynamic adjusts the log frame that component is bound according to SLF4J after host's application starting The realization class of the log management interface to match and the log modification interface to be matched according to the log frame that SLF4J is bound Realization class.
In the specific implementation process, log management interface is LoggerRegistry interface.Wherein, It is provided in the realization class of LoggerRegistry interface and batch modification is carried out to the log rank of log (Logger) object Logic, to realize that the log rank to log object carries out batch modification.
It is LoggerConverter interface that interface is modified in log, wherein the realization class of LoggerConverter interface The journal stage for providing log object is clipped to the parsing of unified log level map, additionally provides the other concrete modification of journal stage.
Specifically, (i.e. LogContext interface, LogContext interface are defined to log load log context interface Rank progress dynamic adjustment context) realization class, identify host apply current bindings log frame;It calls in log Method in the realization class of context interface, with the log framework instantiation log management interface according to host using current bindings Realize class, and the realization class of instantiation log modification interface.
In the specific implementation process, LogContext interface can be defined as follows:
Wherein, the log pipe in the definition of LogContext interface, in the realization class including the log management interface Each specific method of reason method, wherein including loadLoggers method, loggerType method, listLoggers method, BatchUpdateLoggerLevel method.
LoadLoggers method be used for load host using all log objects into target container.In this hair In bright embodiment, HashMap can be used as the target container for saving log object.It should be noted that HashMap is one Kind Java data structure, in specific implementation process, loadLoggers method can entrust the realization class of LoggerRegistry interface Object, by vicarial LoggerRegistry interface realize class object execute load host using all logs pair As arrive target container operation, load host using all log objects to target container operation specifically in S102 Middle execution.
Host is returned using the type of the log frame of current bindings by executing loggerType method.
By execute listLoggers method return host using all log objects.Wherein, ListLoggers method can entrust the realization class object of LoggerRegistry interface, by vicarial LoggerRegistry Interface it is corresponding realize class object execute return host using all log objects operation, the return host application make The operation of all log objects specifically executes in S102.
In the definition of LogContext interface, also by executing batchUpdateLoggerLevel method batch modification The log rank of log object, the batchUpdateLoggerLevel method have a log for indicating to need to modify Object and the other parameter of journal stage for needing to be modified as: LoggerListVo<LoggerNameLevelPair>loggers.? In specific implementation process, batchUpdateLoggerLevel method can entrust the realization class object of LoggerRegistry interface The other operation of journal stage of batch modification log object is executed, the other operation of the journal stage of the batch modification log object specifically exists It is executed in S102.
After S101, S102 is executed: the blog management method in the realization class of log management interface is called, to load day All log objects that will frame is managed into target container, and take out from target container log frame managed it is all Log object.
By the realization class object of vicarial LoggerRegistry interface, LoggerRegistry interface, citing are called For, the interface of LoggerRegistry is defined as follows:
By loadLoggers method load host using all log objects into target container, parameter It is the log factor interface that SLF4J is provided that ILoggerFactory, which corresponds to log frame, is provided by the log frame SLF4J The available partial log of log factor interface realize the log object that frame is managed.CurrentLoggerType method For returning to host using the type of the log frame of current bindings.ListLoggers method for return host using All log objects.BatchUpdateLoggerLevel method is used for the log rank of batch modification log object.
In order to realize the log rank of batch modification log object, after S102, then executes S103: log being called to repair Log amending method in the realization class of reconfiguration mouth, with all logs pair to the log frame management taken out from target container Need to modify the other log object of journal stage as in, log rank of modifying.
The interface of LoggerConverter is defined as follows:
Wherein, levelFromLogger method is used for the log for being managed host using the log frame of current bindings The log rank of object is converted into unified log rank.The levelFromLogger method has 2 parameters a: parameter Object logger indicates host using the log object of the log frame of current bindings, another parameter LoggerType LoggerType indicates that host applies the log frame of current bindings.
The log rank for the log object that changeLoggerLevel method is managed for concrete modification log frame, The changeLoggerLevel method has 3 parameters, is respectively: Object logger, indicates host using current bindings The log object of log frame;UnifiedLoggerLevel level indicates the log rank that log object needs to be revised as, I.e. specified log rank;LoggerType loggerType indicates host using the type of the log frame of current bindings.It is logical The changeLoggerLevel method is crossed, the log rank of log object is revised as UnifiedLoggerLevel level The specified log rank of parameter.
Before identifying log frame of the host using current bindings, further includes: when detecting host's application starting, day Will level dynamic adjustment component follows host's application starting, is connect based on log level dynamic adjustment component instance log context Mouth and starting log server, wherein log server is externally provided for inquiring and modifying the other interface of journal stage.Due to looking into The other interface of journal stage is ask and modified, allows to don't bother about the day used that platform inquires some host application by journal stage Will object and dynamic modify the host using log object log rank.
In the specific implementation process, when detecting host's application starting, based in log level dynamic adjustment component Inventory file (MANIFEST.MF) the starting log level dynamic of addition adjusts component.
Wherein, the configuration information in MANIFEST.MF file includes manifest attribute, in manifest attribute Premain-Class are set as the title that log level dynamic adjustment component starts class accordingly.The starting class needs to provide Signature is the public static void premain (method of String args, Instrumentation inst.
Addition-javaagent the ginseng in the starting script of host's application for needing to add log level dynamic adjustment component Number.For example, it can be realized by following code:
java-javaagent:${APP_HOME}/dynamic_update_logger.jar
-jar app.jar
Wherein, { APP_HOME } indicates the catalogue at place after the adjustment component packing of log level dynamic, and app indicates to need Host's application that log dynamically adjusts component substantially is added, follows host using starting log level dynamic adjustment group to realize Part.
Original technical solution is put into the logic of log dynamic acquisition in one general project, if other projects Access the function, it is necessary to using this general project as oneself father's project.This just makes to developer to a certain extent At many inconvenience.And the embodiment of the present invention adjusts component by will level dynamic, is host's application based on Java agent mechanism The log level dynamic adjustment function of log level dynamic adjustment component is provided, host is applied without invasive.
The embodiment of the present invention is adapted to the log frame of current mainstream: Log4j, Log4j2 and Logback log frame.To The range that level dynamic adjustment component uses that makes to achieve one's ambition is more extensive, supports extension and extend to apply unaware to host, and The developer of application of the embodiment of the present invention is without being concerned about how log level dynamic adjustment component starts and configure.
It should be noted that in embodiments of the present invention, using SLF4J (The Simple Logging Facade for Java) the log that log shop front printing host application generates in the process of running.
The adjustment of log level dynamic provides the function of log level dynamic adjustment based on Java agent mode for application.
Based on the same inventive concept, the embodiment of the present invention provides a kind of log level dynamic adjustment component, adds in host In, refering to what is shown in Fig. 2, log level dynamic provided in an embodiment of the present invention adjustment component includes:
Log frame recognition unit 201, for identification out the host apply current bindings log frame, and load with Interface is modified in the log that the realization class for the log management interface that the log frame matches and the log frame match Realization class;
Log object acquiring unit 202, the blog management method in realization class for calling the log management interface, To load all log objects of the log frame management into target container, and the day is taken out from the target container All log objects of will frame management;
Log level modification unit 203, the log amending method in realization class for calling the log modification interface, With other to needing to modify journal stage from all log objects for the log frame management taken out in the target container Log object, log rank of modifying.
Optionally, component provided in an embodiment of the present invention further include:
Start unit, for detecting institute before the log frame for identifying the host using current bindings When stating host's application starting, log level dynamic adjustment component is followed into host's application starting, is based on the log Level dynamic adjusts component instance log context interface and starting log server, wherein the log server is external It provides for inquiring and modifying the other interface of journal stage.
Further, in embodiments of the present invention, start unit is specifically used for: when detecting host's application starting, Start the log level dynamic adjustment component based on the inventory file added in log level dynamic adjustment component.
Further, in embodiments of the present invention, the log frame recognition unit 201 is specifically used for:
Load the realization class of the log context interface;
Identify that the host applies the log frame of current bindings;
The method in the realization class of the log context interface is called, to apply the day of current bindings according to the host The realization class of log management interface described in will framework instantiation, and the realization class of the instantiation log modification interface.
Further, in embodiments of the present invention, it is at least defined just like minor function in the log management interface:
For load the host using function of all log objects into target container, and
For return the host using current bindings log frame type function, and
The other function of journal stage for batch modification log object.
Further, in embodiments of the present invention, it is at least defined just like minor function in the log modification interface:
The host is converted into unified journal stage using the log rank of the log object of the log frame of current bindings Other function, and
Specified day is respectively modified into using the log rank of the log object of the log frame of current bindings in the host The function of will rank.
Based on the same inventive concept, it the embodiment of the invention provides a kind of computer readable storage medium 301, stores thereon There is computer program 302, which includes host's application added with log level dynamic adjustment component, 302 quilt of program Processor realizes step described in any embodiment in aforementioned log level dynamic method of adjustment when executing, in order to illustrate book Succinctly, repeats no more herein.
Based on the same inventive concept, the embodiment of the invention provides a kind of computer equipment, including memory, processor and The computer program that can be run on a memory and on a processor is stored, which includes adjusting added with log level dynamic The host of component applies, and the processor realizes any implementation in aforementioned log level dynamic method of adjustment when executing described program Step described in mode, in order to illustrate the succinct of book, repeats no more herein.
One or more technical solution provided in an embodiment of the present invention, at least realizes following technical effect or advantage:
Component is adjusted by developing log level dynamic, identifies that host applies the log frame of current bindings, and add Carry the realization class with the realization class for the log management interface that log frame matches respectively, log modification interface;Call log pipe The blog management method in the realization class of interface is managed, to load all log objects that log frame is managed to target container In, all log objects that log frame is managed are taken out from target container;In the realization class for calling log modification interface Log amending method, to need to modify journal stage to from all log objects for the log frame management taken out in target container Other log object, log rank of modifying, so that adjusting component by the log level dynamic can need to solve place The output level of log on line is adjusted on the line of main application when problem, in real time host application comprehensive debugging day can be obtained Will, improves the efficiency of problem on the line of positioning host's application, while log amount will not be made to explode again, therefore will not reduce system Performance.
Algorithm and display are not inherently related to any particular computer, virtual system, or other device provided herein. Various general-purpose systems can also be used together with teachings based herein.According to each description above, constructs this kind of system and wanted The structure asked is obvious.In addition, the present invention is also not directed to any particular programming language.It should be understood that can use each Kind programming language realizes summary of the invention described herein, and the description done above to language-specific is to disclose this The preferred forms of invention.
In the instructions provided here, numerous specific details are set forth.It is to be appreciated, however, that implementation of the invention Example can be practiced without these specific details.In some instances, well known method, structure is not been shown in detail And technology, so as not to obscure the understanding of this specification.
Similarly, it should be understood that in order to simplify the disclosure and help to understand one or more of the various inventive aspects, Above in the description of exemplary embodiment of the present invention, each feature of the invention is grouped together into single implementation sometimes In example, figure or descriptions thereof.However, the disclosed method should not be interpreted as reflecting the following intention: i.e. required to protect Shield the present invention claims features more more than feature expressly recited in each claim.More precisely, as following Claims reflect as, inventive aspect is all features less than single embodiment disclosed above.Therefore, Thus the claims for following specific embodiment are expressly incorporated in the specific embodiment, wherein each claim itself All as a separate embodiment of the present invention.
Those skilled in the art will understand that can be carried out adaptively to the module in the equipment in embodiment Change and they are arranged in one or more devices different from this embodiment.It can be the module or list in embodiment Member or component are combined into a module or unit or component, and furthermore they can be divided into multiple submodule or subelement or Sub-component.Other than such feature and/or at least some of process or unit exclude each other, it can use any Combination is to all features disclosed in this specification (including adjoint claim, abstract and attached drawing) and so disclosed All process or units of what method or apparatus are combined.Unless expressly stated otherwise, this specification is (including adjoint power Benefit require, abstract and attached drawing) disclosed in each feature can carry out generation with an alternative feature that provides the same, equivalent, or similar purpose It replaces.
In addition, it will be appreciated by those of skill in the art that although some embodiments described herein include other embodiments In included certain features rather than other feature, but the combination of the feature of different embodiments mean it is of the invention Within the scope of and form different embodiments.For example, in the following claims, embodiment claimed is appointed Meaning one of can in any combination mode come using.
Various component embodiments of the invention can be implemented in hardware, or to run on one or more processors Software module realize, or be implemented in a combination thereof.It will be understood by those of skill in the art that can be used in practice Microprocessor or digital signal processor (DSP) realize that intelligent camera system and network according to an embodiment of the present invention are taken the photograph As some or all functions of some or all components in head.The present invention is also implemented as being retouched here for executing The some or all equipment or system program (such as computer program and computer program product) for the method stated.In this way Realization program of the invention can store on a computer-readable medium, or can have the shape of one or more signal Formula.Such signal can be downloaded from an internet website to obtain, and perhaps be provided on the carrier signal or with any other shape Formula provides.
It should be noted that illustrate the present invention rather than limit it for the various embodiments described above, and Those skilled in the art can be designed alternative embodiment without departing from the scope of the appended claims.In claim In, any reference symbol between parentheses should not be configured to limitations on claims.Word "comprising" is not excluded for There are elements or steps not listed in the claims.Word "a" or "an" located in front of the element does not exclude the presence of more A such element.The present invention can be by means of including the hardware of several different elements and by means of properly programmed calculating Machine is realized.If several in these systems can be by same in the unit claim for listing dry systems Hardware branch embodies.The use of word first, second and third etc. does not indicate any sequence.These words can be explained For title.

Claims (10)

1. a kind of log level dynamic method of adjustment is applied applied to the host added with log level dynamic adjustment component, It is characterized in that, adjusting the step of component executes based on the log level dynamic after starting includes:
It identifies that the host applies the log frame of current bindings, and loads the log management to match with the log frame The realization class for the log modification interface that the realization class of interface and the log frame match;
The blog management method in the realization class of the log management interface is called, to load all of the log frame management Log object takes out from the target container all log objects of the log frame management into target container;
The log amending method in the realization class of the log modification interface is called, to the institute taken out from the target container It states and needs to modify the other log object of journal stage in all log objects of log frame management, log rank of modifying.
2. log level dynamic method of adjustment as described in claim 1, which is characterized in that identify that the host answers described Before the log frame of current bindings, the method also includes:
When detecting host's application starting, log level dynamic adjustment component is followed into host's application starting;
Component instance log context interface and starting log server are adjusted based on the log level dynamic after starting, In, the log server is externally provided for inquiring and modifying the other interface of journal stage.
3. log level dynamic method of adjustment as claimed in claim 1 or 2, which is characterized in that detect host's application When starting, the log level dynamic adjustment is started based on the inventory file added in log level dynamic adjustment component Component.
4. log level dynamic method of adjustment as described in claim 1, which is characterized in that described to identify host's application The log frame of current bindings, and load the log management interface to match with the log frame realization class and the day The realization class for the log modification interface that will frame matches, comprising:
Load the realization class of the log context interface;
Identify that the host applies the log frame of current bindings;
The method in the realization class of the log context interface is called, to apply the log frame of current bindings according to the host Frame instantiates the realization class of the log management interface, and the realization class of the instantiation log modification interface.
5. log level dynamic method of adjustment as described in claim 1, which is characterized in that in the log management interface at least Definition is just like minor function:
For load the host using function of all log objects into target container, and
For return the host using current bindings log frame type function, and
The other function of journal stage for batch modification log object.
6. log level dynamic method of adjustment as described in claim 1, which is characterized in that in the log modification interface at least Definition is just like minor function:
The host is applied the log rank of the log object of the log frame of current bindings be converted into unified journal stage other Function, and
Specified journal stage is respectively modified into using the log rank of the log object of the log frame of current bindings in the host Other function.
7. a kind of log level dynamic adjusts component, addition is in host's application, which is characterized in that the log level dynamic tune Whole group part includes:
Log frame recognition unit, the host applies the log frame of current bindings out for identification, and loads and the day The realization for the log modification interface that the realization class for the log management interface that will frame matches and the log frame match Class;
Log object acquiring unit, the blog management method in realization class for calling the log management interface, with load All log objects of the log frame management take out the log frame into target container from the target container All log objects of management;
Log level modification unit, the log amending method in realization class for calling log modification interface, with to from Need to modify the other log pair of journal stage in the target container in all log objects for the log frame management taken out As log rank of modifying.
8. log level dynamic as claimed in claim 7 adjusts component, which is characterized in that the component further include:
Start unit, for detecting the place before the log frame for identifying the host using current bindings Log level dynamic adjustment component is followed into host's application starting when main application starts;
Component instance log context interface and starting log server are adjusted based on the log level dynamic after starting, In, the log server is externally provided for inquiring and modifying the other interface of journal stage.
9. a kind of computer readable storage medium, is stored thereon with computer program, which includes not moving added with journal stage State adjusts host's application of component, which is characterized in that realizes when the program is executed by processor any described in claim 1-6 The step of.
10. a kind of computer equipment including memory, processor and stores the meter that can be run on a memory and on a processor Calculation machine program, the program include host's application added with log level dynamic adjustment component, which is characterized in that the processor Step as claimed in any one of claims 1 to 6 is realized when executing described program.
CN201710433094.5A 2017-06-09 2017-06-09 A kind of log level dynamic method of adjustment and device Pending CN109032881A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710433094.5A CN109032881A (en) 2017-06-09 2017-06-09 A kind of log level dynamic method of adjustment and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710433094.5A CN109032881A (en) 2017-06-09 2017-06-09 A kind of log level dynamic method of adjustment and device

Publications (1)

Publication Number Publication Date
CN109032881A true CN109032881A (en) 2018-12-18

Family

ID=64629847

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710433094.5A Pending CN109032881A (en) 2017-06-09 2017-06-09 A kind of log level dynamic method of adjustment and device

Country Status (1)

Country Link
CN (1) CN109032881A (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110058935A (en) * 2019-04-26 2019-07-26 广州华多网络科技有限公司 Log rank method of adjustment, apparatus and system, readable storage medium storing program for executing
CN111130905A (en) * 2019-12-31 2020-05-08 青梧桐有限责任公司 Distributed cluster-based log level dynamic adjustment method
CN111177078A (en) * 2019-12-18 2020-05-19 广州华多网络科技有限公司 Log processing method and device and electronic equipment
CN111182066A (en) * 2019-12-31 2020-05-19 青梧桐有限责任公司 Log level dynamic adjustment method based on token authentication
CN111435327A (en) * 2019-01-15 2020-07-21 菜鸟智能物流控股有限公司 Log record processing method, device and system
CN111475379A (en) * 2020-03-27 2020-07-31 苏州浪潮智能科技有限公司 Log processing method and device, electronic equipment and storage medium
CN111488230A (en) * 2019-01-29 2020-08-04 北京京东尚科信息技术有限公司 Method and device for modifying log output level, electronic equipment and storage medium
CN113204533A (en) * 2021-05-28 2021-08-03 平安国际智慧城市科技股份有限公司 Log level adjusting method and device, computer equipment and storage medium
WO2023029955A1 (en) * 2021-08-30 2023-03-09 华为技术有限公司 Method for printing dynamic log, and electronic device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140149576A1 (en) * 2012-11-29 2014-05-29 Vladimir Pavlov Managing Application Log Levels in Cloud Environment
CN105843822A (en) * 2015-01-16 2016-08-10 北京神州泰岳软件股份有限公司 Method and device for changing log levels
CN106681891A (en) * 2015-11-05 2017-05-17 阿里巴巴集团控股有限公司 Method and device for adjusting log levels in Java application system

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140149576A1 (en) * 2012-11-29 2014-05-29 Vladimir Pavlov Managing Application Log Levels in Cloud Environment
CN105843822A (en) * 2015-01-16 2016-08-10 北京神州泰岳软件股份有限公司 Method and device for changing log levels
CN106681891A (en) * 2015-11-05 2017-05-17 阿里巴巴集团控股有限公司 Method and device for adjusting log levels in Java application system

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
美团技术团队: "日志级别动态调整—小工具解决大问题", 《HTTPS://BLOG.CSDN.NET/MEITUANTECH/ARTICLE/DETAILS/80062331》 *
长发等: "日志级别动态调整—小工具解决大问题", 《HTTP://IT.TAOCMS.ORG/02/13178.HTM》 *
长发等: "日志级别动态调整—小工具解决大问题", 《HTTPS://TECH.MEITUAN.COM/2017/02/17/CHANGE-LOG-LEVEL.HTML》 *
长发等: "日志级别动态调整——小工具解决大问题", 《HTTPS://WWW.MTYUN.COM/LIBRARY/CHANGE_LOG_LEVEL》 *

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111435327A (en) * 2019-01-15 2020-07-21 菜鸟智能物流控股有限公司 Log record processing method, device and system
CN111435327B (en) * 2019-01-15 2023-11-14 菜鸟智能物流控股有限公司 Log record processing method, device and system
CN111488230A (en) * 2019-01-29 2020-08-04 北京京东尚科信息技术有限公司 Method and device for modifying log output level, electronic equipment and storage medium
CN110058935A (en) * 2019-04-26 2019-07-26 广州华多网络科技有限公司 Log rank method of adjustment, apparatus and system, readable storage medium storing program for executing
CN110058935B (en) * 2019-04-26 2022-07-22 广州方硅信息技术有限公司 Log level adjusting method, device and system and readable storage medium
CN111177078A (en) * 2019-12-18 2020-05-19 广州华多网络科技有限公司 Log processing method and device and electronic equipment
CN111130905A (en) * 2019-12-31 2020-05-08 青梧桐有限责任公司 Distributed cluster-based log level dynamic adjustment method
CN111182066A (en) * 2019-12-31 2020-05-19 青梧桐有限责任公司 Log level dynamic adjustment method based on token authentication
CN111475379A (en) * 2020-03-27 2020-07-31 苏州浪潮智能科技有限公司 Log processing method and device, electronic equipment and storage medium
CN113204533A (en) * 2021-05-28 2021-08-03 平安国际智慧城市科技股份有限公司 Log level adjusting method and device, computer equipment and storage medium
WO2023029955A1 (en) * 2021-08-30 2023-03-09 华为技术有限公司 Method for printing dynamic log, and electronic device

Similar Documents

Publication Publication Date Title
CN109032881A (en) A kind of log level dynamic method of adjustment and device
CN108958796B (en) Service request processing method and device and service request processing system
US10282171B2 (en) Application analyzer for cloud computing
US8762986B2 (en) Advanced packaging and deployment of virtual appliances
US10223106B1 (en) Customized static source code analysis
US9870313B2 (en) Unit-level formal verification for vehicular software systems
CN110912724B (en) Parameter-driven automatic service arrangement method and device
CN108156022A (en) A kind of service calling method, device and electronic equipment
US20120159466A1 (en) Dynamic determination of application server runtime classloading
US10284634B2 (en) Closed-loop infrastructure orchestration templates
US9990184B2 (en) Distributed component model
US10338952B2 (en) Program execution without the use of bytecode modification or injection
US20180157472A1 (en) Customized application state transition
US9141363B2 (en) Application construction for execution on diverse computing infrastructures
US20190377662A1 (en) Identifying a source file for use in debugging compiled code
CN109298900A (en) A kind of application fractionation and on-demand loading method, apparatus
US8862545B2 (en) Multi-environment configuration of data integration projects
CN109740765A (en) A kind of machine learning system building method based on Amazon server
CN109460546A (en) List generation method, device and electronic equipment
CN109062714A (en) The method, apparatus and electronic equipment of long-range control Android device
CN117519877A (en) Rendering method and device of quick application card, storage medium and electronic equipment
EP3069240A1 (en) Ontology-based user requirement decomposition for component selection for service provision
US11163594B2 (en) Rescheduling JIT compilation based on jobs of parallel distributed computing framework
WO2021047662A1 (en) Method and apparatus for enabling autonomous acceleration of dataflow ai applications
CN107329880A (en) The method and system of dynamic access daily record example in a kind of java environment

Legal Events

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

Application publication date: 20181218