CN111881012A - Log recording method, device, equipment and storage medium - Google Patents

Log recording method, device, equipment and storage medium Download PDF

Info

Publication number
CN111881012A
CN111881012A CN202010796954.3A CN202010796954A CN111881012A CN 111881012 A CN111881012 A CN 111881012A CN 202010796954 A CN202010796954 A CN 202010796954A CN 111881012 A CN111881012 A CN 111881012A
Authority
CN
China
Prior art keywords
log
file
machine
information
numerical value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010796954.3A
Other languages
Chinese (zh)
Inventor
潘星
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Dashi Intelligent Technology Co ltd
Original Assignee
Shenzhen Dashi Intelligent 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 Dashi Intelligent Technology Co ltd filed Critical Shenzhen Dashi Intelligent Technology Co ltd
Priority to CN202010796954.3A priority Critical patent/CN111881012A/en
Publication of CN111881012A publication Critical patent/CN111881012A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/34Recording or statistical evaluation of computer activity, e.g. of down time, of input/output operation ; Recording or statistical evaluation of user activity, e.g. usability assessment
    • G06F11/3466Performance evaluation by tracing or monitoring
    • G06F11/3476Data logging
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/13File access structures, e.g. distributed indices
    • G06F16/137Hash-based
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems

Landscapes

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

Abstract

The embodiment of the invention provides a log recording method, a log recording device, log recording equipment and a log recording storage medium, wherein the log recording method comprises the steps of obtaining a log calling instruction, and determining information of a log to be called according to the log calling instruction; searching a numerical value corresponding to the information of the log needing to be called in a preset numerical value library; the value is written to storage. In the invention, the log information is simplified and expressed, the derived simplified log can be restored into a complete log through a tool, the volume of the log is simplified during storage, so that a machine can record more logs, the file writing operation is only performed when the machine is shut down, restarted, abnormal and full of the internal storage cache, the file is not written frequently, and the program performance reaches the best state during use.

Description

Log recording method, device, equipment and storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a log recording method, apparatus, device, and storage medium.
Background
At present, POS terminals are widely used in various industries and play an important role in daily life. In the process of developing the POS terminal program, the log recording is an important function, because some problems of the program can be found through the log, when the problem occurs in the use of a user, the problem can be found through the log, the log is analyzed in real time, the running state of the system can be monitored, the problem can be found and processed early, and return values of key part methods can be recorded.
In the prior art, a log data fragmentation method with segment order preserving hash includes: respectively dividing value ranges of a plurality of attribute fields of the log data into N segments; n is an integer greater than 1; establishing a mapping relation between the N segments corresponding to each attribute field and a hash value according to the sequence of the N segments; the hash values are integers which are arranged continuously, and the arrangement sequence of the hash values is consistent with the sequence of the N segments; and dividing the log data corresponding to each hash value into a storage unit. According to the invention, through the order retention of the hash function, the adjacent log data are ensured to be divided into the adjacent storage units, so that the range query is supported, and the related data can be quickly found.
However, in the market, when saving the log, the whole log file volume is large, and in the process of saving the log, frequent file writing operations are performed, which may result in the performance of the program being damaged.
Disclosure of Invention
In view of the above problems, embodiments of the present invention are proposed to provide a logging method, apparatus, device and storage medium that overcome or at least partially solve the above problems.
In order to solve the above problem, an embodiment of the present invention discloses a log recording method, including:
acquiring a log calling instruction, and determining information of a log to be called according to the log calling instruction;
searching a numerical value corresponding to the information of the log needing to be called in a preset numerical value library;
the value is written to storage.
Preferably, before the step of searching for the numerical value corresponding to the information of the log to be called in the preset numerical value library, the method includes:
acquiring all log information in a source code file, and determining a reduced value corresponding to each piece of log information according to all log information in the source code file;
and establishing the preset numerical value library according to the reduced value.
Preferably, the step of writing the value into the storage further comprises:
judging whether the machine is in a special state;
if the machine is in a special state, writing the numerical value into a file;
and if the machine is not in a special state, writing the numerical value into a memory.
Preferably, the step of determining whether the machine is in a special state includes:
and judging whether the internal memory of the machine is full or whether the machine is in a starting state or whether the machine is in a shutdown state or whether the machine is in an abnormal state.
Preferably, the step of writing the value into a file includes:
the files comprise a first file and a second file;
judging whether the first file is full;
if the first file is not full, writing the numerical value into the first file;
and if the first file is full, writing the value into the second file.
To achieve the above object, the present invention further provides a log recording apparatus, including:
a reading module: the log calling instruction is used for acquiring a log calling instruction, and the information of the log needing to be called is determined according to the log calling instruction;
a searching module: the log calling system is used for searching a numerical value corresponding to the information of the log needing to be called in a preset numerical value library;
a storage module: for writing said value to storage.
Preferably, the searching module includes:
a source code file module: acquiring all log information in a source code file, and determining a reduced value corresponding to each piece of log information according to all log information in the source code file;
a numerical library module: and establishing the preset numerical value library according to the reduced value.
Preferably, the storage module includes:
a judging module: used for judging whether the machine is in a special state;
a file module: for writing said value to a file if said machine is in a special state;
a memory module: and the processor is used for writing the numerical value into the memory if the machine is not in a special state.
The embodiment of the invention includes an electronic device, which includes a processor, a memory and a computer program stored on the memory and capable of running on the processor, wherein the computer program implements the steps of the logging method when executed by the processor.
Embodiments of the present invention include a computer-readable storage medium having stored thereon a computer program, which, when executed by a processor, implements the steps of the above-described logging method.
The method comprises the steps of obtaining a log calling instruction, and determining information of a log to be called according to the log calling instruction; searching a numerical value corresponding to the information of the log needing to be called in a preset numerical value library; the value is written to storage. The method has the advantages that the information of the log is simplified and expressed by the Hash algorithm, the log is small in size during storage, so that the machine can record more logs, the file writing operation is only performed when the machine is shut down, restarted, abnormal and full of the memory cache, the file is not frequently written, and the program performance reaches the best state during use.
Drawings
FIG. 1 is a flow chart of the steps of one embodiment of a method of logging of the present invention;
FIG. 2 is a block diagram of a log recording apparatus according to an embodiment of the present invention;
FIG. 3 is an electronic device implementing the logging method of the present invention;
FIG. 4 schematically illustrates a flow chart of steps of a logging method embodiment of the present application;
FIG. 5 is a flowchart schematically illustrating steps of an embodiment of a log reduction method according to the present application.
Detailed Description
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
One of the core ideas of the embodiment of the invention is that a hash algorithm is used for calculating hash values corresponding to function names and file names in logs, the function names and the file names are replaced by the corresponding hash values in actually output logs, information of the logs is simplified and expressed by the hash algorithm, and the logs are small in size during storage, so that a machine can record more logs, file writing operation is only performed when shutdown, restart, abnormity occurs and the memory cache is full, files cannot be written frequently, and the program performance can reach the best state during use.
Referring to fig. 1, a flowchart illustrating steps of an embodiment of a log recording method according to the present invention is shown, which may specifically include the following steps:
step S100, obtaining a log calling instruction, and determining information needing to call the log according to the log calling instruction;
acquiring all log information in a source code file, and determining a reduced value corresponding to each piece of log information according to all log information in the source code file; and establishing the preset numerical value library according to the reduced value.
S200, searching a numerical value corresponding to the information needing to call the log in a preset numerical value library;
and step S300, writing the numerical value into a storage.
And judging whether the internal memory of the machine is full or whether the machine is in a starting state or whether the machine is in a shutdown state or whether the machine is in an abnormal state.
And if the machine is in a special state, writing the numerical value into a file. The files comprise a first file and a second file; judging whether the first file is full; and if the first file is not full, writing the numerical value into the first file.
And if the first file is full, writing the value into the second file.
Because the versions of the programs installed on the POS terminal machines released in the market are formal versions, the formal versions cannot carry out persistent recording on important logs. When a machine on the market has a problem, the program version is required to be switched into the debugging version, the problem needs to be reproduced, and the problem can be analyzed after corresponding debugging information is printed out, so that the time cost for solving the problem is very huge.
At present, POS terminals are widely used in various industries and play an important role in daily life. In the process of developing the POS terminal program, the log recording is an important function, because some problems of the program can be found through the log, when the problem occurs in the use of a user, the problem can be found through the log, the running state of the system can be monitored through analyzing the log in real time, the problem can be found early, the problem can be processed early, the return value of a key part can be recorded, and the like.
The existing traditional POS terminal log recording step is as follows: combining the file name, function name, line number and debugging information of the executed and output log function into a log line, and storing the log line into a designated log file.
In the existing implementation scheme, module information, function names, file names and other information are recorded into a file, so that a log file contains a large amount of repeated information, and the volume of the whole log file is increased; and frequent file writing operations are performed, which can result in the performance of the program being damaged.
Aiming at the defects, the invention determines the reduced value corresponding to each piece of log information according to all the log information in the preset range; in a specific embodiment of the present application, a hash algorithm is used to calculate hash values of function names and file names corresponding to logs, and a hash comparison table is established.
And acquiring log information, and searching a corresponding numerical value in the preset numerical value library.
In a specific embodiment, the log is saved to a file, the function name of the log and the value of the file name in the hash corresponding table are recorded, the function name and the file name in the actually output log are replaced by corresponding hash values, so that a simplified log can be obtained, the log can be restored to a complete log by using a corresponding tool and the hash corresponding table subsequently, and more log information can be stored when the same file size is achieved. The invention adopts the memory cache mode to reduce the frequency of actual operation files and optimize the performance of the program.
The technical scheme of the invention is to provide a log recording method, which is used for reducing the space of some information which is possibly repeatedly recorded and optimizing frequent file writing operation through a first file, a second file and a memory cache.
It should be noted that, for simplicity of description, the method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the illustrated order of acts, as some steps may occur in other orders or concurrently in accordance with the embodiments of the present invention. Further, those skilled in the art will appreciate that the embodiments described in the specification are presently preferred and that no particular act is required to implement the invention.
Referring to fig. 2, a block diagram of a structure of an embodiment of a logging apparatus of the present invention is shown, which may specifically include the following modules:
the reading module 100: the log calling instruction is used for acquiring a log calling instruction, and the information of the log needing to be called is determined according to the log calling instruction;
the search module 200: the log calling system is used for searching a numerical value corresponding to the information of the log needing to be called in a preset numerical value library;
the storage module 300: for writing said value to storage.
Wherein, the searching module 200 further comprises the following modules:
a source code file module: acquiring all log information in a source code file, and determining a reduced value corresponding to each piece of log information according to all log information in the source code file;
a numerical library module: and establishing the preset numerical value library according to the reduced value.
The storage module 300 further includes the following modules:
a judging module: used for judging whether the machine is in a special state;
a file module: for writing said value to a file if said machine is in a special state;
a memory module: and the processor is used for writing the numerical value into the memory if the machine is not in a special state.
Wherein, the judging module further comprises the following modules:
a special state module: the method is used for judging whether the machine is full of memory or is in a starting state or is in a shutdown state or is in an abnormal state.
Wherein, the file module further comprises the following modules:
the method comprises the following modules: for the files to include a first file and a second file;
a second judging module: the file management system is used for judging whether the first file is full or not;
a first file module: the value is written into the first file if the first file is not full;
a second file module: and the processor is configured to write the value into the second file if the first file is full.
For the device embodiment, since it is basically similar to the method embodiment, the description is simple, and for the relevant points, refer to the partial description of the method embodiment.
Referring to fig. 4, a flowchart illustrating steps of an embodiment of a log recording method according to the present application is shown, which includes the following steps: in a specific embodiment, when a program is compiled, all the places called and saved to the log function in a preset range are searched, the hash values of the file name and the function name where the function is called are calculated to a corresponding table, that is, all log information in a source code file is obtained, a reduced value corresponding to each piece of log information is determined according to all the log information in the preset range, and the preset numerical value library is established according to the reduced values.
When the program actually calls an output log function, the corresponding hash value is searched according to the current file name and function name corresponding table, then the current line number and the information to be actually output are combined to form a line of log, namely, the log information is read, and the value corresponding to the log information is searched in a preset value database.
And (3) writing the re-line into the memory, writing the re-line into a file if the memory is full, writing the re-line into a second file when the file is about to be fully written and the current file is a first file, and performing storage actions when the file is shut down, restarted and abnormal, so that important log information is prevented from being lost. Whether the machine is in a special state is also judged rapidly; if the machine is in a special state, writing the numerical value into a file; and if the machine is not in a special state, writing the numerical value into a memory. Judging whether the first file is full again; if the first file is not full, writing the numerical value into the first file; and if the first file is full, writing the value into the second file.
Referring to fig. 5, a flowchart illustrating steps of an embodiment of a log reduction method according to the present application is shown, which includes the following steps: and opening the file, reading a line, searching the corresponding file name and function name by the hash value in the file, and replacing, wherein the replaced log file is a complete log.
The method comprises the steps of calculating corresponding hash values of function names and file name character strings required in logs by utilizing a hash algorithm, and establishing a function name and file name hash value corresponding table to enable the hash values to form a one-to-one corresponding relation with the file names and the function names. And replacing the function name and the file name character string which are actually stored in the log by using the corresponding hash value to form a simplified log file.
The hash value file name and function name corresponding table is obtained by searching all files in a preset range during program compiling, and for the simplified log, only the hash value in the log needs to be replaced by the corresponding function name and file name, so that the log can be restored to be a complete log.
In the prior art, information such as module information, function names and the like is recorded in files, so that a log file contains a large amount of repeated data with large occupied space, the volume of the whole log file is large, and the performance is damaged due to frequent file operation. In the solution, repeated information is simplified and expressed, and the derived simplified log can be restored to a complete log through a tool, so that more logs can be recorded in a small volume, and the file writing operation is only performed when the device is shut down, restarted, abnormal and full of the memory cache, so that files cannot be written frequently, and the program performance reaches the optimal state when the device is used.
Referring to fig. 3, a computer device of a logging method of the present invention is shown, which may specifically include the following:
in an embodiment of the present invention, the present invention further provides a computer device, where the computer device 12 is represented in a general computing device, and the components of the computer device 12 may include but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus 18 structures, including a memory bus 18 or memory controller, a peripheral bus 18, an accelerated graphics port, and a processor or local bus 18 using any of a variety of bus 18 architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus 18, micro-channel architecture (MAC) bus 18, enhanced ISA bus 18, audio Video Electronics Standards Association (VESA) local bus 18, and Peripheral Component Interconnect (PCI) bus 18.
Computer device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by computer device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)31 and/or cache memory 32. Computer device 12 may further include other removable and non-removable, volatile and non-volatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (commonly referred to as "hard drives"). Although not shown in FIG. 3, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. The memory may include at least one program product having a set (e.g., at least one) of program modules 42, with the program modules 42 configured to carry out the functions of embodiments of the invention.
Programs and utilities 41, having a set (at least one) of program modules 42, may be stored for example in memory, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules 42, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of the described embodiments of the invention.
Computer device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, camera, etc.), with one or more devices that enable a user to interact with computer device 12, and/or with any devices (e.g., network card, modem, etc.) that enable computer device 12 to communicate with one or more other computing devices. Such communication may be through input and output (I and O) interfaces 22. Also, computer device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN)), a Wide Area Network (WAN), and/or a public network (e.g., the Internet) via network adapter 20. As shown, the network adapter 21 communicates with the other modules of the computer device 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with computer device 12, including but not limited to: microcode, device drivers, redundant processing units 16, external disk drive arrays, RAID systems, tape drives, and data backup storage systems 34, etc.
The processing unit 16 executes various functional applications and data processing, such as implementing a logging method provided by an embodiment of the present invention, by executing programs stored in the system memory 28.
That is, the processing unit 16 implements, when executing the program: reading log information, and searching a numerical value corresponding to the log information in a preset numerical value library; judging whether the machine is in a special state; if the machine is in a special state, writing the numerical value into a file; and if the machine is not in a special state, writing the numerical value into a memory.
In an embodiment of the present invention, the present invention further provides a computer-readable storage medium, on which a computer program is stored, which when executed by a processor, implements the logging method as provided in all embodiments within the preset scope of the present application.
That is, the program when executed by the processor implements: reading log information, and searching a numerical value corresponding to the log information in a preset numerical value library; judging whether the machine is in a special state; if the machine is in a special state, writing the numerical value into a file; and if the machine is not in a special state, writing the numerical value into a memory.
Any combination of one or more computer-readable media may be employed. The computer readable medium may be a computer-readable storage medium or a computer-readable signal medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPOM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Computer program code for carrying out operations for aspects of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The embodiments in the present specification are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, apparatus, or computer program product. Accordingly, embodiments of the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, embodiments of the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
Embodiments of the present invention are described with reference to flowchart illustrations and/or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing terminal to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing terminal to cause a series of operational steps to be performed on the computer or other programmable terminal to produce a computer implemented process such that the instructions which execute on the computer or other programmable terminal provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
While preferred embodiments of the present invention have been described, additional variations and modifications of these embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including the preferred embodiment and all changes and modifications that fall within the true intended scope of the embodiments of the invention.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or terminal. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or terminal that comprises the element.
The above detailed description is provided for the logging method provided by the present invention, and the principle and the implementation of the present invention are explained by applying specific examples, and the description of the above examples is only used to help understanding the method and the core idea of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present invention.

Claims (10)

1. A logging method for machine logging at a POS terminal, comprising:
acquiring a log calling instruction, and determining information of a log to be called according to the log calling instruction;
searching a numerical value corresponding to the information of the log needing to be called in a preset numerical value library;
the value is written to storage.
2. The log recording method according to claim 1, wherein before the step of searching the preset value library for the value corresponding to the information of the log to be called, the method comprises:
acquiring all log information in a source code file, and determining a reduced value corresponding to each piece of log information according to all log information in the source code file;
and establishing the preset numerical value library according to the reduced value.
3. The logging method of claim 1, wherein said step of writing said value to storage further comprises:
judging whether the machine is in a special state;
if the machine is in a special state, writing the numerical value into a file;
and if the machine is not in a special state, writing the numerical value into a memory.
4. The logging method of claim 3, wherein said step of determining whether the machine is in a special state comprises:
and judging whether the internal memory of the machine is full or whether the machine is in a starting state or whether the machine is in a shutdown state or whether the machine is in an abnormal state.
5. The logging method of claim 3, wherein said step of writing said value to a file comprises:
the files comprise a first file and a second file;
judging whether the first file is full;
if the first file is not full, writing the numerical value into the first file;
and if the first file is full, writing the value into the second file.
6. A logging apparatus, comprising:
a reading module: the log calling instruction is used for acquiring a log calling instruction, and the information of the log needing to be called is determined according to the log calling instruction;
a searching module: the log calling system is used for searching a numerical value corresponding to the information of the log needing to be called in a preset numerical value library;
a storage module: for writing said value to storage.
7. The logging apparatus of claim 6, wherein said lookup module comprises:
a source code file module: acquiring all log information in a source code file, and determining a reduced value corresponding to each piece of log information according to all log information in the source code file;
a numerical library module: and establishing the preset numerical value library according to the reduced value.
8. The logging device of claim 6, wherein said storage module comprises:
a judging module: used for judging whether the machine is in a special state;
a file module: for writing said value to a file if said machine is in a special state;
a memory module: and the processor is used for writing the numerical value into the memory if the machine is not in a special state.
9. Electronic device, characterized in that it comprises a processor, a memory and a computer program stored on said memory and capable of running on said processor, said computer program, when executed by said processor, implementing the steps of the logging method according to any of claims 1 to 5.
10. Computer readable storage medium, characterized in that a computer program is stored on the computer readable storage medium, which computer program, when being executed by a processor, realizes the steps of the logging method as claimed in any of the claims 1 to 5.
CN202010796954.3A 2020-08-10 2020-08-10 Log recording method, device, equipment and storage medium Pending CN111881012A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010796954.3A CN111881012A (en) 2020-08-10 2020-08-10 Log recording method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010796954.3A CN111881012A (en) 2020-08-10 2020-08-10 Log recording method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111881012A true CN111881012A (en) 2020-11-03

Family

ID=73211342

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010796954.3A Pending CN111881012A (en) 2020-08-10 2020-08-10 Log recording method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111881012A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559478A (en) * 2020-12-22 2021-03-26 上海金卓科技有限公司 Log generation method and device, terminal equipment and storage medium
CN113283884A (en) * 2020-12-31 2021-08-20 深圳怡化电脑股份有限公司 Log processing method and device
CN113391942A (en) * 2021-06-18 2021-09-14 华云数据控股集团有限公司 Shell script log printing method and device, electronic equipment and storage medium
CN113535654A (en) * 2021-06-11 2021-10-22 安徽安恒数智信息技术有限公司 Log processing method, system, electronic device and storage medium
CN113687973A (en) * 2021-08-30 2021-11-23 浪潮卓数大数据产业发展有限公司 Method, device and medium for controlling dynamic output of logs
CN113704557A (en) * 2021-08-31 2021-11-26 平安普惠企业管理有限公司 Front-end resource package compression method and device, electronic equipment and storage medium
CN113900903A (en) * 2021-10-27 2022-01-07 深圳星火半导体科技有限公司 Log storage device, log retrieving method and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1320253A (en) * 1998-09-30 2001-10-31 国际商业机器公司 Verifiable electronic journal for point of sale device and methods for using the same
CN106648467A (en) * 2016-12-28 2017-05-10 税友软件集团股份有限公司 Log generation method and system
CN106682162A (en) * 2016-12-26 2017-05-17 浙江宇视科技有限公司 Log management method and device
CN108958652A (en) * 2018-06-25 2018-12-07 郑州云海信息技术有限公司 A kind of method, apparatus and computer readable storage medium of record log information
CN109767516A (en) * 2018-12-14 2019-05-17 北京摩拜科技有限公司 Log setting and Method of printing, setting and printing device and log system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1320253A (en) * 1998-09-30 2001-10-31 国际商业机器公司 Verifiable electronic journal for point of sale device and methods for using the same
CN106682162A (en) * 2016-12-26 2017-05-17 浙江宇视科技有限公司 Log management method and device
CN106648467A (en) * 2016-12-28 2017-05-10 税友软件集团股份有限公司 Log generation method and system
CN108958652A (en) * 2018-06-25 2018-12-07 郑州云海信息技术有限公司 A kind of method, apparatus and computer readable storage medium of record log information
CN109767516A (en) * 2018-12-14 2019-05-17 北京摩拜科技有限公司 Log setting and Method of printing, setting and printing device and log system

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559478A (en) * 2020-12-22 2021-03-26 上海金卓科技有限公司 Log generation method and device, terminal equipment and storage medium
CN112559478B (en) * 2020-12-22 2024-05-14 神经元信息技术(成都)有限公司 Log generation method and device, terminal equipment and storage medium
CN113283884A (en) * 2020-12-31 2021-08-20 深圳怡化电脑股份有限公司 Log processing method and device
CN113535654A (en) * 2021-06-11 2021-10-22 安徽安恒数智信息技术有限公司 Log processing method, system, electronic device and storage medium
CN113535654B (en) * 2021-06-11 2023-10-31 安徽安恒数智信息技术有限公司 Log processing method, system, electronic device and storage medium
CN113391942A (en) * 2021-06-18 2021-09-14 华云数据控股集团有限公司 Shell script log printing method and device, electronic equipment and storage medium
CN113687973A (en) * 2021-08-30 2021-11-23 浪潮卓数大数据产业发展有限公司 Method, device and medium for controlling dynamic output of logs
CN113704557A (en) * 2021-08-31 2021-11-26 平安普惠企业管理有限公司 Front-end resource package compression method and device, electronic equipment and storage medium
CN113900903A (en) * 2021-10-27 2022-01-07 深圳星火半导体科技有限公司 Log storage device, log retrieving method and storage medium
CN113900903B (en) * 2021-10-27 2023-06-16 深圳星火半导体科技有限公司 Log storage device, log capturing method and storage medium

Similar Documents

Publication Publication Date Title
CN111881012A (en) Log recording method, device, equipment and storage medium
US8832125B2 (en) Extensible event-driven log analysis framework
US10191838B2 (en) Method and device for checking influence of deleting cache file, and mobile terminal
KR20110060822A (en) Memory optimization of virtual machine code by partitioning extraneous information
US9134975B1 (en) Determining which computer programs are candidates to be recompiled after application of updates to a compiler
US20190080016A1 (en) Systems and methods for updating data pipelines
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
CN111124872A (en) Branch detection method and device based on difference code analysis and storage medium
CN112631621A (en) Dependency package management method, device, server and storage medium
CN107729541A (en) A kind of data processing method, device and computer-readable recording medium
CN110765069A (en) Data migration method, device and system
US20130275954A1 (en) Inter-procedural unreachable code elimination with use graph
CN114003269A (en) Component processing method and device, electronic equipment and storage medium
CN116661758B (en) Method, device, electronic equipment and medium for optimizing log framework configuration
US9009430B2 (en) Restoration of data from a backup storage volume
CN112231232A (en) Method, device and equipment for determining test data model and generating test data
CN116610636A (en) Data processing method and device of file system, electronic equipment and storage medium
WO2023086158A1 (en) System and method for identifying performance bottlenecks
CN113655960B (en) CD readability restoration method and computing device
CN116069650A (en) Method and device for generating test cases
CN113326063B (en) Data processing method, electronic device and storage medium
CN111221817B (en) Service information data storage method, device, computer equipment and storage medium
US20150006578A1 (en) Dynamic search system
CN112486517B (en) Application program installation method and system, electronic equipment and storage medium
CN112506651B (en) Method and equipment for data operation in large-data-volume environment

Legal Events

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

Application publication date: 20201103

RJ01 Rejection of invention patent application after publication