Log message processing method, log recorder, system and storage medium

By implementing the log message filtering function in the log recorder, the problem of difficult traditional log processing is solved and the difficulty of equipment development is reduced.

CN119512860APending Publication Date: 2025-02-25BEST EPOCH TECH CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411523809.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-29
Publication Date
2025-02-25

AI Technical Summary

Technical Problem

Traditional log processing is difficult, resulting in increased equipment development difficulty.

Method used

The user equipment obtains the filter conditions corresponding to the debugging requirements, generates a log acquisition instruction, and sends it to the log recorder. The log recorder filters the log messages of the monitored device based on the filter conditions and sends them to the user equipment.

Benefits of technology

Setting up functions related to log requirements in the log recorder reduces the adjustment process of the monitored equipment during the development process and reduces the difficulty of the equipment development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119512860A_ABST
    Figure CN119512860A_ABST
Patent Text Reader

Abstract

The invention provides a log message processing method, a log recorder, a system and a storage medium, and belongs to the technical field of equipment development, and the method comprises the steps that user equipment receives a first filtering condition input by a user, generates a first log acquisition instruction based on the first filtering condition, and sends the first log acquisition instruction to the log recorder; the monitored equipment generates a log message based on a preset message structure, the log message comprises a message filtering flag bit, and the log message is sent to a log recorder; and the log recorder receives the first log acquisition instruction and the log message, sets a filtering value based on a first filtering condition in the first log acquisition instruction, acquires a first log message of which the message filtering flag bit is matched with the filtering value from the received log message, and sends the first log message to the user equipment. According to the method, the functions related to the log demand are set in the log recorder, so that the adjustment process of the monitored equipment in the development process is reduced, and the development difficulty of the equipment is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the technical field of device development, and in particular, relates to a log message processing method, a log recorder, a system and a storage medium. Background Art

[0002] In order to understand the operating status of the monitored device, log messages are usually used to record the operating status of the monitored device, so as to facilitate subsequent debugging of the monitored device according to the operating status of the monitored device.

[0003] In an embedded system microcontroller unit (MCU), log messages generated during operation are generally stored in the MCU's disk. During device development, the device's operating status can be determined through the log messages output by the device, thereby debugging the device.

[0004] Different debugging requirements may require different logging functions. Therefore, in order to meet different debugging requirements, it is necessary to develop related logging functions for the device, which increases the difficulty of device development. Summary of the invention

[0005] The purpose of the present application is to provide a log message processing method, a log recorder, a system and a storage medium, aiming to solve the problem that traditional log processing is difficult and causes increased difficulty in device development.

[0006] A first aspect of an embodiment of the present application provides a log message processing method, the method is applied to a log processing system, the log processing system includes: a log recorder, a monitored device and a user device; the method includes:

[0007] The user device receives a first filtering condition input by a user, generates a first log acquisition instruction based on the first filtering condition, and sends the first log acquisition instruction to the log recorder;

[0008] The monitored device generates a log message based on a preset message structure, the log message includes a message filtering flag, and sends the log message to the log recorder;

[0009] The log recorder receives the first log acquisition instruction and the log message, sets a filter value based on a first filter condition in the first log acquisition instruction, obtains a first log message whose message filter flag matches the filter value from the received log message, and sends the first log message to the user device.

[0010] In some embodiments, the logger sends the first log message to the user equipment, including:

[0011] The logger parses the log message that meets the filtering condition to obtain the output level of the log message, the label of the module that generates the log message, and the message body;

[0012] The logger determines the output level color based on the output level; obtains the current system time of the onboarding logger;

[0013] The logger repackages the log message in a preset message format based on the output level, the label of the module generating the log message, the message body, the output level color and the system time to obtain the first log message;

[0014] The first log message obtained by repackaging is sent to the user equipment.

[0015] In some embodiments, the method further comprises:

[0016] When the communication connection between the logger and the user equipment is established, the user equipment sends a time synchronization message to the logger, where the time synchronization message carries the current system time of the user equipment;

[0017] When the logger receives the time synchronization message sent by the user equipment, the logger adjusts the system time of the logger based on the current system time of the user equipment carried in the time synchronization message, so that the system time of the logger is synchronized with the user equipment.

[0018] In some embodiments, after the logger receives the log message, the method further includes:

[0019] The logger adds a timestamp field to the received log message based on the system time of the logger, and stores the log message with the timestamp field added.

[0020] In some embodiments, the method further comprises:

[0021] The user equipment sends a second log acquisition instruction to the log recorder, where the second log acquisition instruction carries a second filtering condition and time information;

[0022] In response to receiving the second log acquisition request, the log recorder acquires the log message matching the second filtering condition and time information from the stored log messages based on the second log acquisition request, and sends the second log message to the user equipment.

[0023] A second aspect of an embodiment of the present application provides a log recorder, the log recorder comprising: a hardware serial port, a processor and a Bluetooth wireless module;

[0024] The processor is connected to the hardware serial port and the Bluetooth wireless module respectively;

[0025] The Bluetooth wireless module is used to establish a Bluetooth connection with the user equipment, receive a first log acquisition instruction sent by the user equipment through the Bluetooth connection, and send the first log acquisition instruction to the processor;

[0026] The hardware serial port is used to connect to the monitored device, receive the log message sent by the monitored device, and transmit the log message to the processor;

[0027] The processor is used to receive the first log acquisition instruction and the log message, set a filter value based on a first filter condition in the first log acquisition instruction, obtain a first log message whose message filter flag matches the filter value from the received log message, and send the first log message to the user equipment through the Bluetooth wireless module.

[0028] In some embodiments, the Bluetooth wireless module is further used to receive a time synchronization message sent by the user equipment when the Bluetooth wireless module and the user equipment are successfully matched, and send the time synchronization message to the processor;

[0029] The processor is further configured to adjust the system time based on the time synchronization message so that the system time of the logger is synchronized with the user equipment.

[0030] In some embodiments, the logger further comprises a storage module;

[0031] The storage module is connected to the processor;

[0032] The processor is further configured to add a timestamp field to the received system message based on the system time of the logger, and store the system message with the timestamp field added in the storage module.

[0033] A third aspect of an embodiment of the present application provides a log processing system, the log processing system comprising: a log recorder, a monitored device and a user device;

[0034] The log recorder is communicatively connected with the device under test and the user equipment respectively;

[0035] The user device is configured to receive a first filtering condition input by a user, generate a first log acquisition instruction based on the first filtering condition, and send the first log acquisition instruction to the log recorder;

[0036] The monitored device is used to generate a log message based on a preset message structure, the log message includes a message filtering flag, and send the log message to the log recorder;

[0037] The log recorder is used to receive the first log acquisition instruction and the log message, set a filter value based on a first filter condition in the first log acquisition instruction, obtain a first log message whose message filter flag matches the filter value from the received log message, and send the first log message to the user equipment.

[0038] A fourth aspect of an embodiment of the present application provides a log recorder, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the log message processing method described above when executing the computer program.

[0039] A fifth aspect of 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, the log message processing method described above is implemented.

[0040] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0041] In an embodiment of the present application, a filtering condition corresponding to a debugging requirement is obtained through a user device, a log acquisition instruction is generated based on the filtering condition, and the acquisition instruction is sent to a log recorder. The log recorder filters the log messages sent by the monitored device based on the filtering condition carried in the log acquisition instruction, and sends the log messages that meet the filtering condition to the user device so that the user device can display, analyze, and process the log messages. In this way, functions related to log requirements are set in the log recorder. When functions related to log requirements need to be adjusted, only the log recorder needs to be adjusted, without adjusting the monitored device, thereby reducing the adjustment process of the monitored device during the development process and reducing the difficulty of device development. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 A schematic diagram of a log message processing system provided by an exemplary embodiment is shown;

[0043] Figure 2 A schematic diagram of the structure of a log recorder provided by an exemplary embodiment is shown;

[0044] Figure 3 A schematic diagram showing the formats of log messages before and after repackaging provided by an exemplary embodiment is shown;

[0045] Figure 4A schematic diagram of a log message processing method provided by an exemplary embodiment is shown;

[0046] Figure 5 An internal software architecture of a logger provided by an exemplary embodiment is shown;

[0047] Figure 6 It is a schematic diagram of the structure of a log recorder provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0048] In order to make the technical problems, technical solutions and beneficial effects to be solved by the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0049] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0050] In order to understand the operating status of the monitored device, log messages are usually used to record the operating status of the monitored device, so as to facilitate subsequent debugging of the monitored device according to the operating status of the monitored device.

[0051] In an embedded system microcontroller unit (MCU), log messages generated during operation are generally stored in the MCU's disk. During device development or maintenance, the device's operating status can be determined through the log messages output by the device, thereby debugging or maintaining the device.

[0052] Due to the development trend of software modularization, different debugging requirements may require obtaining the log functions of different modules. Therefore, in order to meet different debugging requirements, it is necessary to develop related log functions for the device, which increases the difficulty of device development.

[0053] The present application provides a log message processing method, a log recorder, a system and a storage medium. The method obtains filtering conditions corresponding to debugging requirements through a user device, generates a log acquisition instruction based on the filtering conditions, and sends the acquisition instruction to the log recorder. The log recorder filters the log messages sent by the monitored device based on the filtering conditions carried in the log acquisition instruction, and sends the log messages that meet the filtering conditions to the user device, so that the user device can display, analyze and process the log messages. In this way, the functions related to the log requirements are set in the log recorder. When the functions related to the log requirements need to be adjusted, only the log recorder needs to be adjusted, and there is no need to adjust the monitored device, thereby reducing the adjustment process of the monitored device during the development process and reducing the difficulty of device development.

[0054] See also Figure 1 , which shows a schematic diagram of a log message processing system provided by an exemplary embodiment. Figure 1 The log message processing system includes a log recorder 10, a monitored device 20 and a user device 30. The log recorder 10 is in communication connection with the monitored device and the user device 30 respectively.

[0055] The user device 30 is used to receive a first filtering condition input by a user, generate a first log acquisition instruction based on the first filtering condition, and send the first log acquisition instruction to the log recorder 10 .

[0056] In some embodiments, the user device 30 includes an information input module, a display module and other modules. The information input module is used to respond to the user's input operation and generate information such as filtering conditions based on the user's input operation. The information input module can be any external input device, such as a keyboard, a handwriting tablet, etc. The display module is used to display the user's input information or display the content of the received log message, etc. The display module can be any device with a display function, such as a display, etc.

[0057] Among them, the first filtering condition is used to filter log messages that do not meet the debugging requirements. The first filtering condition can be a label condition, a message level condition, a time condition, etc. The user can enter the relevant first filtering condition in the user device 30, and the user can also select the relevant first filtering condition from the user device 30. Accordingly, in some embodiments, the user device 30 displays a filtering condition input interface, and the filtering condition input interface includes a filtering condition input box, and the filtering condition input box is used to receive the filtering condition input by the user, and generate the first filtering condition based on the filtering condition input by the user. In some embodiments, the user displays a filtering condition selection interface, and the filtering condition selection interface includes multiple condition selection items. When any condition selection item is triggered, the optional conditions under the condition selection item are displayed. When any optional condition is triggered, the triggered optional condition is used as the first filtering condition.

[0058] It should be noted that the first filtering condition may include one or more filtering conditions, and this is not specifically limited in the embodiments of the present application.

[0059] The user device 30 communicates with the logger 10 via a Bluetooth connection. Accordingly, the user device 30 includes a Bluetooth wireless module, which is used to establish a communication connection with the Bluetooth wireless module of the logger 10. The user device 30 sends the first filtering condition to the logger 10 via the logger 10.

[0060] The monitored device is used to generate a log message based on a preset message structure, the log message includes a message filtering flag, and send the log message to the log recorder 10.

[0061] The log message includes a message filter flag and a message body. The message filter flag is used to mark the filter condition of the log message. For example, the message filter flag is used to mark at least one of the conditions such as the label, level and timestamp of the log message. For example, in actual applications, the monitored device is divided according to its internal software modules, and different letters are used as module flag letters to add to the character stream message packet. For example, the message filter flag format is 3 bytes, for example, the message filter flag is a flag letter a1, b1, c1, d1...z1, where the letter represents the module label character and the number represents the output level character.

[0062] The position of the message filter flag and the message body in the message packet can be set according to different message formats. In the embodiment of the present application, the position of the message filter flag and the message body in the message packet is not specifically limited. For example, the message filter flag can be set at the front of the message packet.

[0063] The monitored device is connected to the log recorder 10 via a hardware interface, for example, the monitored device is connected to the log recorder 10 via a hardware serial port. Accordingly, the monitored device sends the generated log message to the log recorder 10 via the hardware serial port.

[0064] The log recorder 10 is used to receive the first log acquisition instruction and the log message, set a filter value based on the first filter condition in the first log acquisition instruction, obtain a first log message whose message filter flag matches the filter value from the received log message, and send the first log message to the user device 30.

[0065] See also Figure 2 , which shows a schematic diagram of the structure of a log recorder 10 provided by an exemplary embodiment. Figure 2 The log recorder 10 includes a hardware serial port 11, a processor 12 and a Bluetooth wireless module 13; the processor 12 is connected to the hardware serial port 11 and the Bluetooth wireless module 13 respectively. The Bluetooth wireless module 13 is used to establish a Bluetooth connection with the user device 30, receive a first log acquisition instruction sent by the user device 30 through the Bluetooth connection, and send the first log acquisition instruction to the processor 12; the hardware serial port 11 is used to connect with the monitored device, receive a log message sent by the monitored device, and transmit the log message to the processor 12; the processor 12 is used to receive the first log acquisition instruction and the log message, set a filter value based on the first filter condition in the first log acquisition instruction, obtain a first log message whose message filter flag matches the filter value from the received log message, and send the first log message to the user device 30 through the Bluetooth wireless module 13.

[0066] After the message logger receives the first filtering condition, the processor 12 in the message logger sets a filtering value that matches the first filtering condition, and the filtering value is used to compare with the message filtering flag in the message packet to filter out the log messages that meet the first filtering condition. For example, if the first filtering condition is to filter out the log messages of module a and the message registration is greater than 1, the filtering value can be set to a1, and accordingly, the processor 12 filters the log messages whose message filtering flags meet the filtering value a1 from the received log messages.

[0067] After the log recorder 10 filters out the log messages that meet the first filtering condition through the processor 12, it sends the filtered log messages to the user device 30. In some embodiments, the log recorder 10 can directly send the filtered log messages to the user device 30. In some embodiments, the log recorder 10 can also repackage the log messages obtained after filtering, and send the repackaged log messages to the user device 30. Accordingly, the processor 12 is used to parse the log message that meets the filtering condition, obtain the output level of the log message, the label of the module that generates the log message, and the message body; determine the output level color based on the output level; obtain the current system time of the entry logger; based on the output level, the label of the module that generates the log message, the message body, the output level color and the system time, repackage the log message according to the preset message format to obtain the first log message; and send the repackaged first log message to the user device 30.

[0068] See also Figure 3 , which shows a schematic diagram of the format of log messages before and after repackaging provided by an exemplary embodiment. Figure 3 , before repackaging, the log message includes a message filter flag and a message body. Among them, the message filter flag includes information such as the label and output level of the message. The log message is parsed to obtain the label, output level and message body of the log message, and the output level color of the log message is determined according to the output level, and the output color definition identification header and output color definition identification tail are set based on the output level color. The output level color is used to indicate the level of the log message. The correspondence between the output level color and the output level can be set as needed, and in the embodiment of the present application, no specific limitation is made. The processor 12 can also add a timestamp to the log message according to the current system time. The label is used to indicate the software module that generates the log message in the monitored device.

[0069] Among them, the format of the first log message after repackaging can be set as needed. In the embodiment of the present application, the format of the first log message after repackaging is not specifically limited. For example, the format of the log message after repackaging can be ulog format, etc.

[0070] After receiving the first log message sent by the log recorder 10, the user device 30 displays the message content of the first log message based on the output level, output level color, message body and other information of the first log message. For example, the user device 30 displays the first log messages in order from high to low output levels, and the content of each log message can also use the output level color as the display background of the message content. When the output levels of the log messages are the same, the user device 30 can also continue to determine the display order of the log messages with the same output level according to the timestamp information carried in the log messages and the timestamp of the log messages.

[0071] In some embodiments, the logger 10 also includes a storage module 14, which is connected to the processor 12; the processor 12 is also used to add a timestamp field to the received system message based on the system time of the logger 10, and store the system message with the added timestamp field in the storage module 14.

[0072] The storage module 14 may be any module having a data storage function. For example, the storage module 14 may be a secure digital memory card (Secure Digital, SD) or the like. In the embodiment of the present application, the type of the storage module 14 is not specifically limited.

[0073] In this implementation, by adding a storage module 14 in the log recorder 10, historical log messages can be stored in the log recorder 10, meeting the needs of developers to view historical log messages and reducing the pressure on the monitored device to store log messages.

[0074] The system time of the logger 10 may be the time synchronized with the user device 30. Accordingly, in some embodiments, in order to synchronize the time of the logger 10 with that of the user device 30, the user device 30 is further configured to send a time synchronization message to the logger 10 when the communication connection between the logger 10 and the user device 30 is established, and the time synchronization message carries the current system time of the user device 30; when the logger 10 receives the time synchronization message sent by the user device 30, the logger 10 adjusts the system time of the logger 10 based on the current system time of the user device 30 carried in the time synchronization message, so that the system time of the logger 10 is synchronized with that of the user device 30.

[0075] Please continue to see Figure 3When the log recorder 10 receives the log message sent by the monitored device, it also stores the received log message in the storage module 14. In order to add the relevant system time in the log message, the received log message needs to be repackaged. The timestamp can be added to the front of the message packet, which is not specifically limited in the embodiment of the present application.

[0076] In some embodiments, the user device 30 may also obtain historical log messages stored in the storage module 14. Accordingly, the user device 30 is used to send a second log acquisition instruction to the log recorder 10, where the second log acquisition instruction carries a second filtering condition and time information; in response to receiving the second log acquisition request, the log recorder 10 acquires a log message matching the second filtering condition and time information from the stored log messages based on the second log acquisition request, and sends the second log message to the user device 30.

[0077] The process of the user device 30 sending the second log acquisition request is the same as the process of sending the first log acquisition request, which will not be described in detail here.

[0078] One point that needs to be explained is that the second log acquisition request and the first log acquisition request can be the same log acquisition request. Accordingly, after receiving the log acquisition request, the log recorder 10 obtains the historical log messages that meet the filtering conditions from the storage module 14, and determines the log messages that meet the filtering conditions from the newly received log messages, and sends the two log messages to the user device 30, which is displayed by the user device 30 for debugging by the developer.

[0079] In an embodiment of the present application, a filtering condition corresponding to a debugging requirement is obtained through a user device, a log acquisition instruction is generated based on the filtering condition, and the acquisition instruction is sent to a log recorder. The log recorder filters the log messages sent by the monitored device based on the filtering condition carried in the log acquisition instruction, and sends the log messages that meet the filtering condition to the user device so that the user device can display, analyze, and process the log messages. In this way, functions related to log requirements are set in the log recorder. When functions related to log requirements need to be adjusted, only the log recorder needs to be adjusted, without adjusting the monitored device, thereby reducing the adjustment process of the monitored device during the development process and reducing the difficulty of device development.

[0080] The following describes the log message processing method provided by the present application in conjunction with the interaction process between the monitored device, the log recorder and the user device. Figure 4 , which shows a flow chart of a log message processing method provided by an exemplary embodiment. The method is applied to a log processing system, which includes: a log recorder, a monitored device and a user device.

[0081] S401: The user equipment receives a first filtering condition input by a user, generates a first log obtaining instruction based on the first filtering condition, and sends the first log obtaining instruction to the log recorder.

[0082] Among them, the first filtering condition is used to filter log messages that do not meet the debugging requirements. The first filtering condition can be a label condition, a message level condition, a time condition, etc. The user can enter the relevant first filtering condition in the user device, and the user can also select the relevant first filtering condition from the user device. Accordingly, in some embodiments, the user device displays a filtering condition input interface, and the filtering condition input interface includes a filtering condition input box, and the filtering condition input box is used to receive the filtering condition input by the user, and generate the first filtering condition based on the filtering condition input by the user. In some embodiments, the user displays a filtering condition selection interface, and the filtering condition selection interface includes multiple condition selection items. When any condition selection item is triggered, the optional conditions under the condition selection item are displayed. When any optional condition is triggered, the triggered optional condition is used as the first filtering condition.

[0083] It should be noted that the first filtering condition may include one or more filtering conditions, and this is not specifically limited in the embodiments of the present application.

[0084] The user equipment communicates with the logger via a Bluetooth connection. Accordingly, the user equipment includes a Bluetooth wireless module, which is used to establish a communication connection with the Bluetooth wireless module of the logger. The user equipment sends the first filtering condition to the logger via the logger.

[0085] S402: The monitored device generates a log message based on a preset message structure, the log message including a message filtering flag, and sends the log message to the log recorder.

[0086] The log message includes a message filter flag and a message body. The message filter flag is used to mark the filter condition of the log message. For example, the message filter flag is used to mark at least one of the conditions such as the label, level and timestamp of the log message. For example, in actual applications, the monitored device is divided according to its internal software modules, and different letters are used as module flag letters to add to the character stream message packet. For example, the message filter flag format is 3 bytes, for example, the message filter flag is a flag letter a1, b1, c1, d1...z1, where the letter represents the module label character and the number represents the output level character.

[0087] The position of the message filter flag and the message body in the message packet can be set according to different message formats. In the embodiment of the present application, the position of the message filter flag and the message body in the message packet is not specifically limited. For example, the message filter flag can be set at the front of the message packet.

[0088] The monitored device and the log recorder are connected via a hardware interface, for example, the monitored device and the log recorder are connected via a hardware serial port. Accordingly, the monitored device sends the generated log message to the log recorder via the hardware serial port.

[0089] S403, the log recorder receives the first log acquisition instruction and the log message, sets a filter value based on the first filter condition in the first log acquisition instruction, obtains a first log message whose message filter flag matches the filter value from the received log message, and sends the first log message to the user device.

[0090] After the message logger receives the first filter condition, the processor in the message logger sets a filter value that matches the first filter condition, and the filter value is used to compare with the message filter flag in the message packet to filter out log messages that meet the first filter condition. For example, if the first filter condition is to filter out log messages with module a and message registration greater than 1, the filter value can be set to a1, and accordingly, the processor filters log messages whose message filter flags meet the filter value a1 from the received log messages.

[0091] After the log recorder filters out the log messages that meet the first filtering condition, it sends the filtered log messages to the user device. In some embodiments, the log recorder can directly send the filtered log messages to the user device. In some embodiments, the log recorder can also repackage the log messages obtained after filtering, and send the repackaged log messages to the user device. Accordingly, the processor is used to parse the log message that meets the filtering condition, obtain the output level of the log message, the label of the module that generates the log message, and the message body; determine the output level color based on the output level; obtain the current system time of the on-the-job logger; based on the output level, the label of the module that generates the log message, the message body, the output level color and the system time, repackage the log message according to the preset message format to obtain the first log message; send the repackaged first log message to the user device.

[0092] See also Figure 3 , which shows the format of log messages before and after repackaging provided by an exemplary embodiment. Figure 3, before repackaging, the log message includes a message filter flag and a message body. Among them, the message filter flag includes information such as the label and output level of the message. The log message is parsed to obtain the label, output level and message body of the log message, and the output level color of the log message is determined according to the output level, and the output color definition identification header and output color definition identification tail are set based on the output level color. The output level color is used to indicate the level of the log message. The correspondence between the output level color and the output level can be set as needed, and in the embodiment of the present application, no specific limitation is made. The processor can also add a timestamp to the log message according to the current system time. The label is used to indicate the software module that generates the log message in the monitored device.

[0093] Among them, the format of the first log message after repackaging can be set as needed. In the embodiment of the present application, the format of the first log message after repackaging is not specifically limited. For example, the format of the log message after repackaging can be ulog format, etc.

[0094] After the user device receives the first log message sent by the log recorder, it displays the message content of the first log message based on the output level, output level color, message body and other information of the first log message. For example, the user device displays the first log messages in order from high to low output levels, and the content of each log message can also use the output level color as the display background of the message content. When the output levels of the log messages are the same, the user device can also continue to determine the display order of the log messages with the same output level according to the timestamp information carried in the log messages and the timestamp of the log messages.

[0095] In some embodiments, the log storage adds a timestamp field to the received system message based on the system time of the logger, and stores the system message with the timestamp field added in the storage module.

[0096] In this implementation, by adding a storage module in the log recorder, historical log messages can be stored in the log recorder, which meets the needs of developers to view historical log messages and reduces the pressure on the monitored device to store log messages.

[0097] The system time of the logger may be the time synchronized with the user device. Accordingly, in some embodiments, in order to synchronize the time of the logger with that of the user device, the user device is further configured to send a time synchronization message to the logger when the communication connection between the logger and the user device is established, and the time synchronization message carries the current system time of the user device; when the logger receives the time synchronization message sent by the user device, the logger adjusts the system time of the logger based on the current system time of the user device carried in the time synchronization message, so that the system time of the logger is synchronized with that of the user device.

[0098] Please continue to see Figure 3 When the log recorder receives the log message sent by the monitored device, it also stores the received log message in the storage module. In order to add the relevant system time in the log message, the received log message needs to be repackaged. The timestamp can be added to the front of the message packet, which is not specifically limited in the embodiment of the present application.

[0099] In some embodiments, the user device may also obtain historical log messages stored in the storage module. Accordingly, the user device is used to send a second log acquisition instruction to the log recorder, the second log acquisition instruction carrying a second filter condition and time information; the log recorder, in response to receiving the second log acquisition request, obtains log messages matching the second filter condition and time information from the stored log messages based on the second log acquisition request, and sends the second log message to the user device.

[0100] The process of the user equipment sending the second log acquisition request is the same as the process of sending the first log acquisition request, which will not be described in detail here.

[0101] One point that needs to be explained is that the second log acquisition request and the first log acquisition request can be the same log acquisition request. Accordingly, after receiving the log acquisition request, the log recorder obtains the historical log messages that meet the filtering conditions from the storage module, and determines the log messages that meet the filtering conditions from the newly received log messages, and sends the two log messages to the user device, which is displayed by the user device for debugging by the developer.

[0102] Another point to be explained is that, for the same log message, if the log message does not meet the first filtering condition, it is stored in the storage module; if the log message meets the first filtering condition, the log recorder will not only send the log message to the user device, but also store the log message in the storage module. Figure 5 , which shows the internal software architecture of a logger provided by an exemplary embodiment. Figure 5, receive wireless command messages (log acquisition requests or synchronization messages) through the serial port provided by the Bluetooth wireless module, execute corresponding command callbacks based on the Bluetooth message protocol, set filter values ​​or perform time synchronization based on the wireless command messages, and receive log messages transmitted by the serial port of the monitored device, store the log messages in the storage module through the message log module, or send the filtered messages to the user device through the Bluetooth serial port through the wireless serial port message filtering layer.

[0103] In an embodiment of the present application, a filtering condition corresponding to a debugging requirement is obtained through a user device, a log acquisition instruction is generated based on the filtering condition, and the acquisition instruction is sent to a log recorder. The log recorder filters the log messages sent by the monitored device based on the filtering condition carried in the log acquisition instruction, and sends the log messages that meet the filtering condition to the user device so that the user device can display, analyze, and process the log messages. In this way, functions related to log requirements are set in the log recorder. When functions related to log requirements need to be adjusted, only the log recorder needs to be adjusted, without adjusting the monitored device, thereby reducing the adjustment process of the monitored device during the development process and reducing the difficulty of device development.

[0104] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0105] Figure 6 is a schematic diagram of an electronic device provided by an exemplary embodiment of the present application. The electronic device may be a monitored device, a log recorder, or a user device. Figure 6 As shown, the electronic device 6 of this embodiment includes: a processor 60, a memory 61, and a computer program 62 stored in the memory 61 and executable on the processor 60, such as a log message processing program. When the processor 60 executes the computer program 62, the steps in the above-mentioned various log message processing method embodiments are implemented, such as Figure 4 Alternatively, when the processor 60 executes the computer program 62, the functions of each unit in the above-mentioned device embodiments are realized.

[0106] Exemplarily, the computer program 62 may be divided into one or more units, which are stored in the memory 61 and executed by the processor 60 to complete the present application. The one or more units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 62 in the electronic device 6.

[0107] The electronic device 6 may be any electronic device. The electronic device 6 may include, but is not limited to, a processor 60 and a memory 61. Those skilled in the art will appreciate that Figure 6 It is only an example of the electronic device 6 and does not constitute a limitation of the electronic device 6. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, the electronic device 6 may also include input and output devices, network access devices, buses, etc.

[0108] The processor 60 may be a central processing unit (CPU), other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0109] The memory 61 may be an internal storage unit of the electronic device 6, such as a hard disk or memory of the electronic device 6. The memory 61 may also be an external storage device of the electronic device 6, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the electronic device 6. Further, the memory 61 may also include both an internal storage unit of the electronic device 6 and an external storage device. The memory 61 is used to store the computer program and other programs and data required by the terminal device. The memory 61 may also be used to temporarily store data that has been output or is to be output.

[0110] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0111] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0112] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0113] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0114] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0115] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0116] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium. It should be noted that the content contained in the computer-readable medium can be appropriately increased or decreased 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 electric carrier signals and telecommunication signals.

[0117] The embodiments of the present application further provide 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, the steps in the above-mentioned method embodiments are implemented.

[0118] The embodiment of the present application also provides a computer program product. When the computer program product runs on a mobile terminal, the mobile terminal can implement the steps in the above-mentioned method embodiments when executing the computer program product.

[0119] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A log message processing method, characterized in that: The method is applied to a log processing system, the log processing system comprising: a log recorder, a monitored device and a user device; the method comprises: The user device receives a first filtering condition input by a user, generates a first log acquisition instruction based on the first filtering condition, and sends the first log acquisition instruction to the log recorder; The monitored device generates a log message based on a preset message structure, the log message includes a message filtering flag, and sends the log message to the log recorder; The log recorder receives the first log acquisition instruction and the log message, sets a filter value based on a first filter condition in the first log acquisition instruction, obtains a first log message whose message filter flag matches the filter value from the received log message, and sends the first log message to the user device.

2. The method according to claim 1, characterized in that The logger sends the first log message to the user equipment, including: The logger parses the log message that meets the filtering condition to obtain the output level of the log message, the label of the module that generates the log message, and the message body; The logger determines the output level color based on the output level; obtains the current system time of the onboarding logger; The logger repackages the log message in a preset message format based on the output level, the label of the module generating the log message, the message body, the output level color and the system time to obtain the first log message; The first log message obtained by repackaging is sent to the user equipment.

3. The method according to claim 1, characterized in that The method further comprises: When the communication connection between the logger and the user equipment is established, the user equipment sends a time synchronization message to the logger, where the time synchronization message carries the current system time of the user equipment; When the logger receives the time synchronization message sent by the user equipment, the logger adjusts the system time of the logger based on the current system time of the user equipment carried in the time synchronization message, so that the system time of the logger is synchronized with the user equipment.

4. The method according to claim 3, characterized in that After the logger receives the log message, the method further includes: The logger adds a timestamp field to the received log message based on the system time of the logger, and stores the log message with the timestamp field added.

5. The method according to any one of claims 1 to 4, characterized in that: The method further comprises: The user equipment sends a second log acquisition instruction to the log recorder, where the second log acquisition instruction carries a second filtering condition and time information; In response to receiving the second log acquisition request, the log recorder acquires the log message matching the second filtering condition and time information from the stored log messages based on the second log acquisition request, and sends the second log message to the user equipment.

6. A log recorder, characterized in that: The log recorder includes: a hardware serial port, a processor and a Bluetooth wireless module; The processor is connected to the hardware serial port and the Bluetooth wireless module respectively; The Bluetooth wireless module is used to establish a Bluetooth connection with the user equipment, receive a first log acquisition instruction sent by the user equipment through the Bluetooth connection, and send the first log acquisition instruction to the processor; The hardware serial port is used to connect to the monitored device, receive the log message sent by the monitored device, and transmit the log message to the processor; The processor is used to receive the first log acquisition instruction and the log message, set a filter value based on a first filter condition in the first log acquisition instruction, obtain a first log message whose message filter flag matches the filter value from the received log message, and send the first log message to the user equipment through the Bluetooth wireless module.

7. The log recorder according to claim 6, characterized in that The Bluetooth wireless module is further configured to receive a time synchronization message sent by the user equipment when the Bluetooth wireless module and the user equipment are successfully matched, and send the time synchronization message to the processor; The processor is further configured to adjust the system time based on the time synchronization message so that the system time of the logger is synchronized with the user equipment.

8. The log recorder according to claim 6 or 7, characterized in that: The log recorder also includes a storage module; The storage module is connected to the processor; The processor is further configured to add a timestamp field to the received system message based on the system time of the logger, and store the system message with the timestamp field added in the storage module.

9. A log processing system, characterized in that: The log processing system includes: a log recorder, a monitored device and a user device; The log recorder is communicatively connected with the device under test and the user equipment respectively; The user device is configured to receive a first filtering condition input by a user, generate a first log acquisition instruction based on the first filtering condition, and send the first log acquisition instruction to the log recorder; The monitored device is used to generate a log message based on a preset message structure, the log message includes a message filtering flag, and send the log message to the log recorder; The log recorder is used to receive the first log acquisition instruction and the log message, set a filter value based on a first filter condition in the first log acquisition instruction, obtain a first log message whose message filter flag matches the filter value from the received log message, and send the first log message to the user equipment.

10. 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 log message processing method according to any one of claims 1 to 5 is implemented.