CN110308880B - Log printing method, system, computer device and computer readable storage medium - Google Patents

Log printing method, system, computer device and computer readable storage medium Download PDF

Info

Publication number
CN110308880B
CN110308880B CN201910418924.6A CN201910418924A CN110308880B CN 110308880 B CN110308880 B CN 110308880B CN 201910418924 A CN201910418924 A CN 201910418924A CN 110308880 B CN110308880 B CN 110308880B
Authority
CN
China
Prior art keywords
log
printing
log printing
configuration file
calling system
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.)
Active
Application number
CN201910418924.6A
Other languages
Chinese (zh)
Other versions
CN110308880A (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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN201910418924.6A priority Critical patent/CN110308880B/en
Publication of CN110308880A publication Critical patent/CN110308880A/en
Application granted granted Critical
Publication of CN110308880B publication Critical patent/CN110308880B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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
    • G06F3/1253Configuration of print job parameters, e.g. using UI at the client
    • 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
    • G06F3/126Job scheduling, e.g. queuing, determine appropriate device
    • 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
    • G06F3/1273Print job history, e.g. logging, accounting, tracking

Abstract

The disclosure relates to the technical field of computers, in particular to a log printing method, which comprises the following steps: responding to a log printing signal triggered by a calling system, and acquiring a log printing configuration file; judging whether a log printing mode is specified in the log printing configuration file or not; and if the log printing mode is determined to be specified in the log printing configuration file, determining a preset interface corresponding to the log printing mode, reading a log printing requirement from the calling system through the preset interface, and printing the log to be printed according to the log printing requirement. The present disclosure also provides a journal printing system, a computer device, and a computer-readable storage medium.

Description

Log printing method, system, computer device and computer readable storage medium
Technical Field
The invention relates to the technical field of computers, in particular to a log printing method, a log printing system, computer equipment and a computer readable storage medium.
Background
Currently, a system calls a third party log jar packet to realize a log printing function. In the prior art, if a caller system needs to use a jar packet of a callee system to implement a journal printing function, at this time, since the caller system itself has called a journal jar packet of a third party, such as logback, to implement a part of journal printing function, and a jar packet in the callee system, which can implement the journal printing function, also implements the journal printing function by calling a journal jar packet of a third party, such as log4j, in the callee system, when the caller system calls a jar packet which can implement the journal printing function, the caller must additionally introduce log4j called by the callee system, so that a conflict is generated between the logback already called by the caller system and log4j called by the callee system.
No corresponding solution exists for the above drawbacks.
Disclosure of Invention
The disclosure aims to provide a log printing method, a log printing system, a computer device and a computer readable storage medium, so as to at least overcome the defect that inter-system jar packet calling conflicts with a log jar packet originally called by a calling party in the prior art.
One aspect of the present disclosure provides a log printing method, including: responding to a log printing signal triggered by a calling system, and acquiring a log printing configuration file; judging whether a log printing mode is specified in the log printing configuration file or not; and if the log printing mode is determined to be specified in the log printing configuration file, determining a preset interface corresponding to the log printing mode, reading a log printing requirement from the calling system through the preset interface, and printing a log to be printed according to the log printing requirement.
According to an embodiment of the present disclosure, the log printing request includes a log printing level, a log printing destination, and a log printing format, and the printing the log to be printed according to the log printing request includes: determining the log to be printed which meets the log printing level; and printing the log to be printed meeting the log printing level to the log printing destination according to the log printing format.
According to an embodiment of the present disclosure, the determining whether the log printing mode is specified in the log printing configuration file includes: acquiring preset configuration information in the log printing configuration file; analyzing whether the preset configuration information is assigned or not; if the preset configuration information is assigned, it indicates that the log printing mode is specified in the log printing configuration file; otherwise, the log printing mode is not specified in the log printing configuration file.
According to an embodiment of the present disclosure, the reading of the log printing requirement from the calling system through the preset interface includes: if the preset configuration information is assigned, determining a class corresponding to the assigned value of the preset configuration information from the calling system through the preset interface; and reading the log printing request from the class.
According to an embodiment of the present disclosure, before the obtaining the log print configuration file in response to the log print signal triggered by the calling system, the method further includes: receiving a connection request sent by the calling system, and acquiring a connection identifier in the connection request; judging whether the calling system has a connection authority or not according to the connection identifier; and if the calling system is judged to have the connection authority, allowing connection.
According to an embodiment of the present disclosure, the method further includes: and if the log printing mode is not specified in the log printing configuration file, printing the log to be printed on a console.
Another aspect of the present disclosure provides a journal printing system including: the acquisition module is used for responding to a log printing signal triggered by the calling system and acquiring a log printing configuration file; the judging module is used for judging whether the log printing mode is specified in the log printing configuration file; and the processing module is used for determining a preset interface corresponding to the log printing mode under the condition that the log printing mode is determined in the log printing configuration file, reading a log printing requirement from the calling system through the preset interface, and printing the log to be printed according to the log printing requirement.
According to an embodiment of the present disclosure, the log printing request includes a log printing level, a log printing destination, and a log printing format, and the processing module, when printing the log to be printed according to the log printing request, includes: a determining unit, configured to determine the log to be printed that satisfies the log printing level; and a printing unit, configured to print the log to be printed that satisfies the log printing level to the log printing destination according to the log printing format.
According to an embodiment of the present disclosure, the determining module includes: the acquisition unit is used for acquiring preset configuration information in the log printing configuration file; the analysis unit is used for analyzing whether the preset configuration information is assigned or not; if the preset configuration information is assigned, it indicates that the log printing mode is specified in the log printing configuration file; otherwise, the log printing mode is not specified in the log printing configuration file.
According to an embodiment of the present disclosure, when the processing module reads a log printing request from the calling system through the preset interface, the processing module includes: the processing unit is used for determining a class corresponding to the value given by the preset configuration information from the calling system through the preset interface under the condition that the preset configuration information is assigned; and a reading unit configured to read the log printing request from the class.
According to an embodiment of the present disclosure, the above system further includes: the receiving module is used for receiving a connection request sent by the calling system and acquiring a connection identifier in the connection request before a log printing configuration file is acquired in response to a log printing signal triggered by the calling system; the analysis module is used for judging whether the calling system has the connection authority or not according to the connection identifier; and the allowing module is used for allowing connection under the condition that the calling system is judged to have the connection authority.
According to an embodiment of the present disclosure, the above system further includes: and the printing module is used for printing the log to be printed on the console under the condition that the log printing mode is not specified in the log printing configuration file.
Yet another aspect of the disclosure provides a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor when executing the computer program being adapted to implement the steps of the method as claimed in any of the above.
Yet another aspect of the disclosure provides a computer readable storage medium having stored thereon a computer program for implementing the steps of the method as claimed in any of the above when executed by a processor.
According to the log printing method, when a log printing signal triggered by a calling system is received, a log printing configuration file can be obtained, whether a log printing mode is specified in the log printing configuration file is judged, if the log printing mode is not specified, a log can be printed on a console according to the log printing function of the system, and if the log printing mode is specified, the log can be printed according to the specified log printing mode, namely, a log printing requirement is read from the calling system through a preset interface corresponding to the log printing mode, and the log is printed according to the log printing requirement. The log printing method based on the log printing requirement comprises the steps that a log is printed on a control console, the log is printed according to the log printing requirement stored in a calling system through a preset interface, and a log jar packet of a third party is not called, namely, the log is not printed according to the printing requirement in the log jar packet of the third party, so that when the log is called by the calling system, the log printing method in the calling system does not conflict with the log printing method in the calling system, namely, when the third log jar packet is used by the calling system to print the log, the log printing method based on the log printing requirement does not conflict with the third log jar packet called by the calling system.
Drawings
FIG. 1 schematically illustrates a flow chart of a method of log printing according to an embodiment of the present disclosure;
FIG. 2 schematically illustrates a block diagram of a journal printing system according to an embodiment of the present disclosure;
FIG. 3 schematically illustrates a block diagram of a journal printing system according to another embodiment of the present disclosure; and
fig. 4 schematically shows a hardware architecture diagram of a computer device adapted to implement the method of journaling printing according to an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the disclosure and are not intended to limit the disclosure. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
According to the log printing method, when a log printing signal triggered by a calling system is received, a log printing configuration file can be obtained, whether a log printing mode is specified in the log printing configuration file is judged, if the log printing mode is not specified, a log can be printed on a console according to the log printing function of the system, and if the log printing mode is specified, the log can be printed according to the specified log printing mode, namely, a log printing requirement is read from the calling system through a preset interface corresponding to the log printing mode, and the log is printed according to the log printing requirement. The log printing method based on the log printing requirement comprises the steps that a log is printed on a control console, the log is printed according to the log printing requirement stored in a calling system through a preset interface, and a log jar packet of a third party is not called, namely, the log is not printed according to the printing requirement in the log jar packet of the third party, so that when the log is called by the calling system, the log printing method in the calling system does not conflict with the log printing method in the calling system, namely, when the third log jar packet is used by the calling system to print the log, the log printing method based on the log printing requirement does not conflict with the third log jar packet called by the calling system.
Example one
Fig. 1 schematically shows a flowchart of a log printing method according to an embodiment of the present disclosure.
As shown in fig. 1, the log printing method according to the first embodiment may include steps S101 to S103, where:
step S101, responding to a log printing signal triggered by a calling system, and acquiring a log printing configuration file.
The system to which the journal printing method of the present disclosure is applied may be referred to as a called system, and the calling system may call a journal printing function of the called system. Before acquiring the log printing configuration file in response to a log printing signal triggered by the calling system, the log printing method may further include: receiving a connection request sent by a calling system, and acquiring a connection identifier in the connection request; judging whether the calling system has a connection authority or not according to the connection identifier; and if the calling system is judged to have the connection authority, allowing connection.
Specifically, when the calling system wants to use the log printing function of the called system, it needs to request connection of the called system first, and the called system can determine whether the calling system has a connection right, for example, obtain a connection identifier in the connection request, determine whether the calling system has a connection right according to the connection identifier, and if the called system determines that the calling system has a connection right, agree with the connection, and further, the calling system can send a log printing configuration file to the called system. When judging whether the calling system has the connection authority according to the connection identifier, whether the connection identifier exists in the white list or not can be analyzed, if the connection identifier exists in the white list, the connection identifier indicates that the calling system has the connection authority, otherwise, the calling system is considered to have no connection authority, wherein the connection identifier can be the system model or the IP address of the calling system.
Step S102, judging whether the log printing configuration file prescribes a log printing mode.
In an embodiment of the present disclosure, determining whether a log printing mode is specified in the log printing configuration file may include: acquiring preset configuration information in a log printing configuration file; analyzing whether preset configuration information is assigned or not; if the preset configuration information is assigned, indicating that a log printing mode is specified in the log printing configuration file; otherwise, the log printing mode is not specified in the log printing configuration file.
Specifically, the log printing configuration file includes preset configuration information, and whether the log printing mode is specified in the log printing configuration file can be determined according to whether the preset configuration information is assigned. For example, if the log print configuration file is printlog.properties and the preset configuration information is log.output.class, when judging whether the log print mode is specified, it may be judged whether log.output.class in the printlog.properties is assigned.
Step S103, if the log printing mode is determined to be specified in the log printing configuration file, determining a preset interface corresponding to the log printing mode, reading a log printing requirement from the calling system through the preset interface, and printing the log to be printed according to the log printing requirement.
The log printing requirements are stored in the calling system, so that when the calling system uses a log printing mode in the called system, the called system can print logs by referring to the log printing requirements specified in the calling system, the log printing requirements in a third-party log jar packet are not referred to as in the prior art, and further, even if the calling system refers to the third-party jar packet, the problem that inter-system jar packet calling in the prior art conflicts with the originally called log jar packet of the calling system can be avoided.
For example, if log.output.class in the log print configuration file printlog.properties is assigned, for example, log.output.class is com.ic.log.sysloger, it indicates that the log print mode is specified in the log print configuration file, and the specified log print mode is com.ic.log.sysloger, and a preset interface such as a log interface corresponding to the print log.properties is determined.
Reading the log printing requirement from the calling system through a preset interface, which may include: if the preset configuration information is assigned, determining a class corresponding to the value assigned to the preset configuration information from the calling system through a preset interface; and reading the log print requirements from the class. Wherein the class corresponding to the value to which the preset configuration information is given may be a class having the same class name as the value to which the preset configuration information is given.
For example, a preset interface on the called system is a java interface, such as a LogInterface, where a printlog method is provided in the interface, before the called system prints a log to be printed, the called system may first read whether a log.output.class in a printlog.properties of a log printing configuration file is assigned, if so, read the value, such as com.p.log.syslog, and at this time, the called system knows that the calling system specifies a log printing mode as a custom interface mode to implement log printing, and then the called system may find a class whose file name is consistent with com.p.log.syslog from the calling system through the LogInterface, then call the class by using java reflection, read a log printing requirement in the class, and print the log to be printed according to the read log printing requirement.
According to an embodiment of the present disclosure, the log printing requirement may include at least one of a log printing level, a log printing destination, and a log printing format. In the case where the log printing request includes a log printing level, a log printing destination, and a log printing format, printing the log to be printed according to the log printing request may include: determining logs to be printed which meet the log printing grade; and printing the logs to be printed meeting the log printing level to a log printing destination according to a log printing format. The log may include the following levels: OFF, FATAL, ERROR, WARN, INFO, DEBUG, ALL, the log format may include: date, time, log level, code location, log content, error code, and the like.
For example, assuming that the log in the business aspect is desired to be printed according to the embodiment of the present disclosure, where the log printing level is TRACE and WARN, the log printing format includes: the log printing destination is a fileapplicator file, logs to be printed with levels of TRACE and WARN can be selected from a plurality of business logs, for example, two logs to be printed are selected, wherein the date of one log to be printed is 2018-05-22, the time is 15:35:53, the log level is TRACE, the log content is [0x00001b10], the date of the other log to be printed is 2018-05-22, the time is 15:39:36, the log level is WARN, and the log content is [0x000029fc ], and the two logs to be printed can be output to the fileapplicator file according to the log printing format.
Example two
In fig. 1, the log printing method of the second embodiment may include step S101, step S102, and step S104, in which:
step S101, responding to a log printing signal triggered by a calling system, and acquiring a log printing configuration file.
The system to which the journal printing method of the present disclosure is applied may be referred to as a called system, and the calling system may call a journal printing function of the called system. Before acquiring the log printing configuration file in response to a log printing signal triggered by the calling system, the log printing method may further include: receiving a connection request sent by a calling system, and acquiring a connection identifier in the connection request; judging whether the calling system has a connection authority or not according to the connection identifier; and if the calling system is judged to have the connection authority, allowing connection.
Specifically, when the calling system wants to use the log printing function of the called system, it needs to request connection of the called system first, and the called system can determine whether the calling system has a connection right, for example, obtain a connection identifier in the connection request, determine whether the calling system has a connection right according to the connection identifier, and if the called system determines that the calling system has a connection right, agree with the connection, and further, the calling system can send a log printing configuration file to the called system. When judging whether the calling system has the connection authority according to the connection identifier, whether the connection identifier exists in the white list or not can be analyzed, if the connection identifier exists in the white list, the connection identifier indicates that the calling system has the connection authority, otherwise, the calling system is considered to have no connection authority, wherein the connection identifier can be the system model or the IP address of the calling system.
Step S102, judging whether the log printing configuration file prescribes a log printing mode.
In an embodiment of the present disclosure, determining whether a log printing mode is specified in the log printing configuration file may include: acquiring preset configuration information in a log printing configuration file; analyzing whether preset configuration information is assigned or not; if the preset configuration information is assigned, indicating that a log printing mode is specified in the log printing configuration file; otherwise, the log printing mode is not specified in the log printing configuration file.
Specifically, the log printing configuration file includes preset configuration information, and whether the log printing mode is specified in the log printing configuration file can be determined according to whether the preset configuration information is assigned. For example, if the log print configuration file is printlog.properties and the preset configuration information is log.output.class, when judging whether the log print mode is specified, it may be judged whether log.output.class in the printlog.properties is assigned.
In step S104, if it is determined that the log print mode is not specified in the log print configuration file, the log to be printed is printed on the console.
If the called system has no requirements on the called system in terms of log printing, any log printing mode can not be specified in the log printing configuration file, so that when the called system finds that the log printing mode is not specified in the log printing configuration file, the log to be printed can be printed according to the log printing function of the system, namely the log to be printed is printed on the console. When the preset configuration information in the log printing configuration file is not assigned, the log printing configuration file indicates that a log printing mode is not specified.
For example, if log.output.class in the log print configuration file printlog.properties is not assigned, for example, if log.output.class, it indicates that the log print configuration file does not specify a log print mode, and further, the embodiment of the present disclosure may print the log to be printed in the console.
According to the log printing method, when a log printing signal triggered by a calling system is received, a log printing configuration file can be obtained, whether a log printing mode is specified in the log printing configuration file is judged, if the log printing mode is not specified, a log can be printed on a console according to the log printing function of the system, and if the log printing mode is specified, the log can be printed according to the specified log printing mode, namely, a log printing requirement is read from the calling system through a preset interface corresponding to the log printing mode, and the log is printed according to the log printing requirement. The log printing method based on the log printing requirement comprises the steps that a log is printed on a control console, the log is printed according to the log printing requirement stored in a calling system through a preset interface, and a log jar packet of a third party is not called, namely, the log is not printed according to the printing requirement in the log jar packet of the third party, so that when the log is called by the calling system, the log printing method in the calling system does not conflict with the log printing method in the calling system, namely, when the third log jar packet is used by the calling system to print the log, the log printing method based on the log printing requirement does not conflict with the third log jar packet called by the calling system.
FIG. 2 schematically illustrates a block diagram of a journal printing system according to an embodiment of the present disclosure.
As shown in fig. 2, a log printing system 200 according to an embodiment may include an obtaining module 210, a determining module 220, and a processing module 230, wherein:
the obtaining module 210 is configured to obtain a log print configuration file in response to a log print signal triggered by a calling system;
the judging module 220 is configured to judge whether a log printing mode is specified in the log printing configuration file; and
the processing module 230 is configured to, when it is determined that the log printing mode is specified in the log printing configuration file, determine a preset interface corresponding to the log printing mode, read a log printing requirement from the calling system through the preset interface, and print a log to be printed according to the log printing requirement.
Fig. 3 schematically illustrates a block diagram of a journal printing system according to another embodiment of the present disclosure.
As shown in fig. 3, the log printing system 300 according to the embodiment may include an obtaining module 210, a determining module 220, and a printing module 310, wherein:
the obtaining module 210 is configured to obtain a log print configuration file in response to a log print signal triggered by a calling system;
the judging module 220 is configured to judge whether a log printing mode is specified in the log printing configuration file; and
the printing module 310 is configured to print the log to be printed on the console if it is determined that the log printing mode is not specified in the log printing configuration file.
According to the log printing system, when a log printing signal triggered by a calling system is received, a log printing configuration file can be obtained, whether a log printing mode is specified in the log printing configuration file is judged, if the log printing mode is not specified, a log can be printed on a console according to the log printing function of the system, and if the log printing mode is specified, the log can be printed according to the specified log printing mode, namely, a log printing requirement is read from the calling system through a preset interface corresponding to the log printing mode, and the log is printed according to the log printing requirement. The log printing method based on the log printing requirement comprises the steps that a log is printed on a control console, the log is printed according to the log printing requirement stored in a calling system through a preset interface, and a log jar packet of a third party is not called, namely, the log is not printed according to the printing requirement in the log jar packet of the third party, so that when the log is called by the calling system, the log printing method in the calling system does not conflict with the log printing method in the calling system, namely, when the third log jar packet is used by the calling system to print the log, the log printing method based on the log printing requirement does not conflict with the third log jar packet called by the calling system.
As an alternative embodiment, the log printing requirement includes a log printing level, a log printing destination and a log printing format, and the processing module, when printing the log to be printed according to the log printing requirement, may include: a determining unit configured to determine a log to be printed that satisfies a log printing level; and the printing unit is used for printing the logs to be printed which meet the log printing level to a log printing destination according to a log printing format.
As an alternative embodiment, the determining module may include: the acquisition unit is used for acquiring preset configuration information in the log printing configuration file; and an analysis unit for analyzing whether the preset configuration information is assigned; if the preset configuration information is assigned, indicating that a log printing mode is specified in the log printing configuration file; otherwise, the log printing mode is not specified in the log printing configuration file.
As an alternative embodiment, when the processing module reads the log printing requirement from the calling system through the preset interface, the processing module may include: the processing unit is used for determining a class corresponding to the value given by the preset configuration information from the calling system through a preset interface under the condition that the preset configuration information is assigned; and a reading unit for reading the log printing request from the class.
As an alternative embodiment, the journal printing system may further include: the receiving module is used for receiving a connection request sent by the calling system and acquiring a connection identifier in the connection request before the log printing configuration file is acquired in response to a log printing signal triggered by the calling system; the analysis module is used for judging whether the calling system has the connection authority or not according to the connection identifier; and the allowing module is used for allowing connection under the condition that the calling system is judged to have the connection authority.
Fig. 4 schematically shows a hardware architecture diagram of a computer device adapted to implement the method of journaling printing according to an embodiment of the present disclosure. In this embodiment, the computer device 400 is a device capable of automatically performing numerical calculation and/or information processing in accordance with a command set in advance or stored. For example, the server may be a smart phone, a tablet computer, a notebook computer, a desktop computer, a rack server, a blade server, a tower server, or a rack server (including an independent server or a server cluster composed of a plurality of servers). As shown in fig. 4, computer device 400 includes at least, but is not limited to: the memory 410, processor 420, and network interface 430 may be communicatively coupled to each other via a system bus. Wherein:
the memory 410 includes at least one type of computer-readable storage medium including a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the storage 410 may be an internal storage module of the computer device 400, such as a hard disk or a memory of the computer device 400. In other embodiments, the memory 410 may also be an external storage device of the computer device 400, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like, provided on the computer device 400. Of course, the memory 410 may also include both internal and external memory modules of the computer device 400. In this embodiment, the memory 410 is generally used for storing an operating system installed in the computer apparatus 400 and various types of application software, such as program codes of a journaling method, and the like. In addition, the memory 410 may also be used to temporarily store various types of data that have been output or are to be output.
Processor 420 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 420 is generally configured to control overall operations of the computer device 400, such as performing control and processing related to data interaction or communication with the computer device 400. In this embodiment, the processor 420 is used to execute program codes stored in the memory 410 or process data.
Network interface 430 may include a wireless network interface or a wired network interface, and network interface 430 is typically used to establish communication connections between computer device 400 and other computer devices. For example, the network interface 430 is used to connect the computer apparatus 400 with an external terminal through a network, establish a data transmission channel and a communication connection between the computer apparatus 400 and the external terminal, and the like. The network may be a wireless or wired network such as an Intranet (Intranet), the Internet (Internet), a Global System of Mobile communication (GSM), Wideband Code Division Multiple Access (WCDMA), a 4G network, a 5G network, Bluetooth (Bluetooth), or Wi-Fi.
It should be noted that fig. 4 only shows a computer device having components 410 and 430, but it should be understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead.
In this embodiment, the log printing method stored in the memory 410 can be further divided into one or more program modules and executed by one or more processors (in this embodiment, the processor 420) to complete the present invention.
The present embodiment also provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the log printing method in the embodiments.
In this embodiment, the computer-readable storage medium includes a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, and the like. In some embodiments, the computer readable storage medium may be an internal storage unit of the computer device, such as a hard disk or a memory of the computer device. In other embodiments, the computer readable storage medium may be an external storage device of the computer device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the computer device. Of course, the computer-readable storage medium may also include both internal and external storage devices of the computer device. In the present embodiment, the computer-readable storage medium is generally used for storing an operating system and various types of application software installed in the computer device, for example, the program codes of the log printing method in the embodiment, and the like. Further, the computer-readable storage medium may also be used to temporarily store various types of data that have been output or are to be output.
It will be apparent to those skilled in the art that the modules or steps of the embodiments of the invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, embodiments of the invention are not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (8)

1. A method of printing a journal, comprising:
responding to a log printing signal triggered by a calling system, and acquiring a log printing configuration file;
judging whether a log printing mode is specified in the log printing configuration file or not; and
if the log printing mode is determined to be specified in the log printing configuration file, determining a preset interface corresponding to the log printing mode, reading a log printing requirement from the calling system through the preset interface, and printing a log to be printed according to the log printing requirement;
the judging whether the log printing mode is specified in the log printing configuration file comprises the following steps:
acquiring preset configuration information in the log printing configuration file; and
analyzing whether the preset configuration information is assigned or not; if the preset configuration information is assigned, the log printing mode is specified in the log printing configuration file; otherwise, the log printing mode is not specified in the log printing configuration file;
the reading of the log printing requirement from the calling system through the preset interface comprises:
if the preset configuration information is assigned, determining a class corresponding to the assigned value of the preset configuration information from the calling system through the preset interface; and
reading the log print requirement from the class.
2. The method according to claim 1, wherein the log printing requirement includes a log printing level, a log printing destination, and a log printing format, and the printing the log to be printed according to the log printing requirement includes:
determining the logs to be printed which meet the log printing level; and
and printing the logs to be printed meeting the log printing level to the log printing destination according to the log printing format.
3. The method of claim 1, wherein prior to said obtaining a log print configuration file in response to invoking a system-triggered log print signal, the method further comprises:
receiving a connection request sent by the calling system, and acquiring a connection identifier in the connection request;
judging whether the calling system has a connection authority or not according to the connection identifier; and
and if the calling system is judged to have the connection authority, allowing connection.
4. The method of claim 1, further comprising:
and if the log printing mode is not specified in the log printing configuration file, printing the log to be printed on a console.
5. A journal printing system, comprising:
the acquisition module is used for responding to a log printing signal triggered by the calling system and acquiring a log printing configuration file;
the judging module is used for judging whether a log printing mode is specified in the log printing configuration file; and
the processing module is used for determining a preset interface corresponding to the log printing mode under the condition that the log printing mode is determined in the log printing configuration file, reading a log printing requirement from the calling system through the preset interface, and printing a log to be printed according to the log printing requirement;
the judging module comprises:
the acquisition unit is used for acquiring preset configuration information in the log printing configuration file; and
the analysis unit is used for analyzing whether the preset configuration information is assigned or not; if the preset configuration information is assigned, indicating that a log printing mode is specified in the log printing configuration file; otherwise, indicating that the log printing configuration file does not specify a log printing mode;
when the processing module reads the log printing requirement from the calling system through the preset interface, the processing module comprises:
the processing unit is used for determining a class corresponding to the value given by the preset configuration information from the calling system through a preset interface under the condition that the preset configuration information is assigned; and
and the reading unit is used for reading the log printing requirement from the class.
6. The system according to claim 5, wherein the log printing requirement includes a log printing level, a log printing destination, and a log printing format, and the processing module, when printing the log to be printed according to the log printing requirement, includes:
a determining unit configured to determine the log to be printed that satisfies the log printing level; and
and the printing unit is used for printing the logs to be printed meeting the log printing level to the log printing destination according to the log printing format.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor is adapted to carry out the steps of the method according to any of claims 1 to 4 when executing the computer program.
8. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, is adapted to carry out the steps of the method of any one of claims 1 to 4.
CN201910418924.6A 2019-05-20 2019-05-20 Log printing method, system, computer device and computer readable storage medium Active CN110308880B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910418924.6A CN110308880B (en) 2019-05-20 2019-05-20 Log printing method, system, computer device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910418924.6A CN110308880B (en) 2019-05-20 2019-05-20 Log printing method, system, computer device and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN110308880A CN110308880A (en) 2019-10-08
CN110308880B true CN110308880B (en) 2022-04-08

Family

ID=68074923

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910418924.6A Active CN110308880B (en) 2019-05-20 2019-05-20 Log printing method, system, computer device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN110308880B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111767261A (en) * 2020-05-29 2020-10-13 广州视源电子科技股份有限公司 Debugging log output method and device, storage medium and electronic equipment
CN112130781A (en) * 2020-09-22 2020-12-25 平安科技(深圳)有限公司 Log printing method and device, electronic equipment and storage medium
CN112148699B (en) * 2020-09-28 2023-09-05 深圳平安智汇企业信息管理有限公司 Log management method, device, equipment and medium
CN112559476B (en) * 2020-12-16 2023-07-21 中国平安人寿保险股份有限公司 Log storage method for improving performance of target system and related equipment thereof

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1455550A (en) * 2002-04-30 2003-11-12 佳能株式会社 Network apparatus management system and its control method
JP2010217957A (en) * 2009-03-13 2010-09-30 Canon Inc Information processor, operation time calculation method and program
JP2014046572A (en) * 2012-08-31 2014-03-17 Brother Ind Ltd Printer and printing system
CN105204789A (en) * 2015-08-24 2015-12-30 北京金山安全软件有限公司 API (application program interface) debugging log printing method and device
CN105260293A (en) * 2015-11-06 2016-01-20 Tcl集团股份有限公司 Output method, output device and terminal equipment of log information
CN105607878A (en) * 2015-11-16 2016-05-25 北京京东尚科信息技术有限公司 Log printing method and device
CN109375884A (en) * 2018-09-03 2019-02-22 中国平安人寿保险股份有限公司 Using log Method of printing, device, computer equipment and storage medium
CN109445721A (en) * 2017-11-06 2019-03-08 贵阳朗玛信息技术股份有限公司 A kind of method and device of canonical log information printing

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8881172B2 (en) * 2008-02-04 2014-11-04 Red Hat, Inc. Configuration interface manager
CN101905578B (en) * 2010-07-19 2012-07-11 山东新北洋信息技术股份有限公司 Printer and control method thereof
CN107678711A (en) * 2017-11-13 2018-02-09 成都创慧科达科技有限公司 A kind of printer sharing print log generates system and method

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1455550A (en) * 2002-04-30 2003-11-12 佳能株式会社 Network apparatus management system and its control method
JP2010217957A (en) * 2009-03-13 2010-09-30 Canon Inc Information processor, operation time calculation method and program
JP2014046572A (en) * 2012-08-31 2014-03-17 Brother Ind Ltd Printer and printing system
CN105204789A (en) * 2015-08-24 2015-12-30 北京金山安全软件有限公司 API (application program interface) debugging log printing method and device
CN105260293A (en) * 2015-11-06 2016-01-20 Tcl集团股份有限公司 Output method, output device and terminal equipment of log information
CN105607878A (en) * 2015-11-16 2016-05-25 北京京东尚科信息技术有限公司 Log printing method and device
CN109445721A (en) * 2017-11-06 2019-03-08 贵阳朗玛信息技术股份有限公司 A kind of method and device of canonical log information printing
CN109375884A (en) * 2018-09-03 2019-02-22 中国平安人寿保险股份有限公司 Using log Method of printing, device, computer equipment and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
一种基于Log4J的日志输出组件的设计;史志英等;《科技广场》;20070901(第07期);第173-175页 *
基于Linux内核的智能日志生成系统;刘洪武等;《计算机工程》;20120920(第18期);第261-263页 *

Also Published As

Publication number Publication date
CN110308880A (en) 2019-10-08

Similar Documents

Publication Publication Date Title
CN110308880B (en) Log printing method, system, computer device and computer readable storage medium
CN107896162B (en) Deployment method and device of monitoring system, computer equipment and storage medium
US11750444B2 (en) Implementation of compliance settings by a mobile device for compliance with a configuration scenario
CN111756674B (en) Network communication method, system, device and computer readable storage medium
CN107682426B (en) Interface proxy method and application server
CN111045921A (en) Automatic interface testing method and device, computer equipment and storage medium
CN111490947A (en) Data packet transmitting method, data packet receiving method, system, device and medium
CN108170551B (en) Crawler system based front-end and back-end error processing method, server and storage medium
CN109558315B (en) Method, device and equipment for determining test range
CN111831365A (en) Interface route forwarding method, system, computer equipment and readable storage medium
Codes Documentation
CN111061448A (en) Log information display method and device, electronic equipment and storage medium
CN108664343B (en) State calling method and device for micro-service
CN114598750A (en) Data request processing method and device and storage medium
CN113645308A (en) Mobile terminal TCP communication, device, equipment and storage medium
CN112350890A (en) Message processing method, device, server and storage medium
CN110866834A (en) Batch processing program execution method and system
CN112416384A (en) Software upgrading method and device and computer equipment
CN108965108B (en) Message pushing method and related equipment
CN111159226A (en) Index query method and system
CN111563038A (en) SDK test method, device, computer equipment and computer readable storage medium
CN110177077B (en) Account system offline processing method, device, equipment and storage medium
CN112417324A (en) Chrome-based URL (Uniform resource locator) interception method and device and computer equipment
CN111178044B (en) Method and device for determining target text elements
CN114610414A (en) Method and device for calling integration interface, 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