A method of logging, a logger, and a storage medium
By mapping the hierarchical relationship of the logging platform to nodes and organizing them into a hierarchical structure, and using tags to record log information, the problem of difficulty in quickly locating problematic logs in existing technologies is solved, thus improving the efficiency of log investigation.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-23
- Publication Date
- 2026-03-17
AI Technical Summary
Existing logging platforms struggle to quickly pinpoint problems when they occur, increasing the time and cost of troubleshooting.
The hierarchical relationship of the objects to be processed is mapped to nodes, and the nodes are organized into a hierarchical structure for storage. The log information of each node is recorded using tags. Content exceeding the log threshold is written to a separate table, stored in an asynchronous queue in a thread pool, and serialized to the database.
It enables quick location of problem logs, improving the efficiency of problem investigation and saving investigation time.
Smart Images

Figure CN114996095B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of log data processing technology, and in particular to a log recording method, log recorder, and storage medium. Background Technology
[0002] Logs are data generated by IT systems that record the operational status of devices, operating systems, and application software. They are crucial for IT operations and maintenance personnel and security managers in their daily troubleshooting, attack analysis, and attribution. Log data is ubiquitous, constantly reflecting the true internal state of information systems.
[0003] Existing logging platforms such as Monitor and ELK use a distributed asynchronous logging method to record and display logs. However, this distributed asynchronous logging method makes it difficult to quickly locate the problem when a system malfunctions, thus increasing the time cost of troubleshooting. Summary of the Invention
[0004] This invention provides a log recording method, log recorder, and storage medium for storing log information of each layer in an object to be processed in a hierarchical manner. This allows for quick location of the problem log when a problem occurs in the object to be processed, thereby improving the efficiency of troubleshooting.
[0005] The first aspect of this application provides a method for logging, including:
[0006] Extract the hierarchical relationships from the objects to be processed;
[0007] Map each level in the hierarchical relationship to a node;
[0008] Based on the hierarchical relationship, the nodes are organized into a hierarchical structure for storage;
[0009] The log information of each node in the hierarchical structure is recorded using corresponding tags.
[0010] Preferably, the structure of the label includes at least one of the following: business identifier, business value, font style, and label type.
[0011] Preferably, the font style is used to distinguish between normal logs and abnormal logs, and the tag type is used to identify whether the log information of each node exceeds a preset log threshold. If it exceeds the log threshold, the tag type is identified as a first tag; if it does not exceed the log threshold, the tag type is identified as a second tag.
[0012] Preferably, when the log information of a node exceeds the log threshold, the log content exceeding the log threshold is written to a partitioned table, and the identifier of the partitioned table is written to the log information of the node.
[0013] Preferably, the method further includes:
[0014] Log information and / or table content of each node in the hierarchical structure are stored in a thread pool in the form of an asynchronous queue;
[0015] Write the log information and / or table contents of each node in the thread pool to the database.
[0016] Preferably, after storing the log information and / or table contents of each node in the hierarchical structure to a thread pool in the form of an asynchronous queue, the method further includes:
[0017] Based on the hierarchical structure, the log information and / or table content of each node in the thread pool are serialized;
[0018] Write the log information and / or table contents of each node in the thread pool to the database, including:
[0019] Write the serialized log information and / or table contents of each node in the thread pool into the database.
[0020] Preferably, the method further includes:
[0021] When displaying the log information, the log information and / or table content of each node are deserialized into a hierarchical structure for display.
[0022] The content of each node's sub-table is displayed separately.
[0023] A second aspect of this application provides a log recorder, including:
[0024] Extraction unit, used to extract hierarchical relationships from objects to be processed;
[0025] A mapping unit is used to map each level in the hierarchical relationship to a node;
[0026] The sorting unit is used to sort the nodes into a hierarchical structure for storage according to the hierarchical relationship;
[0027] The recording unit is used to record the log information of each node in the hierarchical structure using corresponding tags.
[0028] Preferably, the structure of the label includes at least one of the following: business identifier, business value, font style, and label type.
[0029] Preferably, the font style is used to distinguish between normal logs and abnormal logs, and the tag type is used to identify whether the log information of each node exceeds a preset log threshold. If it exceeds the log threshold, the tag type is identified as a first tag; if it does not exceed the log threshold, the tag type is identified as a second tag.
[0030] Preferably, the recording unit is further used for:
[0031] When a node's log information exceeds the log threshold, the log content exceeding the threshold is written to a partitioned table, and the partitioned table's identifier is written to the node's log information.
[0032] Preferably, the recording unit is further used for:
[0033] Log information and / or table content of each node in the hierarchical structure are stored in a thread pool in the form of an asynchronous queue;
[0034] Write the log information and / or table contents of each node in the thread pool to the database.
[0035] Preferably, the recording unit is further used for:
[0036] After storing the log information and / or table content of each node in the hierarchical structure into the thread pool in the form of an asynchronous queue, the log information and / or table content of each node in the thread pool are serialized according to the hierarchical structure.
[0037] Write the serialized log information and / or table contents of each node in the thread pool into the database.
[0038] Preferably, the logger also includes:
[0039] The display unit is used to deserialize the log information and / or table content of each node into a hierarchical structure for display when displaying the log information;
[0040] The content of each node's sub-table is displayed separately.
[0041] A third aspect of this application provides a computer device including a processor and a memory, wherein the processor, when executing a computer program stored in the memory, is used to implement the logging method described in the first aspect of this application.
[0042] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is used to implement the log recording method described in the first aspect of this application.
[0043] The fifth aspect of this application provides a computer program product having a computer program stored thereon. When the computer program is executed by a computer device, it is used to implement the log recording method described in the first aspect of this application.
[0044] As can be seen from the above technical solutions, the embodiments of the present invention have the following advantages:
[0045] In this embodiment, the hierarchical relationship is extracted from the object to be processed; each level in the hierarchical relationship is mapped to a node; the nodes are organized into a hierarchical structure for storage according to the hierarchical relationship; and the log information of each node in the hierarchical structure is recorded using labels.
[0046] In this embodiment, nodes are organized into a hierarchical structure for storage, and labels are used to record the log information of each node in the hierarchical structure. This allows the log information of each node to be stored and displayed in a hierarchical structure. As a result, when a problem occurs in a node of the object to be processed, the problem log of the problem node can be quickly located, thereby saving the time for troubleshooting and improving the efficiency of troubleshooting. Attached Figure Description
[0047] Figure 1 This is a schematic diagram of one embodiment of the log recording method in this application;
[0048] Figure 2 This is a schematic diagram of the hierarchical relationship in the attendance system of this application embodiment;
[0049] Figure 3 This is a schematic diagram of the hierarchical relationship in the embodiments of this application;
[0050] Figure 4 This is a schematic diagram of another embodiment of the log recording method in this application;
[0051] Figure 5 This is a schematic diagram of another embodiment of the log recording method in this application;
[0052] Figure 6 This is a schematic diagram of one embodiment of the log recorder in this application. Detailed Implementation
[0053] This invention provides a log recording method, log recorder, and storage medium for storing log information of each layer in an object to be processed in a hierarchical manner. This allows for quick location of the problem log when a problem occurs in the object to be processed, thereby improving the efficiency of troubleshooting.
[0054] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0055] The terms "first," "second," "third," "fourth," etc., used in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0056] For ease of understanding, the log recording method in the embodiments of this application is described below. Please refer to [link / reference]. Figure 1 , Figure 1 This is a schematic diagram of one embodiment of the log recording method in this application:
[0057] 101. Extract the hierarchical relationship from the objects to be processed;
[0058] Specifically, the object to be processed in this application embodiment can be any data processing system. The data processing system can be an Enterprise Resource Planning (ERP) system, including but not limited to a production management system, supply chain system, human resources system, financial system, tax system, audit system, and IT management system. In this system, there are generally different hierarchical relationships.
[0059] To facilitate understanding, the following explanation uses an attendance system (which could be the attendance module within a human resources system) as an example to illustrate the hierarchical relationships within an attendance system. Figure 2 In the system, the attendance management system includes attendance calculation reports (first level), and under the attendance calculation reports are parameter initialization (second level), and under the parameter initialization are valid cards, attendance item definitions, document time period information, shift schedule, rounding rules (third level), etc.
[0060] Within each layer, there are related logs that record basic information about that layer.
[0061] 102. Map each level in the hierarchical relationship to a node;
[0062] In order to display the log information of each layer in a hierarchical manner, each layer in the hierarchical relationship is mapped to a node in this embodiment of the application. For example, the attendance calculation report is mapped to the root node, while the parameter initialization is mapped to the child node of the root node. The valid card, attendance item definition, document time period information, shift schedule, and rounding rule layer are respectively mapped to the lower-level nodes of the child nodes.
[0063] 103. Based on the hierarchical relationship, organize the nodes into a hierarchical structure for storage;
[0064] After mapping each level in the hierarchical relationship to a node, the nodes are further organized into a hierarchical structure for storage, such as a tree structure, for ease of understanding. Figure 3 A schematic diagram of the hierarchical structure is provided.
[0065] 104. Use tags to record the log information of each node in the hierarchical structure.
[0066] After obtaining the hierarchical relationship of each node, the log information of each node in the hierarchical structure is further recorded using labels. In this way, the log information of each layer is stored and displayed in a hierarchical structure. As a result, when a problem occurs in a node in the system, the problem log of the problematic node can be quickly located, thereby saving troubleshooting time and improving troubleshooting efficiency.
[0067] In this embodiment, the hierarchical relationship is extracted from the object to be processed; each level in the hierarchical relationship is mapped to a node; the nodes are organized into a hierarchical structure for storage according to the hierarchical relationship; and the log information of each node in the hierarchical structure is recorded using labels.
[0068] In this embodiment, nodes are organized into a hierarchical structure for storage, and labels are used to record the log information of each node in the hierarchical structure. This allows the log information of each node to be stored and displayed in a hierarchical structure. As a result, when a problem occurs in a node of the object to be processed, the problem log of the problem node can be quickly located, thereby saving the time for troubleshooting and improving the efficiency of troubleshooting.
[0069] based on Figure 1 The embodiments described above will be further described below. Figure 1 The logging method described in the embodiments is as follows; please refer to [link / reference]. Figure 4 , Figure 4 This is a schematic diagram of another embodiment of the log recording method in this application:
[0070] 401. Determine whether the node's log information exceeds the preset log threshold. If yes, proceed to step 402; otherwise, proceed to step 403.
[0071] Specifically, when using tags to record log information, the tag structure includes at least one of the following: business identifier, business value, font sample, and tag type.
[0072] Specifically, the business identifier is the identification code of the business, such as xxx1 representing parameter initialization in the attendance management system, while the business value represents the specific value, such as the reference initial value of 629ms, and the font style represents the specific style of the displayed font, such as the font color, font size, and font type. In this embodiment, the label type is mainly used to identify whether the log information in the label exceeds the preset log threshold. For example, when the log threshold is exceeded, the label type is set to the first label, and when the log information does not exceed the log threshold, the label type is set to the second label. The first label can be 1, and the second label can be 0, as long as it can distinguish whether the log exceeds the log threshold.
[0073] In addition, the font style in this application embodiment is also used to identify normal logs and abnormal logs. For example, when the log is normal, it is displayed in black font, and when the log is abnormal, it is displayed in red font, so that abnormal logs can be quickly located by using the font style.
[0074] 402. Write logs exceeding the log threshold to the partitioned table and write the partitioned table's identifier to the node's log information.
[0075] Specifically, when the log information of a node exceeds the log threshold, the logs exceeding the log threshold are written to another sub-table, and the identifier of the sub-table is written to the log information of the current node. For example, when the log information of parameter initialization in the attendance system exceeds the log threshold, the logs exceeding the log threshold are written to another sub-table, and the identifier of the sub-table is further written to the log information of the parameter initialization node.
[0076] 403. Record the corresponding log information in the node's log information.
[0077] When the log information of a node does not exceed the log threshold, all the log information of that node will be recorded in the log information of that node. For example, if the log information of a valid card in the attendance system does not exceed the log threshold, then all the log information of the valid card will be recorded in the log information of the valid card.
[0078] In this embodiment of the application, when the log information of a node exceeds a preset log threshold, the log content exceeding the log threshold is written into a separate table, that is, the log information of the node is recorded separately in the form of a separate table, thereby meeting the log recording size requirements in various scenarios.
[0079] The logging method in the embodiments of this application is described below. Please refer to [link / reference]. Figure 5 , Figure 5 This is a schematic diagram of another embodiment of the log recording method in this application:
[0080] 501. Extract the hierarchical relationship from the objects to be processed;
[0081] 502. Map each level in the hierarchical relationship to a node;
[0082] 503. Based on the hierarchical relationship, organize the nodes into a hierarchical structure for storage;
[0083] 504. Use tags to record the log information of each node in the hierarchical structure;
[0084] Specifically, the descriptions of steps 501 to 504 in the embodiments of this application are consistent with... Figure 1 The descriptions of steps 101 to 104 in the embodiments are similar and will not be repeated here.
[0085] 505. Determine whether the node's log information exceeds the preset log threshold. If yes, proceed to step 506; otherwise, proceed to step 507.
[0086] 506. Write logs exceeding the log threshold to a partitioned table, and write the partitioned table's identifier to the node's log information;
[0087] 507. Record the corresponding log information in the node's log information;
[0088] Specifically, the descriptions of steps 505 to 507 in the embodiments of this application are consistent with... Figure 4 The description types of steps 401 to 403 in the embodiments will not be repeated here.
[0089] 508. Store the log information and / or table contents of each node in the hierarchical structure into a thread pool in the form of an asynchronous queue;
[0090] Specifically, in the object to be processed (such as any data processing system), after recording the corresponding log information in the node's log information, in order not to affect other business processing of the object to be processed (such as any data processing system), this application embodiment stores the log information and / or table content of each node in the hierarchical structure in a thread pool in the form of an asynchronous queue.
[0091] If a node in the pending object receives a business access request, it can first return a business response to the user based on the business access request, and then store the node's log information and / or table content in the thread pool in an asynchronous queue, so as not to affect the user's business access request.
[0092] 509. Based on the hierarchical structure, serialize the log information and / or table content of each node in the thread pool;
[0093] Furthermore, after storing the log information and / or table content of each node into the thread pool, it is also necessary to write the log information and / or table content in the thread pool into the database for storage. In order to achieve structured storage of the log information and / or table content of each node, this embodiment of the application serializes the log information and / or table content of each node in the thread pool according to the hierarchical structure, such as serializing the log information and / or table content of each node into a JSON string, and then further executes step 510.
[0094] 510. Write the serialized log information and / or table contents of each node in the thread pool into the database;
[0095] After serializing the log information and / or table content of each node in the thread pool, the serialized log information and / or table content of each node are written into the database to achieve structured storage of data in the database.
[0096] 511. When displaying the log information, the log information and / or table content of each node are deserialized into a hierarchical structure for display, and the table content of each node is displayed separately.
[0097] Furthermore, when log information needs to be displayed, such as when a user's log viewing request is received, the log information and / or table content of each node are deserialized into a hierarchical structure for display, thereby realizing the hierarchical display of the log information and / or table content of each node.
[0098] Specifically, when displaying the table content of each node, the table content can also be displayed separately in a pop-up window, thereby improving the efficiency and performance of the current node's log display.
[0099] In this embodiment, on the one hand, the log information and / or table content of each node in the hierarchical structure are stored in the thread pool in the form of an asynchronous queue, so that the storage of log information and the front-end business do not affect each other. On the other hand, log content exceeding the node log threshold can be displayed separately in the form of a table, thereby improving the efficiency and performance of node log display.
[0100] The logging method in the embodiments of this application has been described above. The logger in the embodiments of this application will be described below. Please refer to [link / reference]. Figure 6 One embodiment of the log recorder in this application includes:
[0101] Extraction unit 601 is used to extract hierarchical relationships from objects to be processed;
[0102] Mapping unit 602 is used to map each level in the hierarchical relationship to a node;
[0103] The organizing unit 603 is used to organize the nodes into a hierarchical structure for storage according to the hierarchical relationship;
[0104] The recording unit 604 is used to record the log information of each node in the hierarchical structure using tags.
[0105] Preferably, the structure of the label includes at least one of the following: business identifier, business value, font style, and label type.
[0106] Preferably, the font style is used to distinguish between normal logs and abnormal logs, and the tag type is used to identify whether the log information of each node exceeds a preset log threshold. If it exceeds the log threshold, the tag type is identified as a first tag; if it does not exceed the log threshold, the tag type is identified as a second tag.
[0107] Preferably, the recording unit 604 is further configured to:
[0108] When a node's log information exceeds the log threshold, the log content exceeding the threshold is written to a partitioned table, and the partitioned table's identifier is written to the node's log information.
[0109] Preferably, the recording unit 604 is further configured to:
[0110] Log information and / or table content of each node in the hierarchical structure are stored in a thread pool in the form of an asynchronous queue;
[0111] Write the log information and / or table contents of each node in the thread pool to the database.
[0112] Preferably, the recording unit 604 is further configured to:
[0113] After storing the log information and / or table content of each node in the hierarchical structure into the thread pool in the form of an asynchronous queue, the log information and / or table content of each node in the thread pool are serialized according to the hierarchical structure.
[0114] Write the serialized log information and / or table contents of each node in the thread pool into the database.
[0115] Preferably, the logger also includes:
[0116] The display unit 605 is used to deserialize the log information and / or table content of each node into a hierarchical structure for display when displaying the log information;
[0117] The content of each node's sub-table is displayed separately.
[0118] It should be noted that the function of each unit in the embodiments of this application is the same as... Figures 1 to 5 The examples described are similar and will not be repeated here.
[0119] In this embodiment, the extraction unit 601 extracts the hierarchical relationship from the object to be processed; the mapping unit 602 maps each level in the hierarchical relationship to a node; the organizing unit 603 organizes the nodes into a hierarchical structure for storage according to the hierarchical relationship; and the recording unit 604 records the log information of each node in the hierarchical structure using corresponding tags.
[0120] In this embodiment, nodes are organized into a hierarchical structure for storage, and labels are used to record the log information of each node in the hierarchical structure. This allows the log information of each node to be stored and displayed in a hierarchical structure. As a result, when a problem occurs in a node of the object to be processed, the problem log of the problem node can be quickly located, thereby saving the time for troubleshooting and improving the efficiency of troubleshooting.
[0121] This application also provides a computer program product, on which a computer program is stored. When executed by a computer device, the computer program is used to implement this application. Figures 1 to 5 The log recording method described in the embodiments.
[0122] The log recorder in the embodiments of the present invention has been described above from the perspective of modular functional entities. The computer device in the embodiments of the present invention will now be described from the perspective of hardware processing.
[0123] This computer device is used to implement the function of a log recorder. One embodiment of the computer device in this invention includes:
[0124] Processor and memory;
[0125] When a memory is used to store computer programs, and a processor executes the computer programs stored in the memory, the following steps can be achieved:
[0126] Extract the hierarchical relationships from the objects to be processed;
[0127] Map each level in the hierarchical relationship to a node;
[0128] Based on the hierarchical relationship, the nodes are organized into a hierarchical structure for storage;
[0129] The log information of each node in the hierarchical structure is recorded using corresponding tags.
[0130] In some embodiments of the present invention, the structure of the label includes at least one of a business identifier, a business value, a font style, and a label type.
[0131] In some embodiments of the present invention, the font style is used to identify normal logs and abnormal logs, and the tag type is used to identify whether the log information of each node exceeds a preset log threshold. If it exceeds the log threshold, the tag type is identified as a first tag; if it does not exceed the log threshold, the tag type is identified as a second tag.
[0132] In some embodiments of the present invention, the processor may also be used to implement the following steps:
[0133] When a node's log information exceeds the log threshold, the log content exceeding the threshold is written to a partitioned table, and the partitioned table's identifier is written to the node's log information.
[0134] In some embodiments of the present invention, the processor may also be used to implement the following steps:
[0135] Log information and / or table content of each node in the hierarchical structure are stored in a thread pool in the form of an asynchronous queue;
[0136] Write the log information and / or table contents of each node in the thread pool to the database.
[0137] In some embodiments of the present invention, after storing the log information and / or table contents of each node in the hierarchical structure to the thread pool in the form of an asynchronous queue, the processor can also be used to implement the following steps:
[0138] Based on the hierarchical structure, the log information and / or table content of each node in the thread pool are serialized;
[0139] Write the serialized log information and / or table contents of each node in the thread pool into the database.
[0140] In some embodiments of the present invention, the processor may also be used to implement the following steps:
[0141] When displaying the log information, the log information and / or table content of each node are deserialized into a hierarchical structure for display.
[0142] The content of each node's sub-table is displayed separately.
[0143] It is understood that when the processor in the computer device described above executes the computer program, it can also implement the functions of each unit in the corresponding device embodiments described above, which will not be repeated here. For example, the computer program can be divided into one or more modules / units, which are stored in the memory and executed by the processor to complete the present invention. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program in the logger. For example, the computer program can be divided into units in the logger described above, and each unit can implement the specific functions described in the corresponding loggers above.
[0144] The computer device may be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the processor and memory are merely examples of a computer device and do not constitute a limitation on the computer device. It may include more or fewer components, or a combination of certain components, or different components. For example, the computer device may also include input / output devices, network access devices, buses, etc.
[0145] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or any conventional processor. The processor is the control center of the computer device, connecting various parts of the computer device via various interfaces and lines.
[0146] The memory can be used to store the computer programs and / or modules. The processor implements various functions of the computer device by running or executing the computer programs and / or modules stored in the memory and by calling data stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function, etc.; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as hard disk, RAM, plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, at least one disk storage device, flash memory device, or other volatile solid-state storage device.
[0147] The present invention also provides a computer-readable storage medium for implementing the function of a logger, wherein a computer program is stored thereon, and when the computer program is executed by a processor, the processor can perform the following steps:
[0148] Extract the hierarchical relationships from the objects to be processed;
[0149] Map each level in the hierarchical relationship to a node;
[0150] Based on the hierarchical relationship, the nodes are organized into a hierarchical structure for storage;
[0151] The log information of each node in the hierarchical structure is recorded using corresponding tags.
[0152] In some embodiments of the present invention, the structure of the label includes at least one of a business identifier, a business value, a font style, and a label type.
[0153] In some embodiments of the present invention, the font style is used to identify normal logs and abnormal logs, and the tag type is used to identify whether the log information of each node exceeds a preset log threshold. If it exceeds the log threshold, the tag type is identified as a first tag; if it does not exceed the log threshold, the tag type is identified as a second tag.
[0154] In some embodiments of the present invention, when a computer program stored on a computer-readable storage medium is executed by a processor, the processor may also be used to perform the following steps:
[0155] When a node's log information exceeds the log threshold, the log content exceeding the threshold is written to a partitioned table, and the partitioned table's identifier is written to the node's log information.
[0156] In some embodiments of the present invention, when a computer program stored on a computer-readable storage medium is executed by a processor, the processor may also be used to perform the following steps:
[0157] Log information and / or table content of each node in the hierarchical structure are stored in a thread pool in the form of an asynchronous queue;
[0158] Write the log information and / or table contents of each node in the thread pool to the database.
[0159] In some embodiments of the present invention, after storing the log information and / or table contents of each node in the hierarchical structure to a thread pool in the form of an asynchronous queue, when the computer program stored in the computer-readable storage medium is executed by the processor, the processor may further be used to implement the following steps:
[0160] Based on the hierarchical structure, the log information and / or table content of each node in the thread pool are serialized;
[0161] Write the serialized log information and / or table contents of each node in the thread pool into the database.
[0162] In some embodiments of the present invention, when a computer program stored on a computer-readable storage medium is executed by a processor, the processor may also be used to perform the following steps:
[0163] When displaying the log information, the log information and / or table content of each node are deserialized into a hierarchical structure for display.
[0164] The content of each node's sub-table is displayed separately.
[0165] It is understood that if the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a corresponding computer-readable storage medium. Based on this understanding, all or part of the processes in the above-described embodiments of the present invention can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above-described method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium can include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium can be appropriately added or removed according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media do not include electrical carrier signals and telecommunication signals.
[0166] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0167] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between apparatuses or units through some interfaces, and may be electrical, mechanical, or other forms.
[0168] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0169] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0170] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method of logging, characterized by, The method comprises: extracting a hierarchical relationship from a to-be-processed object; mapping each layer in the hierarchical relationship as a node; storing the nodes in a hierarchical structure according to the hierarchical relationship; using a label to record log information of each node in the hierarchical structure, a structure of the label comprising at least one of a font style and a label type, the font style being used to identify normal logs and abnormal logs, the label type being used to identify whether the log information of each node exceeds a preset log threshold, if the log information exceeds the log threshold, the label type is identified as a first label, and if the log information does not exceed the log threshold, the label type is identified as a second label.
2. The method of claim 1, wherein, The structure of the label further comprises at least one of a business identifier and a business value.
3. The method of claim 1, wherein, When the log information of a node exceeds the log threshold, log content exceeding the log threshold is written into a subtable, and an identification code of the subtable is written into the log information of the node.
4. The method of claim 3, wherein, The method further comprises: storing the log information and / or subtable content of each node in the hierarchical structure into a thread pool in an asynchronous queue manner; writing the log information and / or subtable content of each node in the thread pool into a database.
5. The method of claim 4, wherein, After storing the log information and / or subtable content of each node in the hierarchical structure into the thread pool in an asynchronous queue manner, the method further comprises: serializing the log information and / or subtable content of each node in the thread pool according to the hierarchical structure; writing the log information and / or subtable content of each node in the thread pool into a database, comprising: writing the serialized log information and / or subtable content of each node in the thread pool into a database.
6. The method of claim 5, wherein, The method further comprises: when the log information is displayed, the log information and / or subtable content of each node is deserialized into a hierarchical structure for display; the subtable content of each node is displayed separately.
7. A logger characterized by, The method comprises: an extraction unit configured to extract a hierarchical relationship from a to-be-processed object; a mapping unit configured to map each layer in the hierarchical relationship as a node; a collation unit configured to store the nodes in a hierarchical structure according to the hierarchical relationship; a recording unit configured to use a label to record log information of each node in the hierarchical structure, a structure of the label comprising at least one of a font style and a label type, the font style being used to identify normal logs and abnormal logs, the label type being used to identify whether the log information of each node exceeds a preset log threshold, if the log information exceeds the log threshold, the label type is identified as a first label, and if the log information does not exceed the log threshold, the label type is identified as a second label.
8. A computer apparatus comprising a processor and a memory, characterised in that, The processor, when executing the computer program stored on the memory, is configured to implement the method in any one of claims 1 to 6.
9. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program, when executed by the processor, is configured to implement the method in any one of claims 1 to 6.
Citation Information
Patent Citations
Low latency, distributed application for interactive world
CN114341808A
Interactive hierarchical status display
US20020186238A1