CN110399107A - Log Method of printing, device, storage medium and equipment - Google Patents

Log Method of printing, device, storage medium and equipment Download PDF

Info

Publication number
CN110399107A
CN110399107A CN201910671531.6A CN201910671531A CN110399107A CN 110399107 A CN110399107 A CN 110399107A CN 201910671531 A CN201910671531 A CN 201910671531A CN 110399107 A CN110399107 A CN 110399107A
Authority
CN
China
Prior art keywords
log
default
journaling
configuration
context object
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.)
Granted
Application number
CN201910671531.6A
Other languages
Chinese (zh)
Other versions
CN110399107B (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.)
Shenzhen Mengtian Technology Co Ltd
Original Assignee
Shenzhen Mengtian 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 Shenzhen Mengtian Technology Co Ltd filed Critical Shenzhen Mengtian Technology Co Ltd
Priority to CN201910671531.6A priority Critical patent/CN110399107B/en
Publication of CN110399107A publication Critical patent/CN110399107A/en
Application granted granted Critical
Publication of CN110399107B publication Critical patent/CN110399107B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/12Digital output to print unit, e.g. line printer, chain printer
    • G06F3/1201Dedicated interfaces to print systems
    • G06F3/1223Dedicated interfaces to print systems specifically adapted to use a particular technique
    • G06F3/1237Print job management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The embodiment of the invention discloses log Method of printing, device, storage medium and equipment.This method comprises: passing through call entry component detection to when the call request for being directed to destination application, obtain corresponding default log configuration, target journaling context object is created in local thread according to default log configuration, wherein, it include log list attribute corresponding with default log configuration in target journaling context object, the corresponding log information of call entry component that will acquire and the log information got by presetting log interface, it is added in target journaling context object according to log list attribute, when detecting that the calling process for destination application finishes, the log information for including in target journaling context object is printed using default log output interface by call entry component, to generate journal file.The embodiment of the present invention can more intuitively check the execution link of application program, and save memory space.

Description

Log Method of printing, device, storage medium and equipment
Technical field
The present embodiments relate to field of computer technology more particularly to log Method of printing, device, storage medium and set It is standby.
Background technique
The log of application program can recorde the running track of application program, easy-to-look-up key message, also fast and easy Positioning solves the problems, such as.The effect of log is included in test or when production environment does not have Debug debugging tool, as exploitation or test The important means of personnel positioning problem.Log prints rationally, can quickly be positioned according to the track of log and solve to ask on line Topic, conversely, log prints bad, cannot not only navigate to problem, it is also possible to will affect the performance of system.
Currently, the method generallyd use in print log is to rely on the application programming interfaces such as slf4j (Application Programming Interface, API) carries out log printing, but log prints very in journal file Dispersion, cannot intuitively find out the execution link of application program, and excessive redundant logs information will cause memory space by mistake Occupy, therefore, current log printing solution needs to improve more.
Summary of the invention
The embodiment of the invention provides log Method of printing, device, storage medium and equipment, can optimize existing log Printing solution.
In a first aspect, the embodiment of the invention provides a kind of log Method of printings, comprising:
, to when the call request for being directed to destination application, corresponding default day is being obtained by call entry component detection Will configuration, wherein the call entry component includes one in multiple default journaling agents;
Target journaling context object is created in local thread according to the default log configuration, wherein the target Include log list attribute corresponding with the default log configuration in log context object;
The corresponding log information of the call entry component that will acquire is added to institute according to the log list attribute It states in target journaling context object;
When detecting that the destination application calls default log interface, will be obtained by the default log interface To log information be added in the target journaling context object according to the log list attribute;
When detecting that the calling process for the destination application finishes, used by the call entry component Default log output interface prints the log information for including in the target journaling context object, to generate journal file.
Second aspect, the embodiment of the invention provides a kind of log printing equipments, comprising:
Log configuration obtains module, for being asked by call entry component detection to the calling for destination application When asking, corresponding default log configuration is obtained, wherein the call entry component includes one in multiple default journaling agents It is a;
Object Creation module, for creating target journaling context pair in local thread according to the default log configuration As, wherein include log list attribute corresponding with the default log configuration in the target journaling context object;
First log information adding module, the corresponding log information foundation of the call entry component for will acquire The log list attribute is added in the target journaling context object;
Second log information adding module, for when detecting that the destination application calls default log interface, The log information got by the default log interface is added to the target journaling according to the log list attribute In context object;
Log print module, for passing through institute when detecting that the calling process for the destination application finishes It states call entry component and prints the log information for including in the target journaling context object using default log output interface, To generate journal file.
The third aspect, the embodiment of the invention provides a kind of computer readable storage mediums, are stored thereon with computer journey Sequence realizes such as log Method of printing provided in an embodiment of the present invention when the program is executed by processor.
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 processor realize such as this hair when executing the computer program The log Method of printing that bright embodiment provides.
The log printing solution provided in the embodiment of the present invention is passing through call entry component detection to for target application When the call request of program, corresponding default log configuration is obtained, target is created in local thread according to default log configuration Log context object, wherein include log list category corresponding with default log configuration in target journaling context object Property, the corresponding log information of the call entry component that will acquire is added to the target journaling or more according to log list attribute In literary object, when detecting that destination application calls default log interface, day for will being got by presetting log interface Will information is added in target journaling context object according to log list attribute, is detecting the tune for destination application When being finished with process, printed in the target journaling context object by call entry component using default log output interface The log information for including, to generate journal file.By using above-mentioned technical proposal, the log towards calling may be implemented and beat Print, and targeted log information acquisition is carried out according to default log configuration, it is by local thread that calling process is corresponding Log information is together in series, and so as to more intuitively check the execution link of application program, and saves memory space.
Detailed description of the invention
Fig. 1 is a kind of flow diagram for log Method of printing that the embodiment of the present invention one provides;
Fig. 2 is a kind of flow diagram of log Method of printing provided by Embodiment 2 of the present invention;
Fig. 3 is a kind of log printing solution configuration diagram provided by Embodiment 2 of the present invention;
Fig. 4 is a kind of structural block diagram for log printing equipment that the embodiment of the present invention three provides;
Fig. 5 is a kind of structural block diagram for computer equipment that the embodiment of the present invention five provides.
Specific embodiment
To further illustrate the technical scheme of the present invention below with reference to the accompanying drawings and specific embodiments.It is understood that It is that specific embodiment described herein is used only for explaining the present invention rather than limiting the invention.It further needs exist for illustrating , only the parts related to the present invention are shown for ease of description, in attached drawing rather than entire infrastructure.
It should be mentioned that some exemplary embodiments are described as before exemplary embodiment is discussed in greater detail The processing or method described as flow chart.Although each step is described as the processing of sequence by flow chart, many of these Step can be implemented concurrently, concomitantly or simultaneously.In addition, the sequence of each step can be rearranged.When its operation The processing can be terminated when completion, it is also possible to have the additional step being not included in attached drawing.The processing can be with Corresponding to method, function, regulation, subroutine, subprogram etc..
Embodiment one
Fig. 1 is a kind of flow diagram for log Method of printing that the embodiment of the present invention one provides, and this method can be by day Will printing equipment executes, and wherein the device can be implemented by software and/or hardware, and can generally be integrated in computer equipment.Such as Fig. 1 It is shown, this method comprises:
Step 101, to when the call request for being directed to destination application, is obtained and is corresponded to by call entry component detection Default log configuration, wherein the call entry component includes one in multiple default journaling agents.
Illustratively, letter first is done using interior log frame to what log Method of printing provided in an embodiment of the present invention was relied on Unitary declaration.In the technical solution of the embodiment of the present invention, comprising multiple default journaling agents and multiple default in the log frame Log interface.
Wherein, default journaling agent may include Dubbo journaling agent (Dubbo log proxy), MQ journaling agent (MQ Log proxy), Mybatis journaling agent (Mybatis log proxy) and Redis journaling agent (Redis log Proxy), the call entry component includes Dubbo journaling agent and/or MQ journaling agent.Dubbo is the high property of an open source Java remote procedure call (Remote Procedure Call, RPC) frame of energy and lightweight, provides towards interface Remote method call, intelligent fault-tolerance and load balancing and the automatic ability registered and find of service.Message queue (Message Queue, MQ) it is also a kind of RPC component.Mybatis is a outstanding Persistence Layer Framework, it supports to customize structuralized query Language (Structured Query Language, SQL), storing process and advanced mapping.Redis is the branch of an open source Hold network, it is memory-based also can persistence log type, key-value (Key-Value) database, and provide multilingual API.Each above-mentioned default journaling agent is construed as a kind of log component for docking an application component.Above-mentioned four kinds Default journaling agent only also may include other kinds of journaling agent illustratively, and the embodiment of the present application does not limit It is fixed.Call entry component in the embodiment of the present invention can be Dubbo journaling agent and/or MQ journaling agent.
Wherein, default log interface is the customized interface of the embodiment of the present invention, can be denoted as logapi, abbreviation lapi.Phase In the technology of pass, logger.debug or logger.info are calling standard logs output interfaces, and in the embodiment of the present invention, it can Application program to be called originally the place of logger.debug or logger.info all replace in the embodiment of the present invention lapi.Lapi realizes that lapi is the customized day realized and expanded slf4j interface similar to this log output of log4j Will api can expand the no function of slf4j, such as the maximum value of dynamic setting log call chain list.
Illustratively, it by taking call entry component is Dubbo log proxy as an example, is asked for the calling of destination application Asking can be initiated by the called side (such as Dubbo client) of Dubbo, and the Dubbo log proxy of destination application can be with The form of Dubbo blocker intercepts the call request, to detect the call request for destination application.If call into Mouth component is MQ log proxy, and blocker can also be arranged on MQ message monitoring method, and each MQ message confirmation, which enters, to disappear Consuming method money is ceased, is introduced into the method for executing MQ agency, and then detect the call request for destination application.
Illustratively, it presets and includes at least one of the following: object invocation equipment, object invocation application, mesh in log configuration Mark calls class, target calling method, sentence execution information, enters ginseng, goes out ginseng, time-consuming and layout.In this way, by presetting day Selective, targeted print log may be implemented in will configuration.Default log configuration can store in local, can also be with It is stored in other equipment.Illustratively, presetting log configuration can be stored in configuration center (configer center).It can Choosing, it is described to obtain corresponding default log configuration, comprising: corresponding default log configuration is obtained from preset configuration center. The advantages of this arrangement are as follows can be configured in order to manage default log.
It further, include preset configuration information in the default journaling agent and/or default log interface, in institute It states and realizes that presetting log accordingly according to the preset configuration information dynamic configuration configures in preset configuration center.It is arranged in this way It is advantageous in that, default log configuration can be set online, come into force in real time, improve the flexibility of log printing.It optionally, can be with Log configuration is preset accordingly according to the preset configuration information dynamic configuration by configuration center Middleware implementation, with For zookeeper, can on zookeeper configuration information, pass through distributed consensus protocol synchronization to each application section On point, so accomplish Configuration Online real-time synchronization.
Step 102 creates target journaling context object according to the default log configuration in local thread, wherein Include log list attribute corresponding with the default log configuration in target journaling context object.
Illustratively, local thread (threadlocal) is a local thread copy Variant Tool class, Ke Yi Object one by one is saved in threadlocal, such as log context object (logContext), there is the category of log list in object Property, when Object Creation, initializes the list data structure of log list, namely is configured according to default log in this ground wire Target journaling context object is created in journey, includes day corresponding with default log configuration in target journaling context object Will list attribute.
Step 103, the corresponding log information of the call entry component that will acquire are according to the log list attribute It is added in the target journaling context object.
Illustratively, log information here may include application name, called class complete trails and call method Name etc..Log list attribute is corresponding with default log configuration, therefore can accomplish to configure according to default log and will acquire Log information be added in target journaling context object.
Step 104, when detecting that the destination application calls default log interface, the default log will be passed through The log information that interface is got is added in the target journaling context object according to the log list attribute.
Illustratively, it when detecting target with log interface print log is preset with routine call, equally will acquire Log information be added in target journaling context object according to log list attribute, required log information is existed to realize Summarized in local thread, convenient for subsequent unified output.
Step 105, when detecting that the calling process for the destination application finishes, pass through the call entry Component prints the log information for including in the target journaling context object using default log output interface, to generate log File.
Illustratively, at the end of being directed to the entire calling process of destination application, thread is called to return to call entry In component, correlation log information when terminating to call can be added to target journaling context pair also according to log list attribute As in, in this way, just containing the log information of entire call chain in threadlocal, used by call entry component default The log information for including in log output interface printing target journaling context object, can generate journal file.Wherein, in advance If log output interface can be the log4j of slf4j, to realize api to log system output journal.
The log Method of printing provided in the embodiment of the present invention is passing through call entry component detection to for target application When the call request of program, corresponding default log configuration is obtained, target is created in local thread according to default log configuration Log context object, wherein include log list category corresponding with default log configuration in target journaling context object Property, the corresponding log information of the call entry component that will acquire is added to the target journaling or more according to log list attribute In literary object, when detecting that destination application calls default log interface, day for will being got by presetting log interface Will information is added in target journaling context object according to log list attribute, is detecting the tune for destination application When being finished with process, printed in the target journaling context object by call entry component using default log output interface The log information for including, to generate journal file.By using above-mentioned technical proposal, the log towards calling may be implemented and beat Print, and targeted log information acquisition is carried out according to default log configuration, it is by local thread that calling process is corresponding Log information is together in series, and so as to more intuitively check the execution link of application program, and saves memory space.
Embodiment two
Fig. 2 is a kind of flow diagram of log Method of printing provided by Embodiment 2 of the present invention, and the embodiment of the present invention exists It is optimized on the basis of above-described embodiment, increases log information processing phase when destination application calls default journaling agent Hold inside the Pass.
Illustratively, target journaling context object is created in local thread according to the default log configuration described Later, further includes: detecting that the destination application calls the target journaling in the multiple default journaling agent to act on behalf of When, the log information got from the target journaling Agency is added to the target day according to the log list attribute In will context object.The advantages of this arrangement are as follows log information can be obtained more fully hereinafter, by complete call chain log Information prints in journal file.
It is further, described that target journaling context object is created in local thread according to the default log configuration, It include: the creation log context object in local thread, according to the log output template for including in the default log configuration The list data structure of log list in the log context object created is initialized, target journaling or more is obtained Literary object.The advantages of this arrangement are as follows can more easily realize personal settings day by the way that log output template is arranged Will file content, can service-oriented to log output template carry out configurableization setting.
Specifically, as shown in Fig. 2, this method may include following steps:
Step 201, by call entry component detection arrive for destination application call request when, from pre- establishing It sets and obtains corresponding default log configuration in center.
Fig. 3 is a kind of log printing solution configuration diagram provided by Embodiment 2 of the present invention, as shown in figure 3, the framework In core component be various journaling agents (log proxy) and default log interface (lapi), by local thread (threadlocal) recalls information of each proxy and lapi (such as enter ginseng, go out ginseng, time-consuming and customized log) is connected Get up.Default journaling agent includes Dubbo journaling agent, MQ journaling agent, Mybatis journaling agent and Redis journaling agent, Wherein Dubbo journaling agent and MQ journaling agent can be used as call entry component.4 default log interfaces are shown in Fig. 3 (lapi).Configuration center (configer center), can be according to pre- for saving default log configuration and log output template If the preset configuration information for including in journaling agent or default log interface, realize in the preset configuration center according to institute It states preset configuration information dynamic configuration and presets log configuration accordingly.
Illustratively, include at least one of the following: that object invocation equipment, object invocation are answered in the default log configuration With, object invocation class, target calling method, sentence execution information, enter ginseng, go out ginseng, time-consuming and layout.Illustratively, Dubbo journaling agent and MQ journaling agent can share a configuration, can also divide table setting is personalized to match for Dubbo and MQ It sets, if entrance log configuration mylog.application.entry.model can share one, personalized log configures ratio If whether message subject (topic) information of MQ will export, the configurations the such as whether information of Dubbo called side will export.
Further, it is also possible to there is other individual cultivations.It may include but be not limited to be arranged as follows, can configure and close all days Will printing only prints some packet or the log of some class, prints info or debug log, if export complete sql sentence, be No the entering for some log proxy that export joins or goes on business etc..Such as, it is desirable to every other business diary is shielded, only prints certain Machine, some applies some class, and the log of some method can do following setting in configuration: Mylog.application.logswitch=off, it is to close that setting institute's applied business log, which exports switch, not allocating default For on opening;Mylog.application.logswitch.method.whitelist=com.fenqile .postloan. Asset.mqConsum erImpl.consumer, setting log print the com.f that white list is postloan.asset application Enqile.postloan.asset.mqConsumerImpl realizes the consumer method of class, and allocating default does not filter;my Log.application.logswitch.ip.whitelist=10.79.10.6, the machine ip that print log is arranged are 10.79.10.6 allocating default does not filter.Method by presetting the available called method of method in journaling agent Name complete trails and enter ginseng, by the api of java it is available arrive the machine ip address information, preset journaling agent according to match confidence Breath, which is filtered above- mentioned information, can be realized.
Step 202 creates log context object in local thread, defeated according to the log for including in default log configuration Template initializes the list data structure of the log list in the log context object created out, obtains target day Will context object.
Wherein, log list category corresponding with the default log configuration is included in the target journaling context object Property.For example, the list data structure of log list is corresponding with log output template.Illustratively, log output template is specific It can be following form mylog.application.entry.model=%methodName%, params:[% Params%], the first row output method name of log, comma are identified, params is into ginseng in subsequent [].It optionally, can be with Log output template is configured in configuration center with mylog.app.model as in the attribute value of key, Value Types standard is such as The definition standard key=value of properties file.
Step 203, the corresponding log information of the call entry component that will acquire are according to the log list attribute It is added in the target journaling context object.
Illustratively, the corresponding log information of the call entry component that will acquire passes through invocation list (list) Addition (add) method assembles the corresponding character string of log information according to the log list attribute, and is added to described In target journaling context object.Specifically, can be according to the character string and guarantor that log list set of properties loading port log exports There are in the list of String type in the logContext object of threadlocal, the side add of list can be specifically called Method.
Step 204, when detecting that the destination application calls default log interface, the default log will be passed through The log information that interface is got is added in the target journaling context object according to the log list attribute.
Illustratively, when detecting that the destination application calls default log interface, the default day will be passed through The log information that will interface is got is by addition (add) method of invocation list (list) according to the log list attribute pair The corresponding character string of log information is assembled, and is added in the target journaling context object.Specifically, can be by day Will character string is stored in the logContext object of threadlocal in the list of String type, can specifically be called The add method of list.
Step 205 is detecting that the destination application calls the target journaling in the multiple default journaling agent When acting on behalf of, the log information got from the target journaling Agency is added to the mesh according to the log list attribute It marks in log context object.
Illustratively, detecting that the destination application calls the target journaling in the multiple default journaling agent It is when acting on behalf of, the log information got from the target journaling Agency is square by the addition (add) of invocation list (list) Method assembles the corresponding character string of log information according to the log list attribute, and is added to the target journaling or more In literary object.It, can be in Redis if destination application is called to Redis by taking target journaling agency is Redis as an example It is realized in log proxy by blocker and corresponding log character string is exported (as adjusted by the log configuration in logContext With method, enter ginseng and out ginseng etc.) and be stored in the logContext object of threadlocal in the list of String type, The add method of list can specifically be called.Mybatis is similar with Redis, and details are not described herein again.
Step 206, when detecting that the calling process for the destination application finishes, pass through the call entry Component prints the log information for including in the target journaling context object using default log output interface, to generate log File.
Illustratively, ultimate method calling finishes, and calls thread that can return in Dubbo proxy again, according to Log configuration output phase in logContext answers result log character string and is stored in logContext pairs of threadlocal As middle String type list in, the final log4j for calling slf4j realizes api to log system output journal.
Illustratively, in the technical solution of the embodiment of the present invention, include in the log according to self-defined application log output Access information, can with quick lock in it is specific which call, and see all information of the call chain road at a glance.For example, c This method name complete trails of om.fenqile.postloan.asset.mqConsumerImpl.consumer contains many letters The application of breath, calling is postloan.asset, realizes that class is mqConsumerImpl, method is consumer, if template Middle setting needs to print ip, which platform machine can also be seen to be by log output.In addition, by being filtered to entering ginseng, moreover it is possible to Order number or other attributes are navigated to, and then can support to filter by service order, only printing meets the order pair of matching condition All or part of information that link should be called, without sending out version or restarting machine.
The log printing towards calling may be implemented in log Method of printing provided in an embodiment of the present invention, can in real time certainly Define log output, can with service-oriented formulate configurableization log template, using local thread by each default journaling agent with The recalls information of default log interface is together in series, and the full link of calling process, solution are embodied in the log finally printed The problem that log is too big during log of having determined output and readability is poor.Tests prove that using provided in an embodiment of the present invention Technical solution, can be supported well in asset management class system production handling capacity (Transactions Per Second, TPS) reach 1500 or more ranks, in terms of orientation problem, the problem of spending completion in 1 to 2 hour positioning is needed in the past, by adopting It can be reduced to 2 to 5 minutes with the technical solution of the embodiment of the present invention.In addition, Configuration Online can be supported, come into force in real time, log The flexibility of printing is very high, adaptable.
Embodiment three
Fig. 4 is the structural block diagram of a kind of log printing equipment that the embodiment of the present invention three provides, the device can by software and/ Or hardware realization, it can generally be integrated in computer equipment, log printing can be carried out by execution journal Method of printing.Such as figure Shown in 4, which includes:
Log configuration obtains module 401, for passing through call entry component detection to the tune for being directed to destination application When with request, corresponding default log configuration is obtained, wherein the call entry component includes in multiple default journaling agents One;
Object Creation module 402, for creating target journaling or more in local thread according to the default log configuration Literary object, wherein include log list category corresponding with the default log configuration in the target journaling context object Property;
First log information adding module 403, the corresponding log information of the call entry component for will acquire It is added in the target journaling context object according to the log list attribute;
Second log information adding module 404, for detecting the default log interface of destination application calling When, the log information got by the default log interface is added to the target day according to the log list attribute In will context object;
Log print module 405, for passing through when detecting that the calling process for the destination application finishes The call entry component prints the log letter for including in the target journaling context object using default log output interface Breath, to generate journal file.
The log printing equipment provided in the embodiment of the present invention is passing through call entry component detection to for target application When the call request of program, corresponding default log configuration is obtained, target is created in local thread according to default log configuration Log context object, wherein include log list category corresponding with default log configuration in target journaling context object Property, the corresponding log information of the call entry component that will acquire is added to the target journaling or more according to log list attribute In literary object, when detecting that destination application calls default log interface, day for will being got by presetting log interface Will information is added in target journaling context object according to log list attribute, is detecting the tune for destination application When being finished with process, printed in the target journaling context object by call entry component using default log output interface The log information for including, to generate journal file.By using above-mentioned technical proposal, the log towards calling may be implemented and beat Print, and targeted log information acquisition is carried out according to default log configuration, it is by local thread that calling process is corresponding Log information is together in series, and so as to more intuitively check the execution link of application program, and saves memory space.
Optionally, which may also include that
Third log information adding module, for creating mesh in local thread according to the default log configuration described After marking log context object, detecting that the destination application calls the target in the multiple default journaling agent When journaling agent, the log information got from the target journaling Agency is added to institute according to the log list attribute It states in target journaling context object.
Optionally, described that target journaling context object, packet are created in local thread according to the default log configuration It includes:
Log context object is created in local thread, and mould is exported according to the log for including in the default log configuration Plate initializes the list data structure of the log list in the log context object created, obtains on target journaling Hereafter object.
Optionally, log information is added in the target journaling context object according to the log list attribute, Include:
The corresponding character string of log information is carried out according to the log list attribute by the adding method of invocation list Assembling, and be added in the target journaling context object.
Optionally, it is included at least one of the following: in the default log configuration
Object invocation equipment, object invocation application, object invocation class, target calling method, sentence execution information, enter ginseng, Ginseng, time-consuming and layout out.
It is optionally, described to obtain corresponding default log configuration, comprising:
Corresponding default log configuration is obtained from preset configuration center, wherein the default journaling agent and/or default Include preset configuration information in log interface, realizes in the preset configuration center according to the preset configuration information Dynamic configuration presets log configuration accordingly.
Optionally, the default journaling agent includes Dubbo journaling agent, message queue MQ journaling agent, Mybatis days Will agency and Redis journaling agent, the call entry component includes Dubbo journaling agent or MQ journaling agent.
Example IV
The embodiment of the present invention also provides a kind of storage medium comprising computer executable instructions, and the computer is executable Instruction is used for execution journal Method of printing when being executed by computer processor, this method comprises:
, to when the call request for being directed to destination application, corresponding default day is being obtained by call entry component detection Will configuration, wherein the call entry component includes one in multiple default journaling agents;
Target journaling context object is created in local thread according to the default log configuration, wherein the target Include log list attribute corresponding with the default log configuration in log context object;
The corresponding log information of the call entry component that will acquire is added to institute according to the log list attribute It states in target journaling context object;
When detecting that the destination application calls default log interface, will be obtained by the default log interface To log information be added in the target journaling context object according to the log list attribute;
When detecting that the calling process for the destination application finishes, used by the call entry component Default log output interface prints the log information for including in the target journaling context object, to generate journal file.
Storage medium --- any various types of memory devices or storage equipment.Term " storage medium " is intended to wrap It includes: install medium, such as CD-ROM, floppy disk or magnetic tape equipment;Computer system memory or random access memory, such as DRAM, DDRRAM, SRAM, EDORAM, Lan Basi (Rambus) RAM etc.;Nonvolatile memory, such as flash memory, magnetic medium (example Such as hard disk or optical storage);Register or the memory component of other similar types etc..Storage medium can further include other types Memory or combinations thereof.In addition, storage medium can be located at program in the first computer system being wherein performed, or It can be located in different second computer systems, second computer system is connected to the first meter by network (such as internet) Calculation machine system.Second computer system can provide program instruction to the first computer for executing.Term " storage medium " can To include two or more that may reside in different location (such as in the different computer systems by network connection) Storage medium.Storage medium can store the program instruction that can be performed by one or more processors and (such as be implemented as counting Calculation machine program).
Certainly, a kind of storage medium comprising computer executable instructions, computer provided by the embodiment of the present invention The log printing that executable instruction is not limited to the described above, can also be performed log provided by any embodiment of the invention Relevant operation in Method of printing.
Embodiment five
The embodiment of the invention provides a kind of computer equipment, offer of the embodiment of the present invention can be integrated in the computer equipment Log printing equipment.Fig. 5 is a kind of structural block diagram for computer equipment that the embodiment of the present invention five provides.Computer equipment 500 may include: memory 501, processor 502 and be stored in the computer journey that can be run on memory 501 and in processor Sequence, the processor 502 realize log Method of printing as described in the embodiments of the present invention when executing the computer program.
The log printing towards calling may be implemented in computer equipment provided in an embodiment of the present invention, and according to default day Will configuration carries out targeted log information acquisition, and the corresponding log information of calling process is connected by local thread Come, so as to more intuitively check the execution link of application program, and saves memory space.
The executable present invention of log printing equipment, storage medium and the computer equipment provided in above-described embodiment is any Log Method of printing provided by embodiment has and executes the corresponding functional module of this method and beneficial effect.Not in above-mentioned reality The technical detail of detailed description in example is applied, reference can be made to log Method of printing provided by any embodiment of the invention.
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation, It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.

Claims (10)

1. a kind of log Method of printing characterized by comprising
It, to when the call request for being directed to destination application, obtains corresponding default log by call entry component detection and matches It sets, wherein the call entry component includes one in multiple default journaling agents;
Target journaling context object is created in local thread according to the default log configuration, wherein the target journaling Include log list attribute corresponding with the default log configuration in context object;
The corresponding log information of the call entry component that will acquire is added to the mesh according to the log list attribute It marks in log context object;
When detecting that the destination application calls default log interface, by what is got by the default log interface Log information is added in the target journaling context object according to the log list attribute;
When detecting that the calling process for the destination application finishes, used by the call entry component default Log output interface prints the log information for including in the target journaling context object, to generate journal file.
2. the method according to claim 1, wherein being configured according to the default log in local thread described After middle creation target journaling context object, further includes:
It, will be from institute when detecting that the destination application calls the target journaling in the multiple default journaling agent to act on behalf of It states the log information that target journaling Agency gets and is added to the target journaling context according to the log list attribute In object.
3. the method according to claim 1, wherein described configure in local thread according to the default log Create target journaling context object, comprising:
Log context object is created in local thread, according to the log output template pair for including in the default log configuration The list data structure of the log list in log context object created is initialized, and target journaling context is obtained Object.
4. the method according to claim 1, wherein log information is added to according to the log list attribute In the target journaling context object, comprising:
The corresponding character string of log information is assembled according to the log list attribute by the adding method of invocation list, And it is added in the target journaling context object.
5. the method according to claim 1, wherein being included at least one of the following: in the default log configuration
Object invocation equipment, object invocation application, object invocation class, target calling method, sentence execution information, enter ginseng, go out ginseng, Time-consuming and layout.
6. the method according to claim 1, wherein described obtain corresponding default log configuration, comprising:
Corresponding default log configuration is obtained from preset configuration center, wherein the default journaling agent and/or default log Include preset configuration information in interface, is realized in the preset configuration center according to the preset configuration information dynamic Configuration default log configuration accordingly.
7. -6 any method according to claim 1, which is characterized in that the default journaling agent includes Dubbo log Agency, message queue MQ journaling agent, Mybatis journaling agent and Redis journaling agent, the call entry component include Dubbo journaling agent or MQ journaling agent.
8. a kind of log printing equipment characterized by comprising
Log configuration obtains module, for passing through call entry component detection to the call request for being directed to destination application When, obtain corresponding default log configuration, wherein the call entry component includes one in multiple default journaling agents;
Object Creation module, for creating target journaling context object in local thread according to the default log configuration, Wherein, log list attribute corresponding with the default log configuration is included in the target journaling context object;
First log information adding module, the corresponding log information of the call entry component for will acquire is according to described in Log list attribute is added in the target journaling context object;
Second log information adding module, for that will lead to when detecting that the destination application calls default log interface It crosses the log information that the default log interface is got and is added to the target journaling or more according to the log list attribute In literary object;
Log print module, for passing through the tune when detecting that the calling process for the destination application finishes The log information for including in the target journaling context object is printed using default log output interface with intake assembly, with life At journal file.
9. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the program is held by processor The method according to claim 1 to 7 is realized when row.
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, which is characterized in that the processor is realized as described in claim any one of 1-7 when executing the computer program Method.
CN201910671531.6A 2019-07-24 2019-07-24 Log printing method, device, storage medium and equipment Active CN110399107B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910671531.6A CN110399107B (en) 2019-07-24 2019-07-24 Log printing method, device, storage medium and equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910671531.6A CN110399107B (en) 2019-07-24 2019-07-24 Log printing method, device, storage medium and equipment

Publications (2)

Publication Number Publication Date
CN110399107A true CN110399107A (en) 2019-11-01
CN110399107B CN110399107B (en) 2023-08-29

Family

ID=68325025

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910671531.6A Active CN110399107B (en) 2019-07-24 2019-07-24 Log printing method, device, storage medium and equipment

Country Status (1)

Country Link
CN (1) CN110399107B (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112148699A (en) * 2020-09-28 2020-12-29 平安数字信息科技(深圳)有限公司 Log management method, device, equipment and medium
CN113268462A (en) * 2020-02-14 2021-08-17 西安诺瓦星云科技股份有限公司 Log management method, device and system based on embedded equipment
CN113467980A (en) * 2020-03-30 2021-10-01 西安诺瓦星云科技股份有限公司 Log output method, device and system and embedded equipment
CN114398003A (en) * 2021-12-07 2022-04-26 广西北投信创科技投资集团有限公司 Information processing method and device and message server
CN114546793A (en) * 2020-11-24 2022-05-27 腾讯科技(深圳)有限公司 Log generation method and device and computer readable storage medium
CN114661256A (en) * 2022-05-20 2022-06-24 苏州万店掌网络科技有限公司 Data acquisition method, device, equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1785892A2 (en) * 2005-11-01 2007-05-16 Research In Motion Limited System and Method for Collecting and Presenting Records in a Journal on an Electronic Device
JP2012079230A (en) * 2010-10-05 2012-04-19 Hitachi Ltd Print management system and print management method
US20150100835A1 (en) * 2013-10-09 2015-04-09 Fujitsu Limited Log output condition setting method and apparatus
CN106250424A (en) * 2016-07-22 2016-12-21 杭州朗和科技有限公司 The searching method of a kind of daily record context, Apparatus and system
CN108804644A (en) * 2018-06-05 2018-11-13 中国平安人寿保险股份有限公司 Interface log storing method, device, computer equipment and storage medium
CN109376074A (en) * 2018-09-14 2019-02-22 浙江口碑网络技术有限公司 Obtain method and device, the storage medium, electronic device of log
US20190171633A1 (en) * 2017-11-13 2019-06-06 Lendingclub Corporation Multi-system operation audit log

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1785892A2 (en) * 2005-11-01 2007-05-16 Research In Motion Limited System and Method for Collecting and Presenting Records in a Journal on an Electronic Device
JP2012079230A (en) * 2010-10-05 2012-04-19 Hitachi Ltd Print management system and print management method
US20150100835A1 (en) * 2013-10-09 2015-04-09 Fujitsu Limited Log output condition setting method and apparatus
CN106250424A (en) * 2016-07-22 2016-12-21 杭州朗和科技有限公司 The searching method of a kind of daily record context, Apparatus and system
US20190171633A1 (en) * 2017-11-13 2019-06-06 Lendingclub Corporation Multi-system operation audit log
CN108804644A (en) * 2018-06-05 2018-11-13 中国平安人寿保险股份有限公司 Interface log storing method, device, computer equipment and storage medium
CN109376074A (en) * 2018-09-14 2019-02-22 浙江口碑网络技术有限公司 Obtain method and device, the storage medium, electronic device of log

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113268462A (en) * 2020-02-14 2021-08-17 西安诺瓦星云科技股份有限公司 Log management method, device and system based on embedded equipment
CN113268462B (en) * 2020-02-14 2024-05-10 西安诺瓦星云科技股份有限公司 Log management method, device and system based on embedded equipment
CN113467980A (en) * 2020-03-30 2021-10-01 西安诺瓦星云科技股份有限公司 Log output method, device and system and embedded equipment
CN113467980B (en) * 2020-03-30 2024-06-04 西安诺瓦星云科技股份有限公司 Log output method, device and system and embedded equipment
CN112148699A (en) * 2020-09-28 2020-12-29 平安数字信息科技(深圳)有限公司 Log management method, device, equipment and medium
CN112148699B (en) * 2020-09-28 2023-09-05 深圳平安智汇企业信息管理有限公司 Log management method, device, equipment and medium
CN114546793A (en) * 2020-11-24 2022-05-27 腾讯科技(深圳)有限公司 Log generation method and device and computer readable storage medium
CN114398003A (en) * 2021-12-07 2022-04-26 广西北投信创科技投资集团有限公司 Information processing method and device and message server
CN114661256A (en) * 2022-05-20 2022-06-24 苏州万店掌网络科技有限公司 Data acquisition method, device, equipment and storage medium

Also Published As

Publication number Publication date
CN110399107B (en) 2023-08-29

Similar Documents

Publication Publication Date Title
CN110399107A (en) Log Method of printing, device, storage medium and equipment
CN111625452B (en) Flow playback method and system
CN104573115B (en) Support the realization method and system of the integrated interface of multi-type database operation
US6922695B2 (en) System and method for dynamically securing dynamic-multi-sourced persisted EJBS
CN101189595B (en) Solution deployment in a server farm
US20030217308A1 (en) Distributed test harness model
US20050027559A1 (en) Generic framework for applying object-oriented models to multi-tiered enterprise applications
EP1236110B1 (en) A method for isolating a fault from error messages
US20070078943A1 (en) Message based application communication system
WO2008018080A2 (en) Smart integration engine and metadata-oriented architecture for automatic eii and business integration
US10354208B2 (en) System and method for defining run books
CN112313627B (en) Mapping mechanism of event to serverless function workflow instance
CN108255467A (en) The method, apparatus and system of service are performed according to workflow sequence
US7853956B2 (en) Message system and method
US7617462B2 (en) Graphical user interface (GUI) for displaying software component availability as determined by a messaging infrastructure
CN107122203B (en) Configuration file setting method and device
US20050114836A1 (en) Block box testing in multi-tier application environments
US7630988B2 (en) Computer product and session management method
CN111399999B (en) Computer resource processing method, device, readable storage medium and computer equipment
US7243137B2 (en) Remote system controller and data center and methods for implementing the same
CN116701011A (en) Algorithm service dispatching management system based on rule engine
US20070299962A1 (en) Application for testing the availability of software components
CN116627849A (en) System test method, device, equipment and storage medium
CN115994130A (en) Database data migration method and device, computer equipment and storage medium
CN112817922B (en) Log dynamic printing method and device, computer equipment and storage medium

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
GR01 Patent grant
GR01 Patent grant