Embedded device and log storage and export method thereof

Through the log storage and export methods of embedded devices, the problem of obtaining log information of embedded electronic products is solved, unattended log management is realized, the reliability and maintenance efficiency of the equipment are improved, and efficient logs in the embedded electronic products market are met. Manage requirements.

CN119271638APending Publication Date: 2025-01-07XIAMEN YUNGAN TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411106200.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-13
Publication Date
2025-01-07

AI Technical Summary

Technical Problem

When embedded electronic products are running unattended, it is difficult to obtain and analyze log information in a timely manner, affecting the maintenance and management efficiency of equipment.

Method used

Designed an embedded device log storage and export method, by creating write log macros and output log macros, it monitors external storage and display devices in real time, realizes writing, backup, compression and copying of debug information to external storage devices, and provides log management The module performs initialization and log file management.

Benefits of technology

In the absence of manned situation, efficient acquisition and analysis of embedded device logs is achieved, which reduces the complexity and cost of log management, and improves the reliability and maintenance efficiency of equipment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119271638A_ABST
    Figure CN119271638A_ABST
Patent Text Reader

Abstract

The invention relates to an embedded device and a log storage and export method thereof, and the method comprises the steps: creating a log writing macro which is used for transmitting debugging information into a subfile and storing the debugging information; creating an output log macro for outputting debugging information and positioning information of the debugging information; creating a log management module, and initializing the log management module; after initialization is completed, a sub-file handle is opened to wait for writing, and when debugging information exists, a log-writing voluntary is called to write the debugging information into the sub-file; the log management module monitors whether external storage equipment is accessed or not in real time, if the external storage equipment is monitored to be accessed, whether a preset file with a fixed name exists in the accessed external storage equipment or not is judged, and if yes, a sub-file is copied into the external storage equipment; and the log management module monitors whether external display equipment is accessed or not in real time, and if the external display equipment is monitored to be accessed, the log management module calls an output log to display debugging information and positioning information thereof. According to the invention, the log management requirement of the embedded electronic product can be realized.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of embedded devices, and in particular to an embedded device and a log storage and export method thereof. Background Art

[0002] During the use of embedded electronic products, various unexpected internal and external reasons may cause abnormal operation of the equipment. In addition, embedded electronic products are often not used in a human-computer interactive manner. In order to discover and solve problems in a timely manner, it is necessary to monitor the operating status of the equipment and record relevant log information. In addition, since embedded electronic products usually run unattended, how to conveniently obtain and analyze these log information is crucial for equipment maintenance and management. Summary of the invention

[0003] In order to solve the above problems, the present invention proposes an embedded device and a log storage and export method thereof.

[0004] The specific plan is as follows:

[0005] A method for storing and exporting embedded device logs, comprising the following steps:

[0006] Create a write log macro to pass debug information into a subfile and save it; create an output log macro to output debug information and debug information location information;

[0007] Create a log management module and initialize it; during the initialization process, the log management module performs the following operations: create a log storage folder and a sub-file of a corresponding size under the corresponding path based on the configured path and size;

[0008] After the log management module is initialized, it opens the sub-file handle and waits for writing. When there is debugging information, it calls the write log macro to write the debugging information into the sub-file.

[0009] The log management module monitors in real time whether an external storage device is connected. If the access is detected, it determines whether there is a file with a preset fixed name in the connected external storage device. If so, the sub-file is copied to the external storage device.

[0010] The log management module monitors in real time whether there is an external display device connected. If it is detected to be connected, the output log macro is called to display the debugging information and its location information.

[0011] Furthermore, the location information of the debugging information includes the file name of the sub-file where the debugging information is located, the number of lines in the sub-file, and a timestamp.

[0012] Furthermore, the log management module performs backup processing while writing the debugging information into the sub-file.

[0013] Furthermore, when writing debugging information into a sub-file, the log management module determines whether the sub-file size has reached an upper limit, and if so, creates a new sub-file for writing.

[0014] Furthermore, when the log management module writes debugging information into a sub-file, when the size of the sub-file to be written reaches the upper limit, it determines whether the total size of all sub-files reaches the configured threshold. If so, it starts overwriting from the first sub-file.

[0015] Furthermore, when copying the sub-file to the external storage device, the sub-file is first compressed, and then the obtained compressed package is copied to the external storage device, and the compressed package is deleted after the copying is completed.

[0016] An embedded device comprises a processor, a memory and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method in the embodiment of the present invention when executing the computer program.

[0017] The present invention adopts the above technical solution, which can obtain and analyze the log information of embedded electronic products in an unattended situation and save it to an external storage device, which can meet the demand of the embedded electronic product market for efficient, convenient and reliable log management technology and has broad market prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 Shown is a flow chart of a method according to a first embodiment of the present invention. DETAILED DESCRIPTION

[0019] To further illustrate various embodiments, the present invention provides drawings. These drawings are part of the disclosure of the present invention, which are mainly used to illustrate the embodiments and can be used in conjunction with the relevant descriptions in the specification to explain the operating principles of the embodiments. With reference to these contents, ordinary technicians in this field should be able to understand other possible implementations and advantages of the present invention.

[0020] The present invention will now be further described with reference to the accompanying drawings and specific implementation methods.

[0021] Embodiment 1:

[0022] The embodiment of the present invention provides a method for storing and exporting logs of an embedded device, such as Figure 1 As shown, the method comprises the following steps:

[0023] S1: Create a write log macro to transfer the debugging information into a subfile and save it; create an output log macro to output the debugging information and the location information of the debugging information.

[0024] The log write macro created in this embodiment is named YG_LOCAL_LOG, in which a write interface of the log management module is defined. That is, calling the log write macro can write the incoming data into a file, thereby achieving the purpose of saving debugging information.

[0025] The output log macro created in this embodiment is named LOGI, which replaces the printf function to output debugging information, and can also output the location information of this debugging information, that is, the file name of the subfile, the number of lines in the subfile, and the timestamp. In addition, the importance level of the debugging information can also be set in the output log macro name.

[0026] S2: Create a log management module and initialize it. The log management module performs the following operations during the initialization process: based on the configured path and size, create a log storage folder and a sub-file of a corresponding size under the corresponding path.

[0027] During the initialization process of the log management module, first determine whether the path exists based on the configured path. If not, create a new path; if it exists, further determine whether there is a folder with the same name under the path. If so, delete it; otherwise, create a log storage folder and create a sub-file of the configured size under the log storage folder.

[0028] S3: After the log management module is initialized, it opens the sub-file handle and waits for writing. When there is debugging information, it calls the write log macro to write the debugging information into the sub-file.

[0029] In this embodiment, the log management module performs backup processing while writing the debugging information into the sub-file. When the sub-file size reaches the upper limit, a new sub-file is created for writing. When the total size of all sub-files reaches the configured threshold, an overwriting process is performed.

[0030] S4: The log management module monitors in real time whether there is an external storage device connected. If access is detected, it is determined whether there is a file with a preset fixed name in the connected external storage device. If so, the sub-file is copied to the external storage device.

[0031] The external storage device may be a USB flash drive, a PC tool, etc. The preset fixed name is pre-set by the staff and configured in the device, and can be called when in use.

[0032] In this embodiment, when copying a sub-file to an external storage device, the sub-file is first compressed, and then the obtained compressed package is copied to the external storage device, and the compressed package is deleted after the copying is completed.

[0033] By copying the log information in the form of a compressed package to the external storage device in step S4, the complexity and cost of the log management tool that depends on specific hardware devices can be reduced.

[0034] S5: The log management module monitors in real time whether an external display device is connected. If the connection is detected, the output log macro is called to display the debugging information and its location information.

[0035] Through step S5, the staff can intuitively understand the debugging information.

[0036] The embodiments of the present invention are applicable to embedded electronic products with operating systems such as Android and Hongmeng, and can be widely used in application fields such as manufacturing, system maintenance and management, data analysis and processing of embedded electronic products, as follows:

[0037] (1) For embedded electronic product manufacturers, this embodiment can provide a convenient and effective log management method to help them monitor the operating status of products, discover and solve problems in a timely manner, and improve product reliability and stability.

[0038] (2) For system maintenance and management personnel, this embodiment can provide a convenient log acquisition and analysis method to help them quickly locate and solve equipment failures, improve equipment maintenance efficiency and reduce maintenance costs.

[0039] (3) For data analysis and processing personnel, this embodiment can provide an efficient large-scale log processing method to help them extract useful information from a large amount of log information and provide support for decision-making.

[0040] In general, the solution of this embodiment meets the demand of the embedded electronic product market for efficient, convenient and reliable log management technology and has broad market prospects.

[0041] Embodiment 2:

[0042] The present invention also provides an embedded device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the above method embodiment of the first embodiment of the present invention when executing the computer program.

[0043] Although the present invention has been specifically shown and described in conjunction with the preferred embodiments, it should be understood by those skilled in the art that various changes may be made to the present invention in form and details without departing from the spirit and scope of the present invention as defined by the appended claims, all of which are within the scope of protection of the present invention.

Claims

1. A method for storing and exporting embedded device logs, characterized in that: The following steps are involved: Create a write log macro to transfer debug information to a subfile and save it; Create an output log macro to output debugging information and the location information of the debugging information; Create a log management module and initialize it; The log management module performs the following operations during the initialization process: based on the configured path and size, creates a log storage folder and a sub-file of the corresponding size under the corresponding path; After the log management module is initialized, it opens the sub-file handle and waits for writing. When there is debugging information, it calls the write log macro to write the debugging information into the sub-file. The log management module monitors in real time whether an external storage device is connected. If the access is detected, it determines whether there is a file with a preset fixed name in the connected external storage device. If so, the sub-file is copied to the external storage device. The log management module monitors in real time whether there is an external display device connected. If it is detected to be connected, the output log macro is called to display the debugging information and its location information.

2. The method for storing and exporting embedded device logs according to claim 1, characterized in that: The location information of the debugging information includes the file name of the sub-file where the debugging information is located, the line number in the sub-file, and the timestamp.

3. The method for storing and exporting embedded device logs according to claim 1, characterized in that: The log management module performs backup processing while writing the debugging information into the sub-file.

4. The method for storing and exporting embedded device logs according to claim 1, characterized in that: When writing debugging information into a sub-file, the log management module determines whether the sub-file size has reached the upper limit. If so, a new sub-file is created for writing.

5. The method for storing and exporting embedded device logs according to claim 4, characterized in that: When the log management module writes debugging information into a sub-file, when the size of the sub-file to be written reaches the upper limit, it determines whether the total size of all sub-files reaches the configured threshold. If so, it starts overwriting from the first sub-file.

6. The method for storing and exporting embedded device logs according to claim 1, characterized in that: When copying a sub-file to an external storage device, the sub-file is first compressed, and then the obtained compressed package is copied to the external storage device, and the compressed package is deleted after the copying is completed.

7. An embedded device, characterized in that: The method comprises a processor, a memory and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the method according to any one of claims 1 to 6 when executing the computer program.