Log management method, system and device, electronic equipment and storage medium
By setting up a log service in the electronic device operating system to receive and write hardware driver, hardware and application logs, the problem of cumbersome log analysis process is solved, and centralized management and efficient analysis of logs are achieved.
Patent Information
- Application Number
- CN202410451842.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-15
- Publication Date
- 2024-08-23
AI Technical Summary
In the existing technology, hardware device logs, driver logs, and upper-layer application logs are usually stored in different locations and need to be viewed in different ways, resulting in a cumbersome and inefficient log analysis process.
Set up a log service in the operating system of the electronic device, receive logs of target hardware drivers, hardware and applications through the preset network module, and write them to local log files, simplifying the log management process and improving analysis efficiency.
It achieves centralized management and quick viewing of logs, simplifies the log analysis process, improves efficiency, and reduces user participation.
Smart Images

Figure CN118535544A
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a log management method, system, device, electronic device and storage medium. Background Art
[0002] The upper-level application of the hardware device and the driver of the hardware device can be installed on the electronic device. The upper-level application of the hardware device can provide a visual interface and functions to facilitate users to input configuration parameters and control instructions of the hardware device; after the user inputs the configuration parameters and control instructions, the upper-level application can send the configuration parameters and control instructions to the hardware device through the driver of the hardware device, thereby realizing control of the hardware device.
[0003] For example, the electronic device may be an industrial computer, and the hardware device may be an acquisition card. The upper-layer application of the acquisition card and the driver of the acquisition card may be installed on the industrial computer. The upper-layer application of the acquisition card may provide a visual interface and functions to facilitate the user to input the configuration parameters and control instructions of the acquisition card; after the user inputs the configuration parameters and control instructions, the upper-layer application of the acquisition card may send the configuration parameters and control instructions to the acquisition card through the driver of the acquisition card, thereby realizing the control of the acquisition card.
[0004] When debugging and diagnosing exceptions on hardware devices, it is usually necessary to combine the logs of the upper-layer application of the hardware device, the logs of the driver of the hardware device, and the logs of the hardware device to perform log analysis. However, in the related art, the logs of the upper-layer application, the logs of the driver, and the logs of the hardware device are usually stored in different locations and need to be viewed in different ways. For example, the logs of the driver need to be viewed through a third-party tool, and the logs of the hardware device need to be viewed through serial port printing. Therefore, in the related art, when performing log analysis, the process of viewing the logs is relatively cumbersome, and the efficiency of log analysis is low. Summary of the invention
[0005] The purpose of the embodiments of the present application is to provide a log management method, system, device, electronic device and storage medium to simplify the process of viewing logs and improve the efficiency of log analysis. The specific technical solution is as follows:
[0006] In a first aspect, an embodiment of the present application provides a log management method, the method being applied to a log service for log management set in an operating system of an electronic device, the method comprising:
[0007] Receiving a driver log of the target hardware driver sent by the target hardware driver through a preset first network module;
[0008] The driver log is written to a preset local log file.
[0009] Optionally, in a specific implementation, before writing the drive log to a preset local log file, the method further includes:
[0010] Receiving a hardware log of the target hardware sent by the target hardware driver through the first network module; wherein the hardware log is sent by the target hardware to the target hardware driver;
[0011] The step of writing the drive log into a preset local log file includes:
[0012] The driver log and the hardware log are written into a preset local log file.
[0013] Optionally, in a specific implementation, before writing the driver log and the hardware log into a preset local log file, the method further includes:
[0014] Receiving an application log of the target application sent by the target application through a preset second network module; wherein the target application manages the target hardware through the target hardware driver;
[0015] The step of writing the driver log and the hardware log into a preset local log file includes:
[0016] The driver log, the hardware log and the application log are written into a preset local log file.
[0017] Optionally, in a specific implementation, before writing the driver log, the hardware log, and the application log into a preset local log file, the method further includes:
[0018] Determine whether each received log meets a preset log writing condition; wherein the log writing condition includes: at least one of a log level, a log module, and a log format;
[0019] The step of writing the driver log, the hardware log, and the application log into a preset local log file includes:
[0020] The driver log, the hardware log, and the application log that meet the log writing condition are written into a preset local log file.
[0021] Optionally, in a specific implementation, the step of writing the driver log, the hardware log, and the application log into a preset local log file includes:
[0022] The driver log, the hardware log and the application log are written into the same preset local log file in the order of receiving time from earliest to latest.
[0023] Optionally, in a specific implementation, the receiving the hardware log of the target hardware sent by the target hardware driver through the first network module includes:
[0024] Receive a hardware log of the target hardware that meets a preset log format and is sent by the target hardware driver through the first network module.
[0025] In a second aspect, an embodiment of the present application provides a log management system, the system comprising a log service for log management set in an operating system of an electronic device and a target hardware driver preset with a first network module;
[0026] The target hardware driver is used to send a driver log of the target hardware driver to the log service through the first network module;
[0027] The log service is used to receive the driver log and write the driver log into a preset local log file.
[0028] Optionally, in a specific implementation,
[0029] The target hardware driver is further used to send the hardware log of the target hardware to the log service through the first network module;
[0030] The log service is specifically used to write the driver log and the hardware log into a preset local log file.
[0031] Optionally, in a specific implementation, the system further includes a target application program preset with a second network module;
[0032] The target application is used to send a program log of the target application to the log service through the second network module;
[0033] The log service is specifically used to write the driver log, the hardware log and the application log into a preset local log file.
[0034] Optionally, in a specific implementation,
[0035] The log service is further used to determine whether each received log meets a preset log writing condition before writing the driver log, the hardware log and the application log into a preset local log file; wherein the log writing condition includes at least one of a log level, a log module and a log format;
[0036] The log service is specifically used to write the driver log, the hardware log and the application log that meet the log writing condition into a preset local log file.
[0037] Optionally, in a specific implementation,
[0038] The log service is specifically used to write the driver log, the hardware log and the application log into the same preset local log file in the order of receiving time from the earliest to the latest.
[0039] Optionally, in a specific implementation,
[0040] The target hardware driver is specifically used to send the hardware log of the target hardware that meets the preset log format to the log service through the first network module.
[0041] In a third aspect, an embodiment of the present application provides a log management device, the device is applied to a log service for log management set in an operating system of an electronic device, the device comprising:
[0042] A first receiving module, configured to receive a driver log of a target hardware driver sent by the target hardware driver through a preset first network module;
[0043] The log writing module is used to write the drive log into a preset local log file.
[0044] Optionally, in a specific implementation,
[0045] The first receiving module is further configured to receive a hardware log of the target hardware sent by the target hardware driver through the first network module before writing the driver log into the preset local log file; wherein the hardware log is sent by the target hardware to the target hardware driver;
[0046] The log writing module is specifically used to write the driver log and the hardware log into a preset local log file;
[0047] Optionally, in a specific implementation, the device further includes:
[0048] A second receiving module is used for receiving an application log of the target application sent by the target application through a preset second network module before writing the driver log and the hardware log into a preset local log file; wherein the target application manages the target hardware through the target hardware driver;
[0049] The log writing module is specifically used to write the driver log, the hardware log and the application log into a preset local log file;
[0050] Optionally, in a specific implementation, the device further includes:
[0051] A log judgment module, used for judging whether each received log meets a preset log writing condition before writing the driver log, the hardware log and the application log into a preset local log file; wherein the log writing condition includes at least one of a log level, a log module and a log format;
[0052] The log writing module is specifically used to write the driver log, the hardware log and the application log that meet the log writing condition into a preset local log file;
[0053] Optionally, in a specific implementation, the log writing module is specifically used to: write the driver log, the hardware log and the application log into the same preset local log file in the order of receiving time from the earliest to the latest;
[0054] Optionally, in a specific implementation, the first receiving module is specifically used to: receive a hardware log of the target hardware that satisfies a preset log format and is sent by the target hardware driver through the first network module.
[0055] In a fourth aspect, an embodiment of the present application provides an electronic device, including:
[0056] Memory, used to store computer programs;
[0057] The processor is used to implement any of the above-mentioned log management methods when executing the program stored in the memory.
[0058] In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, it implements any of the above-mentioned log management methods.
[0059] An embodiment of the present application also provides a computer program product including instructions, which, when executed on a computer, enables the computer to execute any of the log management methods described above.
[0060] Beneficial effects of the embodiments of the present application:
[0061] As can be seen from the above, by applying the solution provided by the embodiment of the present application, a log service for log management can be provided in the operating system of the electronic device, and a first network module can be preset in the target hardware driver. Since the service provided in the operating system of the electronic device can be self-started after the electronic device is turned on, and can be accessed by all processes on the electronic device, the above-mentioned log service can be self-started after the electronic device is turned on, and can be accessed by all processes on the electronic device. In this way, the target hardware driver can send its own log to the first network module provided by itself, and the first network module can send the log of the above-mentioned target hardware driver to the above-mentioned log service. Therefore, the log service can receive the drive log of the target hardware driver sent by the target hardware driver through the above-mentioned first network module, and write the received log into a preset local log file.
[0062] Based on this, the log of the target hardware driver can be written into a preset local log file through the preset first network module and log service. Then, when performing log analysis, the log of the target hardware driver can be directly viewed in the preset local log file. Therefore, the scheme provided by the application embodiment can simplify the process of viewing logs and improve the efficiency of log analysis. BRIEF DESCRIPTION OF THE DRAWINGS
[0063] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application, and for ordinary technicians in this field, other embodiments can also be obtained based on these drawings.
[0064] Figure 1 A flow chart of a log management method provided in an embodiment of the present application;
[0065] Figure 2 Another flow chart of the log management method provided in the embodiment of the present application;
[0066] Figure 3 Another flow chart of the log management method provided in the embodiment of the present application;
[0067] Figure 4 Another flow chart of the log management method provided in the embodiment of the present application;
[0068] Figure 5 A schematic diagram of the structure of a log management system provided in an embodiment of the present application;
[0069] Figure 6 Another flow chart of the log management method provided in the embodiment of the present application;
[0070] Figure 7 Another flow chart of the log management method provided in the embodiment of the present application;
[0071] Figure 8 A schematic diagram of the structure of a log management system provided in an embodiment of the present application;
[0072] Fig. 9 A schematic diagram of the structure of a log management device provided in an embodiment of the present application;
[0073] Fig.10 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0074] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field based on the present application belong to the scope of protection of the present application.
[0075] In the related art, when performing log analysis, it is usually necessary to view the logs of the upper-level application, the logs of the driver of the hardware device, and the logs of the hardware device in different ways and at different locations. The process of viewing the logs is relatively cumbersome and the efficiency of log analysis is low.
[0076] In order to solve the above technical problems, an embodiment of the present application provides a log management method.
[0077] The method is applicable to various scenarios requiring log management, for example, scenarios requiring log management of driver logs of acquisition card drivers, scenarios requiring log management of driver logs of printer drivers, etc. The specific application scenarios of the method are not specifically limited in the embodiments of the present application.
[0078] The method is applied to the log service for log management provided in the operating system of the electronic device, and, identical to other services provided in the operating system of the electronic device, the above-mentioned log service can be self-started after the electronic device is turned on, and runs in the background of the operating system of the electronic device, and can be accessed by all processes on the electronic device. Then, after the electronic device is turned on, the log service can be automatically started, and the log management method provided by the embodiment of the application is applied to perform log management in the background. In other words, in the process of performing log management, the user can not participate in the management process, and the user is insensitive to the management process. Therefore, the log management method provided by the embodiment of the application can simplify the process of log management and improve the user experience in the log management process.
[0079] Furthermore, the electronic device may be a server, a laptop, a desktop computer, or any other electronic device that can be installed with an operating system, hereinafter referred to as the electronic device. The electronic device may be an independent electronic device or a cluster of multiple electronic devices. Based on this, the embodiments of the present application do not specifically limit the electronic device.
[0080] A log management method provided in an embodiment of the present application may include the following steps:
[0081] Receiving a driver log of the target hardware driver sent by the target hardware driver through a preset first network module;
[0082] The driver log is written to a preset local log file.
[0083] As can be seen from the above, by applying the solution provided by the embodiment of the present application, a log service for log management can be provided in the operating system of the electronic device, and a first network module can be preset in the target hardware driver. Since the service provided in the operating system of the electronic device can be self-started after the electronic device is turned on, and can be accessed by all processes on the electronic device, the above-mentioned log service can be self-started after the electronic device is turned on, and can be accessed by all processes on the electronic device. In this way, the target hardware driver can send its own log to the first network module provided by itself, and the first network module can send the log of the above-mentioned target hardware driver to the above-mentioned log service. Therefore, the log service can receive the drive log of the target hardware driver sent by the target hardware driver through the above-mentioned first network module, and write the received log into a preset local log file.
[0084] Based on this, the log of the target hardware driver can be written into a preset local log file through the preset first network module and log service. Then, when performing log analysis, the log of the target hardware driver can be directly viewed in the preset local log file. Therefore, the scheme provided by the application embodiment can simplify the process of viewing logs and improve the efficiency of log analysis.
[0085] Below, in conjunction with the accompanying drawings, a log management method provided in an embodiment of the present application is specifically described.
[0086] Figure 1 The flow chart of a log management method provided in the embodiment of the present application is applied to a log service for log management set in the operating system of an electronic device. Figure 1 As shown, the method may include the following steps S101 and S104.
[0087] S101: Receive a driver log of a target hardware driver sent by a target hardware driver through a preset first network module.
[0088] The log service for log management set in the operating system of the electronic device can be automatically started when the electronic device is turned on, and can be accessed by all processes on the electronic device. Therefore, the target hardware driver can send the log generated by itself to the log service through the preset first network module, and the log service can receive the log of the target hardware driver sent by the target hardware driver through the preset first network module. Wherein, for the convenience of description, the log of the target hardware driver received by the log service is called a driver log.
[0089] That is to say, the target hardware driver can send its own driver log to the first network module, and the first network module can send the driver log to the log service. In this way, the log service can receive the driver log of the target hardware driver sent by the target hardware driver through the preset first network module.
[0090] Optionally, when the target hardware driver sends the driver log to the log service through the first network module, a User Datagram Protocol (UDP) may be used to improve data transmission efficiency.
[0091] Optionally, the operating system may be a Windows operating system, and the log service may be a Windows service. A Windows service is an executable application that can run for a long time in a Windows session, can be automatically started when the computer starts, can be paused and restarted, and does not display any user interface. It is independent of a specific user, that is, it can be used by any user or process on an electronic device. Exemplarily, Windows Update Service, Windows Time Service, etc. all belong to the category of Windows services.
[0092] Optionally, when the operating system is a Windows operating system, and the log service is a Windows service, the first network module may be created based on Winsock Kernel (WSK).
[0093] Among them, Winsock Kernel is a set of kernel-mode network programming interfaces that allow software modules running in kernel mode to implement network I / O (Input / Output) operations similar to those in user mode.
[0094] The communication between the first network module created based on Winsock Kernel and the Windows service involves the conversion between kernel state data and user state data and the design of the communication method. Since the first network module is in the kernel state data, the data that the Windows service can receive is the user state data. Therefore, the first network module cannot directly send the kernel state log generated by the target hardware driver to the Windows service. If the kernel state log generated by the target hardware driver is directly sent to the Windows service, it is likely to cause the Windows system to crash and cause problems such as blue screen. Moreover, since the log is generally in the form of a string, when the first network module sends the kernel state log generated by the target hardware driver to the Windows service, it can first encapsulate the kernel state log generated by the target hardware driver and convert it into a data structure that can be transmitted by Winsock Kernel, and then send the encapsulated data to the Windows service.
[0095] For the design of the above communication method, it is usually necessary to obtain the IP address, port number and other information of the communicating parties when establishing network communication. However, the driver cannot directly obtain the IP, port number and other information of the Windows service. Therefore, the communication between the first network module and the Windows service can adopt a local loopback method, that is, both communicating parties use the local address, and then specify a dedicated port number for communication.
[0096] S104: Writing the driver log into a preset local log file.
[0097] After receiving the driver log, the log service can write the received driver log to a preset local log file. For each driver log, the content of the driver log may include the generation time, log module, log level, and personnel login information of the driver log. The log service may write part or all of the received driver log to a local log file, which is not specifically limited in the embodiments of the present application.
[0098] In some specific implementations, in order to save local storage space and improve log writing efficiency, the log content written by the log service to the local log file can be determined according to the specific needs of log analysis, and does not have to include the entire content of the driver log. For example, when the specific needs of log analysis are to analyze the login frequency of a certain user, the log content written by the log service to the local log file may include the generation time of the driver log and the login information of the person.
[0099] The target hardware driver may include multiple functional modules, such as a control module, a flow module, etc. For each driver log, the log module field in the driver log is the specific functional module that generates the driver log. The above log levels may include regular logs, debug logs, warning logs, and error logs.
[0100] Generally, some logs have low value for log analysis, such as logs with low log levels, logs whose log modules are designated modules, logs with incorrect log formats, etc. In order to save storage resources, a log writing condition can be set in advance to filter out some logs with low value for log analysis. Furthermore, after receiving the above-mentioned driver logs, the log service can first determine whether each received driver log meets the preset log writing condition, and then write the driver logs that meet the log writing condition into the preset local log file.
[0101] Exemplarily, logs can be divided into regular logs (level 1), debug logs (level 2), warning logs (level 3) and error logs (level 4) according to their log levels, and the preset log writing condition can be: the log level is greater than level 1. Furthermore, after receiving each driver log, the log service can first determine whether the log level of the driver log is greater than level 1. If the log level of the driver log is greater than level 1, the driver log can be written into a preset local log file.
[0102] Exemplarily, when the log module is a designated module and its value for log analysis is low, the preset log writing condition may be: the log module is a module other than the designated module. Then, after receiving each driver log, the log service may first determine whether the log module of the driver log is the designated module. If the log module of the driver log is not the designated module, the log may be written to the preset local log file.
[0103] Exemplarily, logs can be divided into logs that meet the preset log format and logs that do not meet the preset log format according to the log format. The preset log writing condition can be: the log format meets the preset log format. Then, after receiving each driver log, the log service can first determine whether the log format of the driver log meets the preset log format. If the log format of the driver log meets the preset log format, the driver log can be written to the preset local log file.
[0104] Optionally, after generating the driver log, the target hardware driver can determine whether the generated driver log meets the log writing conditions, and send the generated driver log that meets the log writing conditions to the log service; then, the log service can receive the driver log that meets the log writing conditions, and write the driver log that meets the log writing conditions into a preset local log file.
[0105] In this way, some logs with low value for log analysis can be filtered out through log writing conditions, thereby saving storage resources. In addition, filtering out logs with low value for log analysis can also reduce the number of logs that need to be analyzed during log analysis, thereby further improving the efficiency of log analysis.
[0106] Usually, the logs generated by the target hardware driver are arranged in the order of the generation time of the logs from first to last, which can reflect the operation process of the target hardware driver. Therefore, optionally, in a specific implementation, the log service can write the driver log to a preset local log file according to the generation time of the received driver logs from first to last. Thereby, it is convenient for relevant technical personnel to analyze the operation process of the target hardware driver according to the local log file, thereby improving the efficiency of debugging or abnormal diagnosis of the target hardware driver.
[0107] Based on this, by applying the solution provided by the embodiment of the present application, the log of the target hardware driver can be written into a preset local log file through the preset first network module and log service. Then, when performing log analysis, the log of the target hardware driver can be directly viewed in the preset local log file. Therefore, by applying the solution provided by the embodiment of the present application, the process of viewing logs can be simplified and the efficiency of log analysis can be improved.
[0108] In many cases, users need to analyze the hardware device's driver log and the hardware device log together to debug and diagnose hardware errors.
[0109] Based on this, optionally, in a specific implementation, such as Figure 2 As shown, a log management method provided in an embodiment of the present application may also include the following step S102.
[0110] S102: receiving a hardware log of the target hardware sent by the target hardware driver through the first network module;
[0111] Among them, the hardware log is sent by the target hardware to the target hardware driver.
[0112] Accordingly, in this specific implementation, the above step S104, writing the drive log into a preset local log file, may include the following step S1041.
[0113] S1041: Write the driver log and the hardware log into a preset local log file.
[0114] In this specific implementation, the log of the target hardware can be called a hardware log. Wherein, the target hardware can send the hardware log generated by itself to the above-mentioned target hardware driver, and the above-mentioned target hardware driver can send the received hardware log to the above-mentioned first network module, and the above-mentioned first network module can send the received hardware log to the above-mentioned log service. In this way, the above-mentioned log service can receive the hardware log of the target hardware sent by the above-mentioned target hardware driver through the above-mentioned first network module.
[0115] The target hardware and the target hardware driver of the target hardware can be connected to each other through multiple channels according to a specified communication protocol, and each channel can be used to transmit different types of data. The target hardware can send the log of the target hardware to the target hardware driver through a channel for transmitting log data among the multiple channels.
[0116] Optionally, the target hardware may also be connected to other hardware devices for communication, and the hardware log of the target hardware may include logs generated by the target hardware itself and logs generated by other hardware devices connected to the target device for communication. For example, a capture card may be connected to a camera for communication, and the camera may send the camera log generated by itself to the capture card, and the capture card may send the capture card log generated by itself and the received camera log to the capture card driver.
[0117] Optional, such as Figure 3 As shown, the above step S102, receiving the hardware log of the target hardware sent by the target hardware driver through the first network module, may include the following step S1021.
[0118] S1021: Receive a hardware log of the target hardware that satisfies a preset log format and is sent by the target hardware driver through the first network module.
[0119] In some cases, due to the unstable communication connection between the target hardware and the target hardware driver, the hardware log of the target hardware received by the target hardware driver may contain format errors such as garbled characters. In these cases, after receiving the hardware log sent by the target hardware, the target hardware driver can first determine the logs that meet the preset log format in the received hardware logs, that is, the hardware logs that do not contain format errors such as garbled characters, and then the target hardware driver can send the hardware logs of the target hardware that meet the preset log format to the log service. Then, the log service can receive the hardware logs of the target hardware that meet the preset log format sent by the target hardware driver through the above-mentioned first network module.
[0120] After receiving the driver log and the hardware log sent by the target hardware driver through the first network module, the log service may write the received driver log and the hardware log into a preset local log file.
[0121] Among them, Figure 1 The specific implementation is similar to that shown, for each hardware log, the content of the hardware log may include the generation time, log module, log level, and personnel login information of the hardware log. The log service may write part or all of the received hardware log content into a local log file, which is not specifically limited in the embodiments of the present application.
[0122] For example, the log content written by the log service to the local log file can be determined based on the specific needs of log analysis, and does not have to include the entire content of the driver log.
[0123] For another example, a log writing condition can be pre-set to filter out some logs with low value for log analysis. Then, after receiving the above hardware logs, the log service can first determine whether each received hardware log meets the preset log writing condition, and then write the hardware logs that meet the log writing condition into the preset local log file.
[0124] Optionally, after receiving the hardware log, the target hardware driver can determine whether the received hardware log meets the log writing condition, and send the received hardware log that meets the log writing condition to the log service. Then, the log service can receive the hardware log that meets the log writing condition, and write the hardware log that meets the log writing condition into a preset local log file.
[0125] In this way, some logs with low value for log analysis can be filtered out through log writing conditions, thereby saving storage resources. In addition, filtering out logs with low value for log analysis can also reduce the number of logs that need to be analyzed during log analysis, thereby further improving the efficiency of log analysis.
[0126] Among them, the log service can write both the driver log and the hardware log into the same preset local log file, or write them into different local log files respectively, which is not specifically limited in the embodiments of the present application.
[0127] Optionally, the log service can write the driver log and the hardware log into two different local log files, and display each local log file separately or combine and display multiple log files according to user needs.
[0128] Exemplarily, the log service can write the driver log and the hardware log into the driver log file and the hardware log file respectively. When the user wants to view the information interaction process between the target hardware and the target hardware driver, the user can send an instruction to the log service about viewing the information interaction process between the target hardware and the target hardware driver. After receiving the instruction, the log service can merge and display the driver logs in the driver log file and the hardware logs in the hardware log file in the order of the log generation time from the earliest to the latest.
[0129] Generally, the logs generated by the target hardware and the target hardware driver are arranged in order of the generation time of the logs from earliest to latest, which can reflect the process of information interaction between the target hardware and the target hardware driver.
[0130] Therefore, optionally, the log service can write the driver log and the hardware log into the same preset local log file in the order of the generation time of the received logs from the earliest to the latest, so as to facilitate the relevant technical personnel to analyze the information interaction process between the target hardware and the target hardware driver according to the local log file, thereby improving the efficiency of debugging or abnormal diagnosis of the target hardware and the target hardware driver.
[0131] Exemplarily, the information interaction process between the target hardware and the target hardware driver may be: when the target hardware driver receives a certain instruction, how to process the instruction or what the processing result of the instruction is, and what the processing result of the instruction in the target hardware is.
[0132] In some cases, after the target hardware generates a log, it will send the log to the target hardware driver. After the target hardware driver generates a log or receives a log, it will send the generated or received log to the log service. In this case, the logs generated by the target hardware and the target hardware driver are sent to the log service in approximately real time. Therefore, the order in which the log service receives the logs can reflect the order in which the logs are generated, thereby reflecting the process of information interaction between the target hardware and the target hardware driver.
[0133] Based on this, the log of the target hardware driver and the log of the target hardware can be written into a preset local log file by presetting the first network module and the log service. Then, when performing log analysis, the log of the target hardware driver and the log of the target hardware can be directly viewed in the preset local log file. Therefore, the scheme provided by the application embodiment can simplify the process of viewing logs and improve the efficiency of log analysis.
[0134] Usually, the upper-layer application of the hardware device and the driver of the hardware device can be installed on the electronic device. The upper-layer application of the hardware device can provide a visual interface and functions to facilitate the user to input the configuration parameters and control instructions of the hardware device; after the user inputs the configuration parameters and control instructions, the upper-layer application can send the configuration parameters and control instructions to the hardware device through the driver of the hardware device, thereby realizing the control of the hardware device. Therefore, when debugging and abnormal diagnosis of the hardware device, it is usually necessary to combine the log of the upper-layer application of the hardware device, the log of the driver of the hardware device and the log of the hardware device for log analysis.
[0135] Based on this, optionally, in a specific implementation, such as Figure 4 As shown, a log management method provided in an embodiment of the present application may also include the following step S103.
[0136] S103: Receive an application log of a target application sent by the target application via a preset second network module.
[0137] The target application manages the target hardware through the target hardware driver.
[0138] Accordingly, in this specific implementation, the above step S1041, writing the driver log and the hardware log into a preset local log file, may include the following step S401.
[0139] S401: Write the driver log, hardware log and application log into a preset local log file.
[0140] In this specific implementation, the log of the target application may be referred to as an application log. The target application may be preset with a second network module, so that the target application may send the application log generated by itself to the second network module, and the second network module may send the received application to the log service.
[0141] In this way, the log service can receive the application log of the target application sent by the target application through the second network module on the basis of receiving the driver log of the target hardware driver sent by the target hardware driver through the first network module and the hardware log of the target hardware. That is, the log service can receive the driver log, the hardware log and the application log.
[0142] Optionally, when the operating system is a Windows operating system and the log service is a Windows service, the second network module may be created based on Winsock, where Winsock is an API (Application Programming Interface) for network programming on the Windows operating system, providing a set of standard interfaces and functions to enable developers to create network applications and implement network communication, data transmission and other functions.
[0143] Optionally, when the target application sends the application log of the target application to the log service through the second network module, the user datagram protocol may be used to improve the efficiency of data transmission.
[0144] After receiving the driver log, hardware log and application log, the log service can write the received driver log, hardware log and application log into the preset local log file.
[0145] Among them, the log service can write the driver log, hardware log and application log into the same preset local log file, or write the driver log, hardware log and application log into different local log files respectively. The embodiment of the present application does not specifically limit this.
[0146] Optionally, the log service can write the driver log, hardware log, and application log into three different local log files, and display each local log file separately or combine and display multiple log files according to user needs.
[0147] Exemplarily, the log service can write the application log, driver log and hardware log into the application log file, driver log file and hardware log file respectively. When the user wants to view the information interaction process between the target application and the target hardware driver, the user can send an instruction to the log service to view the information interaction process between the target application and the target hardware driver. After receiving the instruction, the log service can merge and display the application logs of the target application in the application log file and the driver logs of the target hardware driver in the driver log file in the order of the log generation time from the earliest to the latest.
[0148] Among them, Figure 1-Figure 3 Similar to the specific implementation shown, for each application log, the content of the application log may include the generation time, log module, log level, and personnel login information of the application log. The log service may write part or all of the content of the received application log into a local log file, which is not specifically limited in the embodiments of the present application.
[0149] For example, when the specific requirement of log analysis is to analyze the information interaction process between the target hardware, target application and target hardware driver, when the log service writes the driver log, hardware log and application log to the local log file, the log content written to the local log file may include the log generation time, log module and log level.
[0150] For another example, a log writing condition can be pre-set to filter out some logs with low value for log analysis. Then, after receiving the above application logs, the log service can first determine whether each received application log meets the preset log writing condition, and then write the application logs that meet the log writing condition into the preset local log file.
[0151] Similar to the target hardware driver, the target application may include multiple functional modules, such as a control module, a flow module, etc. For each application log, the log module field in the application log is the specific functional module that generates the application log. The log levels may include regular logs, debug logs, warning logs, and error logs.
[0152] For example, Figure 5 As shown, a structural diagram of a log management system applied to this specific implementation method provided by an embodiment of the present application, wherein the system may include: a log service 101 for log management set in the operating system of the electronic device, a target application 102 preset with a second network module, and a target hardware driver 103 preset with a first network module.
[0153] See also Figure 5 , an operating system, a target application 102 of a target hardware 104, and a target hardware driver 103 of the target hardware 104 may be installed on the electronic device. A log service 101 is provided in the operating system of the electronic device, a second network module may be provided in the target application 102, and a first network module may be provided in the target hardware driver 103. In addition, there is a communication connection between the log service 101, the target application 102, and the target hardware driver 103, and there is a communication connection between the target hardware driver 103 and the target hardware 104.
[0154] Among them, the target application 102 can manage the target hardware 104 through the target hardware driver 103, and the target hardware 104 can send the log generated by the target hardware 104 to the target hardware driver 103. The target application 102 can be used to send the application log of the target application 102 to the log service 101 through the second network module; the target hardware driver 103 can be used to send the driver log of the target hardware driver 103 and the hardware log of the target hardware 103 to the log service 101 through the first network module; the log service 101 can be used to implement the log management method provided in the embodiment of the present application.
[0155] That is to say, for the target application 102, the target application 102 sends its own application log to the second network module, and then the second network module sends the received application log to the log service 101; the target hardware 104 sends its own hardware log to the target hardware driver 103, and the target hardware driver 103 sends the received hardware log to the first network module, and then the first network module sends the received hardware log to the log service 101; the target hardware driver 103 sends its own driver log to the first network module, and then the first network module sends the received driver log to the log service 101; and then, the log service 101 writes the received application log, hardware log and driver log into the preset local log file.
[0156] Exemplarily, the electronic device may be a laptop computer, the target hardware may be a printer connected to the laptop computer, the target hardware driver may be a driver of the printer connected to the laptop computer, and the target application may be an application for configuring the printer.
[0157] Exemplarily, the electronic device may be an industrial computer, the target hardware may be an acquisition card connected to the industrial computer, the target hardware driver may be a driver for the acquisition card connected to the industrial computer, and the target application may be an application for configuring the acquisition card. Furthermore, since the acquisition card is a PCIe device, the acquisition card and the industrial computer may be connected based on the PCIe (peripheral component interconnect express) standard communication. The acquisition card may include, but is not limited to, an image acquisition card, a video acquisition card, an audio acquisition card (such as a sound card), a data acquisition card, and the like.
[0158] That is to say, this specific implementation method is applicable to various scenarios that require log management, for example, scenarios where log management is required for acquisition card logs, acquisition card driver logs, and logs of the acquisition card's upper-level application; scenarios where log management is required for printer logs, printer driver logs, and logs of the printer's upper-level application, and so on.
[0159] Based on this, by applying this specific implementation, the application log of the target application, the driver log of the target hardware driver, and the hardware log of the target hardware can all be written into a preset local log file through the preset first network module, the second network module, and the log service. Then, when performing log analysis, the application log of the target application, the driver log of the target hardware driver, and the hardware log of the target hardware can be directly viewed in the preset local log file. Therefore, by applying the solution provided by the embodiment of the present application, the process of viewing logs can be simplified, and the efficiency of log analysis can be improved.
[0160] In addition, by applying the solution provided in the embodiments of the present application, the log service can realize unified management of the logs of the target application, the target hardware driver, and the target hardware, thereby reducing the performance loss of log management of the target application and the target hardware driver and improving the performance of the target application and the target hardware driver.
[0161] Optionally, in a specific implementation, such as Figure 6 As shown, before the above step S401: writing the driver log, hardware log and application log into the preset local log file, the log management method provided by the embodiment of the present application may further include the following step S105.
[0162] S105: Determine whether each received log meets a preset log writing condition.
[0163] The log writing condition includes at least one of a log level, a log module and a log format.
[0164] Accordingly, the above step S401: writing the driver log, hardware log and application log into a preset local log file may include the following step S4011.
[0165] S4011: Write the driver log, hardware log, and application log that meet the log writing conditions into a preset local log file.
[0166] Normally, there are some logs with low value for log analysis, such as logs with low log levels, logs whose log modules are designated modules, logs with wrong log formats, etc. In order to save storage resources, a log writing condition can be pre-set to filter out a part of logs with low value for log analysis through the log writing condition. Then, after receiving the above-mentioned driver log, hardware log and application log, the log service can first determine whether each log received meets the preset log writing condition, and then write the driver log, hardware log and application log that meet the log writing condition into the preset local log file. Wherein, in this specific implementation, each log received by the log service is: the driver log of the target hardware driver sent by the above-mentioned target hardware driver through the first network module and the hardware log of the target hardware, and the application log of the target application sent by the above-mentioned target application through the second network module.
[0167] Exemplarily, logs can be divided into regular logs (level 1), debug logs (level 2), warning logs (level 3) and error logs (level 4) according to their log levels, and the preset log writing condition can be: the log level is greater than level 1. Furthermore, after receiving each log sent by the target application and the target hardware driver, the log service can first determine whether the log level of the log is greater than level 1, and if the log level of the log is greater than level 1, the log can be written into a preset local log file.
[0168] Exemplarily, when the log module is a designated module and its value for log analysis is low, the preset log writing condition may be: the log module is a module other than the designated module. Then, after receiving each log sent by the target application and the target hardware driver, the log service may first determine whether the log module of the log is the designated module. If the log module of the log is not the designated module, the log may be written to the preset local log file.
[0169] Exemplarily, logs can be divided into logs that meet the preset log format and logs that do not meet the preset log format according to the log format. The preset log writing condition can be: the log format meets the preset log format. Then, after receiving each log sent by the target application and the target hardware driver, the log service can first determine whether the log format of the log meets the preset log format. If the log format of the log meets the preset log format, the log can be written to the preset local log file.
[0170] Optionally, the target application can determine whether the generated application log meets the log writing condition after generating the application log, and send the application log that meets the log writing condition to the log service; the target hardware driver can determine whether the generated driver log meets the log writing condition after generating the driver log, and send the generated driver log that meets the log writing condition to the log service; the target hardware driver can determine whether the received hardware log meets the log writing condition after receiving the log sent by the hardware device, and send the received hardware log that meets the log writing condition to the log service. Then, the log service can receive the driver log, hardware log and application log that meet the log writing condition, and write the driver log, hardware log and application log that meet the log writing condition into the preset local log file.
[0171] Based on this, by applying this specific implementation, a portion of logs with low value for log analysis can be filtered out through log writing conditions, thereby saving storage resources. In addition, filtering out logs with low value for log analysis can also reduce the number of logs that need to be analyzed during log analysis, thereby further improving the efficiency of log analysis.
[0172] Usually, the logs generated by the target hardware, the target hardware driver and the target application are arranged in order of log generation time from earliest to latest, which can reflect the process of information interaction between the target hardware, the target hardware driver and the target application.
[0173] Based on this, optionally, in a specific implementation, in the above Figure 4 Based on the specific implementation method shown, after receiving the driver log, hardware log and application log, the log service can write the driver log, hardware log and application log into the same preset local log file in the order of the generation time of each received log from the earliest to the latest. In this way, it is convenient for relevant technical personnel to analyze the information interaction process between the target hardware, the target hardware driver and the target application according to the local log file, thereby improving the efficiency of debugging or abnormal diagnosis of the target hardware, the target hardware driver and the target application.
[0174] Exemplarily, the information interaction process between the target hardware, the target hardware driver and the target application may be: which instruction is sent by the target application, how the instruction is processed or what the processing result is in the target hardware driver, and what the processing result of the instruction is in the target hardware.
[0175] In some cases, after the target hardware generates a log, it will send the log to the target hardware driver. After the target hardware driver generates a log or receives a log, it will send the generated or received log to the log service. After the target application generates a log, it will send the log to the log service. In this case, the logs generated by the target hardware, the target hardware driver and the target application are sent to the log service in approximately real time. Therefore, the order in which the log service receives the logs can reflect the order in which the logs are generated, thereby reflecting the process of information interaction between the target hardware, the target hardware driver and the target application.
[0176] Based on this, optionally, in a specific implementation, such as Figure 7 As shown, the above step S401: writing the driver log, hardware log and application log into a preset local log file may include the following step S4012.
[0177] S4012: Writing the driver log, the hardware log, and the application log into the same preset local log file in the order of receiving time.
[0178] Based on this, in this specific implementation, the log service writes the driver log, hardware log and application log into the same preset local log file in the order of receiving time from the earliest to the latest. In this way, it is convenient for relevant technicians to analyze the information interaction process between the target hardware, the target hardware driver and the target application according to the local log file, thereby improving the efficiency of debugging or abnormal diagnosis of the target hardware, the target hardware driver and the target application.
[0179] Corresponding to the log management method provided in the above-mentioned embodiment of the present application, the embodiment of the present application also provides a log management system for a log service for log management set in an operating system of an electronic device.
[0180] Figure 8 A structural diagram of a log management system provided in an embodiment of the present application. Figure 8 As shown, the log management system may include a log service 801 for log management set in the operating system of the electronic device and a target hardware driver 802 preset with a first network module.
[0181] The target hardware driver 802 is used to send the driver log of the target hardware driver to the log service through the first network module;
[0182] The log service 801 is used to receive the driver log and write the driver log into a preset local log file.
[0183] As can be seen from the above, by applying the solution provided by the embodiment of the present application, a log service for log management can be provided in the operating system of the electronic device, and a first network module can be preset in the target hardware driver. Since the service provided in the operating system of the electronic device can be self-started after the electronic device is turned on, and can be accessed by all processes on the electronic device, the above-mentioned log service can be self-started after the electronic device is turned on, and can be accessed by all processes on the electronic device. In this way, the target hardware driver can send its own log to the first network module provided by itself, and the first network module can send the log of the above-mentioned target hardware driver to the above-mentioned log service. Therefore, the log service can receive the drive log of the target hardware driver sent by the target hardware driver through the above-mentioned first network module, and write the received log into a preset local log file.
[0184] Based on this, the log of the target hardware driver can be written into a preset local log file through the preset first network module and log service. Then, when performing log analysis, the log of the target hardware driver can be directly viewed in the preset local log file. Therefore, the scheme provided by the application embodiment can simplify the process of viewing logs and improve the efficiency of log analysis.
[0185] Optionally, in a specific implementation, the target hardware driver 802 is further configured to send the hardware log of the target hardware to the log service through the first network module;
[0186] The log service 801 is specifically used to write the driver log and the hardware log into a preset local log file.
[0187] Optionally, in a specific implementation, the system further includes a target application program preset with a second network module;
[0188] The target application is used to send a program log of the target application to the log service through the second network module;
[0189] The log service 801 is specifically used to write the driver log, the hardware log and the application log into a preset local log file.
[0190] Optionally, in a specific implementation, the log service 801 is further used to determine whether each received log meets a preset log writing condition before writing the driver log, the hardware log and the application log into a preset local log file; wherein the log writing condition includes: at least one of a log level, a log module and a log format;
[0191] The log service 801 is specifically configured to write the driver log, the hardware log, and the application log that meet the log writing condition into a preset local log file.
[0192] Optionally, in a specific implementation, the log service 801 is specifically used to write the driver log, the hardware log and the application log into the same preset local log file in the order of receiving time from earliest to latest.
[0193] Optionally, in a specific implementation, the target hardware driver 802 is specifically configured to send a hardware log of the target hardware that satisfies a preset log format to the log service through the first network module.
[0194] Corresponding to the log management method provided in the above-mentioned embodiment of the present application, the embodiment of the present application also provides a log management device for a log service for log management set in an operating system of an electronic device.
[0195] Fig. 9 A structural diagram of a log management device provided in an embodiment of the present application is shown in FIG. Fig. 9 As shown, the log management device may include the following modules:
[0196] A first receiving module 910 is used to receive a driver log of a target hardware driver sent by the target hardware driver through a preset first network module;
[0197] The log writing module 920 is used to write the drive log into a preset local log file.
[0198] As can be seen from the above, by applying the solution provided by the embodiment of the present application, a log service for log management can be provided in the operating system of the electronic device, and a first network module can be preset in the target hardware driver. Since the service provided in the operating system of the electronic device can be self-started after the electronic device is turned on, and can be accessed by all processes on the electronic device, the above-mentioned log service can be self-started after the electronic device is turned on, and can be accessed by all processes on the electronic device. In this way, the target hardware driver can send its own log to the first network module provided by itself, and the first network module can send the log of the above-mentioned target hardware driver to the above-mentioned log service. Therefore, the log service can receive the drive log of the target hardware driver sent by the target hardware driver through the above-mentioned first network module, and write the received log into a preset local log file.
[0199] Based on this, the log of the target hardware driver can be written into a preset local log file through the preset first network module and log service. Then, when performing log analysis, the log of the target hardware driver can be directly viewed in the preset local log file. Therefore, the scheme provided by the application embodiment can simplify the process of viewing logs and improve the efficiency of log analysis.
[0200] Optionally, in a specific implementation,
[0201] The first receiving module 910 is further configured to receive a hardware log of the target hardware sent by the target hardware driver through the first network module before writing the driver log into the preset local log file; wherein the hardware log is sent by the target hardware to the target hardware driver;
[0202] The log writing module 920 is specifically configured to write the driver log and the hardware log into a preset local log file.
[0203] Optionally, in a specific implementation, the device further includes:
[0204] A second receiving module is used for receiving an application log of the target application sent by the target application through a preset second network module before writing the driver log and the hardware log into a preset local log file; wherein the target application manages the target hardware through the target hardware driver;
[0205] The log writing module 920 is specifically configured to write the driver log, the hardware log and the application log into a preset local log file.
[0206] Optionally, in a specific implementation, the device further includes:
[0207] A log judgment module, used for judging whether each received log meets a preset log writing condition before writing the driver log, the hardware log and the application log into a preset local log file; wherein the log writing condition includes at least one of a log level, a log module and a log format;
[0208] The log writing module 920 is specifically configured to write the driver log, the hardware log, and the application log that meet the log writing condition into a preset local log file.
[0209] Optionally, in a specific implementation, the log writing module 920 is specifically used to write the driver log, the hardware log and the application log into the same preset local log file in the order of receiving time from the earliest to the latest.
[0210] Optionally, in a specific implementation, the first receiving module 910 is specifically used to receive a hardware log of the target hardware that satisfies a preset log format and is sent by the target hardware driver through the first network module.
[0211] The present application also provides an electronic device, such as Fig.10 As shown, including:
[0212] Memory 1001, used for storing computer programs;
[0213] The processor 1002 is used to implement the steps of any of the above-mentioned log management methods when executing the program stored in the memory 1001.
[0214] Furthermore, the electronic device may further include a communication bus and / or a communication interface, and the processor 1002, the communication interface, and the memory 1001 communicate with each other via the communication bus.
[0215] The communication bus mentioned in the above electronic device can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0216] The communication interface is used for communication between the above electronic device and other devices.
[0217] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.
[0218] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0219] In another embodiment provided in the present application, a computer-readable storage medium is provided, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned log management methods are implemented.
[0220] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute any log management method in the above embodiments.
[0221] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a solid-state hard disk (SSD), etc.
[0222] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0223] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for system embodiments, device embodiments, electronic device embodiments, computer-readable storage medium embodiments, and computer program product embodiments, since they are basically similar to method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0224] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.
Claims
1. A log management method, characterized in that: The method is applied to a log service for log management set in an operating system of an electronic device, and the method comprises: Receiving a driver log of the target hardware driver sent by the target hardware driver through a preset first network module; The driver log is written to a preset local log file.
2. The method according to claim 1, characterized in that Before writing the drive log into a preset local log file, the method further includes: Receiving a hardware log of the target hardware sent by the target hardware driver through the first network module; wherein the hardware log is sent by the target hardware to the target hardware driver; The step of writing the drive log into a preset local log file includes: The driver log and the hardware log are written into a preset local log file.
3. The method according to claim 2, characterized in that Before writing the driver log and the hardware log into a preset local log file, the method further includes: Receiving an application log of the target application sent by the target application through a preset second network module; wherein the target application manages the target hardware through the target hardware driver; The step of writing the driver log and the hardware log into a preset local log file includes: The driver log, the hardware log and the application log are written into a preset local log file.
4. The method according to claim 3, characterized in that Before writing the driver log, the hardware log, and the application log into a preset local log file, the method further includes: Determine whether each received log meets a preset log writing condition; wherein the log writing condition includes: at least one of a log level, a log module, and a log format; The step of writing the driver log, the hardware log, and the application log into a preset local log file includes: The driver log, the hardware log, and the application log that meet the log writing condition are written into a preset local log file.
5. The method according to claim 4, characterized in that The step of writing the driver log, the hardware log, and the application log into a preset local log file includes: The driver log, the hardware log and the application log are written into the same preset local log file in the order of receiving time from earliest to latest.
6. The method according to any one of claims 2 to 5, characterized in that: The receiving the hardware log of the target hardware sent by the target hardware driver through the first network module includes: Receive a hardware log of the target hardware that meets a preset log format and is sent by the target hardware driver through the first network module.
7. A log management system, characterized in that: The system includes a log service for log management set in the operating system of the electronic device and a target hardware driver preset with a first network module; The target hardware driver is used to send a driver log of the target hardware driver to the log service through the first network module; The log service is used to receive the driver log and write the driver log into a preset local log file.
8. A log management device, characterized in that: The device is applied to a log service for log management set in an operating system of an electronic device, and the device includes: A first receiving module, configured to receive a driver log of a target hardware driver sent by the target hardware driver through a preset first network module; The log writing module is used to write the drive log into a preset local log file.
9. The device according to claim 8, characterized in that The first receiving module is further configured to receive a hardware log of the target hardware sent by the target hardware driver through the first network module before writing the driver log into the preset local log file; wherein the hardware log is sent by the target hardware to the target hardware driver; The log writing module is specifically used to write the driver log and the hardware log into a preset local log file; and / or, The device also includes: A second receiving module is used for receiving an application log of the target application sent by the target application through a preset second network module before writing the driver log and the hardware log into a preset local log file; wherein the target application manages the target hardware through the target hardware driver; The log writing module is specifically used to write the driver log, the hardware log and the application log into a preset local log file; and / or, The device also includes: A log judgment module, used for judging whether each received log meets a preset log writing condition before writing the driver log, the hardware log and the application log into a preset local log file; wherein the log writing condition includes at least one of a log level, a log module and a log format; The log writing module is specifically used to write the driver log, the hardware log and the application log that meet the log writing condition into a preset local log file; and / or, The log writing module is specifically used to write the driver log, the hardware log and the application log into the same preset local log file in the order of receiving time from the earliest to the latest; and / or, The first receiving module is specifically used to receive the hardware log of the target hardware that meets the preset log format and is sent by the target hardware driver through the first network module.
10. An electronic device, characterized in that: include: Memory, used to store computer programs; A processor, for implementing any of the methods described in claims 1-6 when executing a program stored in a memory.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.
Citation Information
Patent Citations
Log processing method and device, electronic equipment and medium
CN111782474A
Log processing method and system, electronic device and storage medium
CN113722190A
Log analysis and integration method and system for operating system
CN113849329A
A terminal log controller apparatus and method for processing error
KR1020100053711A
Methods for operating a log device
US6021408A
