Processing method and device

By storing high-level and low-level logs separately in electronic devices and transferring the low-level logs when a fault is triggered, the problem of insufficient fault diagnosis information in the conventional mode is solved, and fast and efficient fault handling is achieved.

CN120994438APending Publication Date: 2025-11-21LENOVO (BEIJING) LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511062530.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-30
Publication Date
2025-11-21

AI Technical Summary

Technical Problem

In the normal mode of electronic devices, storing only high-level logs results in limited fault diagnosis information, making it difficult to obtain high-value logs from before the fault, affecting user experience, and making fault reproduction time-consuming and laborious.

Method used

High-level logs are stored in the first storage space, and low-level logs are stored in the second storage space. In response to a fault trigger command, low-level logs are transferred to the first storage space for use by the processing components, thereby improving fault location and processing efficiency.

Benefits of technology

Without affecting equipment performance, more log information prior to the failure can be obtained, improving the accuracy and efficiency of fault location and reducing the time required to reproduce the fault and user intervention.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120994438A_ABST
    Figure CN120994438A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a processing method. The processing method comprises the steps that log information generated in the running process of electronic equipment is collected; the log information comprises a first log and a second log, and the log level of the first log is higher than that of the second log; storing the first log in a first storage space; at least storing the second log in a second storage space; in response to the target trigger instruction, at least obtaining a second log from the second storage space, and at least storing the second log to the first storage space, so that the target processing component obtains the second log from the first storage space; the target trigger instruction represents that the electronic equipment generates a target operation fault, the target processing component is used for processing the target operation fault based on the target log, and the target log comprises the second log or the second log and the first log.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to, but is not limited to, the field of information technology, and in particular to a processing method and apparatus. Background Technology

[0002] In related technologies, when users use electronic devices, considering the performance of the electronic devices, not all logs generated during the operation of the electronic devices are collected. As a result, in the event of a failure of the electronic device, the more critical logs used to identify and / or repair the failure may be missed, making it difficult to quickly and effectively identify and / or repair the failure based on the logs before the failure occurred. Summary of the Invention

[0003] In view of this, the embodiments of this application provide at least one processing method and apparatus.

[0004] The technical solution of this application embodiment is implemented as follows:

[0005] This application provides a processing method applied to an electronic device, including:

[0006] Collect log information generated during the operation of electronic devices; the log information includes a first log and a second log, with the first log having a higher log level than the second log;

[0007] Store the first log file in the first storage space;

[0008] At least the second log should be stored in the second storage space;

[0009] In response to a target triggering instruction, at least a second log is retrieved from a second storage space and at least the second log is stored in a first storage space, so that the target processing component retrieves the second log from the first storage space; the target triggering instruction indicates that the electronic device has generated a target operational failure, and the target processing component is used to process the target operational failure based on the target log, the target log including: the second log, or the second log and the first log.

[0010] This application provides a processing apparatus applied to an electronic device, comprising:

[0011] The collection module is used to collect log information generated during the operation of electronic devices; the log information includes a first log and a second log, with the first log having a higher log level than the second log.

[0012] The first storage module is used to store the first log into the first storage space;

[0013] The second storage module is used to store the second log into the second storage space;

[0014] A processing module is configured to, in response to a target triggering instruction, retrieve at least a second log from a second storage space and store at least the second log in a first storage space, so that a target processing component retrieves the second log from the first storage space; the target triggering instruction indicates that the electronic device has generated a target operational fault, and the target processing component is configured to process the target operational fault based on the target log, the target log including: the second log, or the second log and the first log.

[0015] It should be understood that the above general description and the following detailed description are merely exemplary and explanatory, and are not intended to limit the technical solutions of this application. Attached Figure Description

[0016] Figure 1 A schematic diagram of the implementation flow of a processing method provided in this application embodiment. Figure 1 ;

[0017] Figure 2 A schematic diagram illustrating a process for filtering logs based on log level, provided as an embodiment of this application;

[0018] Figure 3 This application provides a schematic diagram of a log collection process in a related art.

[0019] Figure 4 A schematic diagram of the implementation flow of a processing method provided in this application embodiment. Figure 2 ;

[0020] Figure 5 This is a schematic diagram of the composition structure of a processing device provided in an embodiment of this application;

[0021] Figure 6 This is a schematic diagram of the composition structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0022] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application are further described in detail below with reference to the accompanying drawings and embodiments. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0023] In the following description, the terms "first / second / third" are used merely to distinguish similar objects and do not represent a specific ordering of the objects. It is understood that "first / second / third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of this application described herein can be implemented in an order other than that illustrated or described herein. Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for descriptive purposes only and is not intended to limit the scope of this application. It should also be noted that, for ease of description, only the parts relevant to the application are shown in the accompanying drawings.

[0024] As programs run on electronic devices, they continuously generate logs. These logs can be stored and retrieved in text format. However, the strategy for storing these logs may differ depending on the electronic device's operating mode. For example, in debug mode, all logs are stored in a diagnostic data collection space to diagnose issues arising from errors or malfunctions in the system or application. Conversely, in non-development phases (e.g., for user use), only a portion of the logs are stored in this diagnostic data collection space.

[0025] Logs can be categorized into low-level logs and high-level logs based on their log level. Log levels indicate the priority or importance of logs. High-level logs are manually set logs of higher importance, while low-level logs are manually set logs of lower importance. High-level logs, due to their high importance, need to be accessible in all scenarios; therefore, they are stored in the diagnostic data collection space in both debug and normal modes. Low-level logs, on the other hand, are less important but more numerous, and can more effectively help developers analyze problems during program development. Therefore, they are stored in the diagnostic data collection space in debug mode. However, to ensure device performance when non-developer users operate the electronic device, low-level logs are not stored when the device is running in normal mode.

[0026] Based on the above log collection methods, the following problems exist:

[0027] 1. In normal mode, the log density for fault diagnosis is low: Because device performance has a higher priority in normal mode, low-level logs are not stored. When electronic devices malfunction, only high-level logs can be obtained, and the information for fault diagnosis is very limited.

[0028] 2. Difficulty in obtaining high-value logs prior to the fault: Logs crucial for fault diagnosis (e.g., logs helpful in identifying the cause of the fault) may not be found solely in high-level logs. However, when electronic devices are operating in normal mode, even with a mechanism that automatically activates debug mode after a fault occurs, the more comprehensive and higher-level logs obtained are those acquired after the fault. The high-value logs, more helpful for fault diagnosis, are likely those obtained before debug mode is activated.

[0029] 3. Potential Impact on User Use of Electronic Devices: Device malfunctions can be caused by various factors, including hardware, software, network, and / or peripherals. Therefore, troubleshooting may require reproducing the environment in which the malfunction occurred, re-performing the tasks performed before the malfunction (e.g., rerunning the program) in debug mode, and obtaining the full-level log, including both high-level and low-level logs. This can impact user access to the electronic device. This is particularly inconvenient when the user only provides logs and cannot provide the device itself, requiring their cooperation to obtain the full-level log.

[0030] 4. Some faults are difficult to reproduce: Because the information in high-level logs is relatively limited, such as records of "entering a module", "exiting a module", "error message records", etc., it takes a long time to reproduce the faults that are more complex.

[0031] 5. Difficulty in locating the problem in hangover scenarios: In the case of hangover, since there may be many possible locations of the fault, it is difficult to accurately locate the hangover location based solely on high-level logs when the electronic equipment is running in normal mode.

[0032] In related technologies, when a user's electronic device malfunctions while operating in normal mode, and the fault cannot be located based on high-level logs obtained prior to the fault, the following measures may be taken:

[0033] 1. Using other electronic devices that have enabled debugging mode, based on the same model, CPU, memory, motherboard, external cards, and network cards as the user's device, configure a similar environment to recreate the user's usage scenario, attempt to reproduce the problem, and collect full-level logs for analysis.

[0034] 2. If the fault cannot be reproduced using other electronic devices, try to reproduce the fault using the user's faulty electronic device with debug mode enabled, and capture new full-level logs for analysis.

[0035] 3. When developing the normal mode, modify the scope of high-level logs in advance (set at least some low-level logs to high-level logs) so that more log information can be obtained when users use electronic devices in normal mode, but at the same time, it will reduce the device performance when users use electronic devices.

[0036] The above solutions are time-consuming and labor-intensive when reproducing faults, and may reduce the performance of electronic devices when users use them. It is difficult to improve the efficiency of fault handling based on the operation logs before the fault while balancing device performance.

[0037] Based on this, embodiments of this application provide a processing method that can be executed by an electronic device. The electronic device refers to a server, laptop computer, tablet computer, desktop computer, smart TV, set-top box, mobile device (e.g., mobile phone, portable video player, personal digital assistant, dedicated messaging device, portable gaming device), or any other device with data processing capabilities. Figure 1 As shown, the processing method includes the following steps S101 to S104:

[0038] Step S101: Collect log information generated during the operation of the electronic device; the log information includes a first log and a second log, with the first log having a higher log level than the second log.

[0039] Here, the log information can correspond to all logs generated during the operation of the electronic device, including high-level logs and low-level logs.

[0040] In related technologies, when electronic devices generate logs corresponding to system programs and applications, these logs are categorized into different levels. Depending on the current operating mode of the electronic device, different levels of logs are stored in the storage space for collecting diagnostic data. For example, during device development, developers need to store all logs for later debugging; however, after the device is delivered to the user and during user operation, only high-level logs are stored to improve the smoothness of user experience.

[0041] For example, such as Figure 2 As shown, after the application generates high-level logs and low-level logs, in normal mode, they need to be filtered by the operating system's log level. High-level logs are written to the storage space for collecting diagnostic data, while low-level logs are filtered and not written to the storage space for collecting diagnostic data.

[0042] In practice, if the operating system corresponds to the Unified Extensible Firmware Interface (UEFI), the application may include an Extensible Firmware Interface (EFI) program.

[0043] Since log levels are usually pre-defined in the operating system, related technologies control the type of logs stored based on the switching of operating modes.

[0044] In some implementations, the operating system's log levels can be categorized from highest to lowest importance as follows: Fatal / Critical, Error, Warning, Info, Debug, and Trace levels, with at least two of these categories. Higher-level logs may include logs corresponding to at least one of the following levels: Fatal / Critical, Error, Warning, and Info. Lower-level logs may include logs corresponding to the Debug and / or Trace levels.

[0045] The first log can be either the aforementioned high-level log or a preset log corresponding to the log level that serves as a high-level log.

[0046] The second log can be either the aforementioned low-level log or a preset log corresponding to the log level that serves as the low-level log.

[0047] For example, logs corresponding to at least one of the following levels, such as emergency level, error level, warning level, and information level, can be used as the first log, and logs corresponding to debug level and / or trace level can be used as the second log.

[0048] For example, logs corresponding to at least one of the following levels, such as emergency level, error level, warning level, information level, and debug level, can be used as the first log, and logs corresponding to the tracing level can be used as the second log.

[0049] In some implementations, log levels can be divided according to processing priority. For example, logs recording fault-related information can be designated as the first log, and logs recording access-related information can be designated as the second log.

[0050] Step S102: Store the first log in the first storage space.

[0051] Here, the first storage space is the storage space used to collect diagnostic data. For example, the first storage space may include, but is not limited to, at least one of the following: a local file system, a cloud database, a log management service, etc.

[0052] For example, it is possible to Figure 2 After passing the high-level logs, the high-level logs are sent to the dedicated management processor (Baseboard Management Controller, BMC) embedded on the server motherboard, and then written to the First Failure Data Capture (FFDC) which serves as the first storage space.

[0053] Step S103: Store the second log in the second storage space at least once.

[0054] Here, the second storage space is a preset storage space that is different from the first storage space.

[0055] In some implementations, a method for storing a second log to a second storage space can be added to the function that collects log information, thereby backing up and storing the second log to the second storage space before the second log is filtered and sorted.

[0056] In some implementations, the second storage space can be memory space. For example, it can be memory space accessible to the central processing unit (CPU), or it can be shared memory space accessible to both the CPU and the BMC.

[0057] In some implementations, only the second log can be stored in the second storage space, or both the first log and the second log can be stored in the second storage space, thereby achieving backup of the first log in the second storage space.

[0058] Step S104: In response to the target triggering instruction, at least the second log is obtained from the second storage space, and at least the second log is stored in the first storage space, so that the target processing component obtains the second log from the first storage space; the target triggering instruction indicates that the electronic device has generated a target operation failure, and the target processing component is used to process the target operation failure based on the target log, the target log including: the second log, or the second log and the first log.

[0059] Here, the target trigger instruction is to trigger the acquisition of logs in the second storage space and store them in the first storage space.

[0060] In some implementations, the target triggering instruction can be an instruction that only retrieves and stores the second log to the first storage space, or it can be an instruction that retrieves and stores both the first log and the second log to the first storage space.

[0061] For example, the target trigger instruction could be an instruction that, after detecting a target malfunction, retrieves all the first and second logs stored in the second storage space and stores them in the first storage space.

[0062] For example, the target trigger instruction can be an instruction that, in response to the collection of error logs of the error level, retrieves all or a preset number of second logs preceding the error log in the second storage space and stores them in the first storage space.

[0063] The target operational failure can be an abnormal operation of the electronic device caused by hardware and / or software malfunctions. For example, it may include, but is not limited to, the operating system failing to run (crashing) or programs failing to run.

[0064] The target processing component is a processing component used to handle target operational failures.

[0065] In some implementations, the target processing component can be an existing processing component in the electronic device, or a processing component running in another electronic device that communicates with the faulty electronic device.

[0066] The target log is the log used by the target processing component to handle target operational failures. It is understandable that when the target log includes a second log, compared to handling target operational failures based solely on the first log, the target processing component can obtain more log information prior to the target operational failure, increasing the possibility of quickly locating the failure and further improving the efficiency and accuracy of handling target operational failures.

[0067] In this embodiment, a first log with a higher priority than the second log is stored in a first storage space, and a second log is stored in a second storage space. In response to a target trigger command, at least the second log in the second storage space is stored in the first storage space. This allows the target processing component to retrieve both the first and second logs from the first storage space after a target operational failure occurs, thereby obtaining more log information generated before the target operational failure corresponding to the target trigger command. This increases the possibility of quickly locating the failure and further improves the efficiency and accuracy of handling target operational failures.

[0068] For example, when the electronic device is operating in normal mode, it is not necessary to store both the second log and the first log in the first storage space. While reducing the occupation of the first storage space and the impact on device performance, the second log, which may be of high value, can be saved for later use.

[0069] In some embodiments, the log level of the first log is higher than the target level, and the above processing method may further include the following step S111:

[0070] Step S111: In response to the collection of the first log of the first level, trigger the target trigger command; the first level is higher than the target level, and the first level indicates that there is a target operation failure.

[0071] Here, the first log level can be one or more, including the first level.

[0072] The target level can be a criterion for determining the classification of collected log information, with the first log including logs at least above the target level.

[0073] For example, the target level can include the debug level mentioned above, and logs with all log levels higher than the debug level can be identified as the first log.

[0074] For example, the target level can include the information level mentioned above, and logs with all of the above log levels higher than the information level can be identified as the first log.

[0075] The first level is the log level used to determine whether there is a target operational failure.

[0076] For example, the first level may include the emergency level mentioned above, and the target trigger command is triggered upon the collection of the first log of the emergency level.

[0077] For example, the first level may include the aforementioned emergency level and / or error level. Upon receiving the first log of the emergency level and / or error level, the target trigger command is triggered.

[0078] In some implementations, in addition to the storage mechanism (storing to the first storage space) included in the processing mechanism of the first log at the first level, a triggering mechanism for the target triggering instruction can be added. That is, a mechanism for judging whether the target operation (such as a write operation, a read operation, etc.) has been successfully executed can be added. In this way, the triggering of the target triggering instruction can be completed based on the first log at the first level without affecting the processing mechanism of other levels of logs.

[0079] In some implementations, when the logs stored in the first storage space are used to handle target operational failures, the level type of the logs that need to be stored can be reduced by setting a first level, thereby reducing the data size of the first logs stored in the first storage space, and further improving device performance while reducing the waste of storage resources.

[0080] For example, when the electronic device is running in normal mode, the number of log levels set to high-level logs can be reduced. Furthermore, by determining whether a first log of the first level exists, it can be determined whether to trigger the retrieval of logs in the second storage space.

[0081] For example, when the electronic device is operating in normal mode and the target operation is determined to have failed, a first-level error log can be generated. Furthermore, in response to the collection of the error log, a second log previously stored in the second storage space can be stored in the first storage space. In this case, it is unnecessary to set the aforementioned information level logs as high-level logs, thus reducing the overall types of high-level logs and further improving the device's performance in normal mode.

[0082] In this embodiment, a target triggering command is triggered in response to the collection of a first log indicating a first-level operational fault in the target. This allows for the determination of whether a target operational fault exists based on whether a first-level log has been collected, improving the immediacy of triggering the target triggering command based on the first log.

[0083] In some embodiments, the electronic device includes a first control component, and step S101 may include step S121:

[0084] Step S121: Collect log information generated during the operation of the electronic device through the first control component.

[0085] Here, the first control component may include a control component running in the electronic device that is capable of collecting log information. Exemplarily, this may include, but is not limited to, system programs and / or applications running in the electronic device.

[0086] For example, after a system program running in an electronic device runs and generates log information, the system program can collect and store the first log in the first storage space and store the second log in the second storage space.

[0087] The step S104 above, which involves obtaining at least the second log from the second storage space and storing at least the second log in the first storage space, may include the following step S122:

[0088] Step S122: Obtain at least the second log from the second storage space through the first control component, and store at least the second log in the first storage space.

[0089] Here, the first control component has at least access to the first storage space, so that after obtaining at least the second log from the second storage space, it can at least store the second log in the first storage space.

[0090] In this embodiment, a first control component is used to collect log information, retrieve at least a second log from a second storage space, and transfer the retrieved second log to a first storage space. This allows for the management of log information generated during electronic device operation through a single control component, improving the uniformity and stability of log management.

[0091] In some embodiments, the electronic device further includes a second control component, and the second storage space includes a target memory space shared by the first control component and the second control component, wherein the first control component and the second control component operate in different environments;

[0092] The above step S104, which involves retrieving at least the second log from the second storage space and storing at least the second log in the first storage space, may further include the following step S131:

[0093] Step S131: If the first control component is unavailable, the second control component shall retrieve at least the second log from the target memory space and store at least the second log in the first storage space.

[0094] Here, the second control component is different from the first control component and is a control component that can access the target memory space.

[0095] In some implementations, the second control component may include system programs and / or application programs running in the electronic device.

[0096] For example, the second control component can be the BMC of the electronic device operated by the first control component. In this case, the operating environment, i.e., the operating location, of the first control component and the second control component is different.

[0097] For example, in the event of an electronic device failure, the host malfunctions abnormally, and the BMC, as a second control component, can operate normally and receive information from the host. When the second log is stored in the target memory space, the BMC can respond to the host's hang event by triggering at least the acquisition of the second log and at least the writing of the second log to the FFDC, which serves as the first storage space.

[0098] In some implementations, if the first control component is unavailable, a third control component can be used to retrieve at least the second log from the target memory space and store at least the second log in the first storage space. The third control component includes system programs and / or application programs running in other electronic devices that communicate with the electronic device running the first control component; the operating environments, i.e., the devices running, of the first and third control components are different.

[0099] For example, the third control component may be a program running on a server that is wired or wirelessly connected to the electronic device running the first control component. In this case, the operating environment, i.e. the operating device, of the first and third control components is different.

[0100] It is understood that the second control component and the third control component have at least access to the first storage space, thereby enabling them to at least retrieve the second log from the target memory space and then store the second log in the first storage space.

[0101] It is understandable that if the first control component is unavailable, the second or third control component can be used to transfer the second log in the target memory space so that the second log can be stored in the first storage space in a timely manner, and then the target processing component can be used to handle the target's operational failure.

[0102] In this embodiment, the second storage space includes a target memory space shared by the first control component and the second control component of the electronic device. The first and second control components operate in different environments. In the event that the first control component is unavailable, the second control component retrieves at least a second log from the target memory space and stores it in the first storage space. This allows the second control component to retrieve and transfer the second log even when the first control component malfunctions, increasing the likelihood that the first storage space contains high-value logs from before the target operational failure. Consequently, the target processing component can then promptly address the target operational failure based on the target logs.

[0103] In some embodiments, the electronic device runs a target program, and step S101 may include steps S141 to S142:

[0104] Step S141: Obtain the running log of the target program.

[0105] Here, the target program may include system programs and / or applications running in an electronic device.

[0106] The runtime log is the log generated when the target program runs.

[0107] Step S142: Classify the running logs by level to obtain the first log and the second log.

[0108] Here, there is no need to switch the operating mode of the electronic device. The acquired operating logs can be classified to determine the first log and the second log to be stored in the first storage space and the second storage space, respectively.

[0109] In some implementations, the target program that generates the runtime logs may set the logs with lower original levels in the acquired runtime logs as the first logs and store them in the first storage space.

[0110] In this embodiment, the running logs of the target program in the electronic device are obtained, and the running logs are classified by level to obtain a first log and a second log. In this way, without changing the core scheme of determining the log storage location based on log level in the conventional mode, the second log can be stored in a second storage space without reducing the performance of the electronic device by classifying the running logs of the target program by log level.

[0111] In some embodiments, the step S104 described above, which involves obtaining at least the second log from the second storage space and storing at least the second log in the first storage space, may further include the following steps S151 to S152:

[0112] Step S151: Filter out the third log from the second log stored in the second storage space.

[0113] Step S152: Store the third log in the first storage space; wherein the third log is determined based on the occurrence time of the target operation failure, the failure type corresponding to the target operation failure, and / or the preset number of logs.

[0114] Here, the third log is the log in the second log stored in the second storage space that meets preset conditions. The preset conditions may include the log type of the third log meeting the log type condition, the generation and / or collection time of the third log meeting the time condition, and / or the number of logs in the third log meeting the log number condition.

[0115] For example, the log type of the third log satisfying the log type condition may include: the log content of the third log corresponding to the fault type of the target operational fault. This improves the adaptability between the third log and the target operational fault, further enhancing the efficiency and accuracy of processing the target operational fault based on the target log, which includes at least the second log.

[0116] For example, the timing conditions for the generation and / or collection of the third log may include: the generation and / or collection time of the third log is earlier than the occurrence time of the target operational failure, or the generation and / or collection time of the third log is earlier than the occurrence time of the target operational failure, and the time interval between the generation and / or collection time of the third log and the occurrence time of the target operational failure is not greater than the target time interval. This improves the timeliness of the third log.

[0117] For example, the log count in the third log may meet the log count condition by being less than the target count. This allows for the control of the number of logs stored in the second storage space, thus saving storage resources.

[0118] It is understandable that combining at least two of the above three conditions can achieve the effects corresponding to each condition.

[0119] In this embodiment, a third log is selected from the second log stored in the second storage space and stored in the first storage space. The third log is determined based on the occurrence time of the target operational failure, the failure type corresponding to the target operational failure, and / or a preset number of logs. This allows for the reduction of the log data size in the second storage space by selecting the third log, saving storage space while improving the efficiency of processing the target operational failure based on the reduced-size target log.

[0120] In some embodiments, the above processing method may further include at least one of the following steps S161 to S162:

[0121] Step S161: In response to the number of second logs stored in the second storage space exceeding the target number, remove the first historical log that was stored in the second storage space the earliest, until the number of second logs stored in the second storage space does not exceed the target number.

[0122] Here, the target number may include a preset maximum threshold for organizing the number of second logs in the second storage space.

[0123] The first historical log is either the second log (excluding the target number at the tail of the sorting queue) or the second log and the first log, sorted from earliest to latest according to the storage time.

[0124] If the number of second logs stored in the second storage space exceeds the target number, removing first historical logs can improve the timeliness of the second logs stored in the second storage space, further improving the efficiency and accuracy of handling target operational faults based on the second logs stored in the second storage space. Furthermore, by controlling the target number, excessive storage space can be avoided, further improving device performance.

[0125] In some implementations, the removal of the first historical log can be accomplished using a first-in-first-out circular linked list.

[0126] Step S162: In response to the existence of a second historical log in the second log stored in the second storage space, the second historical log is removed. The timestamp of the second historical log is earlier than the target failure timestamp corresponding to the current time.

[0127] Here, the target expiration timestamp may include a preset latest timestamp corresponding to the current time.

[0128] In some implementations, a timestamp earlier than the current time and separated from the current time by the target duration can be determined as the target failure timestamp corresponding to the current time.

[0129] It is understandable that by combining the number of targets and the target failure timestamp, the timeliness of the second log stored in the second storage space can be further improved. While saving storage space, this can improve the efficiency and accuracy of handling target operation failures based on the target log.

[0130] In this embodiment, in response to the number of second logs stored in the second storage space exceeding the target number, the earliest first historical log stored in the second storage space is removed until the number of second logs stored in the second storage space does not exceed the target number; and / or, in response to the existence of a second historical log in the second storage space with a timestamp earlier than the target failure timestamp corresponding to the current time, the second historical log is removed. This improves the timeliness of the second logs in the second storage space, further enhancing the efficiency and accuracy of handling target operational failures based on the target logs.

[0131] In some embodiments, the target log includes a second log and a first log, and step S103 above may include the following step S171:

[0132] Step S171: Based on the generation times of the first log and the second log, store the first log and the second log in the second storage space in the target order.

[0133] Here, the order of the targets can include, but is not limited to, from front to back, from back to front, etc.

[0134] For example, the first and second logs can be stored in the second storage space from beginning to end, based on their generation times from early to late.

[0135] For example, based on the generation times of the collected first and second logs from morning to night, newly generated first and second logs can be inserted into the second storage space from back to front.

[0136] The step S104 above, which describes storing at least the second log in the first storage space, may include the following step S172:

[0137] Step S172: Store the first log and the second log in the first storage space in the target order.

[0138] In this embodiment, based on the generation times of the first log and the second log, the first log and the second log are stored in the second storage space in the target order, and in response to the target trigger command, the first log and the second log are stored in the first storage space in the target order. Thus, determining the storage order of the logs according to their generation order improves the efficiency of retrieving the target logs from the first storage space, thereby improving the efficiency of handling target operational faults based on the target logs.

[0139] In some embodiments, step S103 may include at least one of steps S181 to S182:

[0140] Step S181: Modify the format of the second log from the second format to the first format that can be written to the first storage space, and store the modified second log in the first storage space; the format of the first log is the first format.

[0141] Here, the first format and the second format can be the data format of the log.

[0142] By differentiating the first log from the second log using different formats, the accuracy of classifying and storing the first and second logs can be improved without affecting the original storage format and mechanism of the first log.

[0143] Step S182: Store the second log with the added target identifier to the first storage space; the log information stored in the first storage space has a target identifier, and the first log is set with a target identifier.

[0144] Here, the target identifier may include, but is not limited to, features that annotate at least one of the following: log name, content, type, level, etc. For example, the target identifier may be a preset code or characters.

[0145] By distinguishing between the first log and the second log using target identifiers, the accuracy of classifying and storing the first log and the second log can be improved without affecting the original storage identifier and storage mechanism of the first log.

[0146] Understandably, combining log format and target identifier can further improve the accuracy of classifying and storing the first and second logs.

[0147] In this embodiment, the format of the second log is modified from a second format to a first format that can be written to the first storage space, and the modified second log is stored in the first storage space, while the first log is in the first format; and / or, the second log with a target identifier is stored in the first storage space, and the log information stored in the first storage space has a target identifier, while the first log has a target identifier. This improves the accuracy of classifying and storing the first and second logs without affecting the original storage mechanism of the first log.

[0148] In related technologies, such as Figure 3 As shown, for electronic devices where debug mode is not enabled, the log collection mechanism may include the following steps S301 to S313:

[0149] Step S301: Start the program in the electronic device without enabling debug mode.

[0150] Here, the operating program of the electronic device may include the above-mentioned regular mode, or other modes other than debugging mode, such as user-defined mode.

[0151] During implementation, if high-level logs are collected, continue executing step S304.

[0152] Step S302: Program execution.

[0153] During implementation, if high-level logs are collected, continue executing step S304.

[0154] Step S303: A fault occurs.

[0155] Here, the fault can be referred to as the aforementioned target operation fault.

[0156] During implementation, if high-level logs are collected, continue to execute step S304; if a fault occurs, execute step S305.

[0157] Step S304: Write the high-level log to FFDC.

[0158] Step S305: Collect the logs stored in FFDC and send the collected logs to the developer.

[0159] During implementation, logs stored in the FFDC can be collected manually by the user and / or automatically by the user's electronic devices.

[0160] Step S306: The developer determines whether there are valid logs among the collected logs.

[0161] Here, effective logs can be defined as the high-value logs mentioned above that help resolve faults.

[0162] If no valid logs are available or the number of valid logs is insufficient to handle the fault during implementation, step S307 is executed; if valid logs are available, the process ends.

[0163] Step S307: Enable debug mode.

[0164] Step S308: With debug mode enabled, start the program in the electronic device.

[0165] Here, with debug mode enabled, the program running on the electronic device at the time of the malfunction is restarted.

[0166] During implementation, step S310 is continuously executed.

[0167] Step S309: Program execution.

[0168] During implementation, step S310 is continuously executed.

[0169] Step S310: Write the full-level log to FFDC.

[0170] Step S311: Try to reproduce the fault.

[0171] Step S312: Determine if a fault has occurred.

[0172] If a fault occurs during implementation, proceed to step S313; if no fault occurs, return to step S308.

[0173] Step S313: Collect the logs stored in FFDC and send the collected logs to the developer.

[0174] Based on the above mechanism, it is difficult to quickly and effectively obtain high-value logs for troubleshooting, and the process is cumbersome, requiring user cooperation, which will greatly reduce the user's device experience.

[0175] Based on this, embodiments of this application provide a processing method that can be executed by an electronic device for acquiring high-value logs of a target operational failure. For example... Figure 4 As shown, the processing method includes the following steps S401 to S410:

[0176] Step S401: Start the program in the electronic device without enabling debug mode.

[0177] During implementation, if high-level logs are collected, continue executing step S404.

[0178] During the execution of step S401, the following step S411 is performed:

[0179] Step S411: Create a circular linked list in the memory space shared with the BMC.

[0180] Here, the memory space shared with BMC can correspond to the second storage space mentioned above, and the circular linked list can correspond to the circular linked list that stores logs using the first-in-first-out method in the above processing method.

[0181] Step S402: Program execution.

[0182] During implementation, if high-level logs are collected, continue executing step S404.

[0183] During step S402, the following step S412 is performed:

[0184] Step S412: Store the data stream in memory space, and retain only the target number of logs.

[0185] During implementation, all logs corresponding to the program and the log levels corresponding to each log can be cached in a memory space A shared with the BMC. A circular linked list is used to control the amount of cached data, and only the latest N logs are retained in a first-in-first-out manner, where N is a natural number.

[0186] Step S403: A fault occurs.

[0187] During implementation, if high-level logs are collected, continue executing step S404.

[0188] Here, after a fault occurs, the fault type is determined, and steps S405 and S407 are executed according to the different types.

[0189] Step S404: Write the high-level log to FFDC.

[0190] Step S405: If an error log is collected, a specific mechanism of the program is triggered.

[0191] Here, the specific mechanism of the program may include, as described in the above processing method, triggering the target trigger instruction in response to the collection of the Errorlog.

[0192] Step S406: Obtain the log in the memory space through the program.

[0193] During implementation, the running program can retrieve the latest N log entries in memory space A.

[0194] After executing step S406, proceed to step S409.

[0195] Step S407: In the event of a system crash, a specific mechanism of the BMC is triggered.

[0196] Here, a specific mechanism of BMC may include, in the above processing method, obtaining at least the second log of the second storage space through the second control component in response to the first control component being unavailable.

[0197] Step S408: Obtain the log in the memory space through BMC.

[0198] Step S409: Write the latest N log entries as high-level logs to FFDC.

[0199] Step S410: Collect the logs stored in FFDC and send the collected logs to the developer.

[0200] High-value logs generated before the failure occurred have been stored in FFDC.

[0201] In this embodiment, there is no need to modify the original mechanism for filtering and writing logs to the FFDC. By allocating memory space shared with the BMC, backup storage of logs that were not originally written to the FFDC is achieved. This has several advantages: First, it allows for the acquisition of more high-value logs prior to the fault, improving fault handling efficiency. Second, it eliminates the need to modify the operating mode of the electronic device, minimizing the impact on device performance. Third, by setting different handling mechanisms for different types of faults, it enables the writing of all levels of logs prior to the fault to the FFDC even in the event of a system crash, eliminating the need to reproduce or retrieve all levels of logs, thus saving time and device resources for subsequent fault handling. Fourth, by determining whether to trigger the retrieval of logs in the shared content space based on the Errorlog, overall log output is reduced, further improving device performance.

[0202] This application provides a processing device, such as... Figure 5 As shown, the processing apparatus 500 includes:

[0203] The collection module 510 is used to collect log information generated during the operation of the electronic device; the log information includes a first log and a second log, wherein the log level of the first log is higher than the log level of the second log;

[0204] The first storage module 520 is used to store the first log into the first storage space;

[0205] The second storage module 530 is used to store at least the second log in the second storage space;

[0206] Processing module 540 is configured to, in response to a target triggering instruction, at least retrieve the second log from the second storage space and at least store the second log in the first storage space, so that a target processing component retrieves the second log from the first storage space; the target triggering instruction indicates that the electronic device has generated a target operational fault, and the target processing component is configured to process the target operational fault based on the target log, wherein the target log includes: the second log, or the second log and the first log.

[0207] In some embodiments, the log level of the first log is higher than the target level, and the processing module can also be used to: trigger the target triggering instruction in response to the collection of the first log at the first level; the first level is higher than the target level, and the first level indicates that there is a target operation failure.

[0208] In some embodiments, the electronic device includes a first control component, and the collection module can also be used to: collect the log information generated during the operation of the electronic device through the first control component;

[0209] The processing module can also be used to: obtain at least the second log from the second storage space through the first control component, and store at least the second log in the first storage space.

[0210] In some embodiments, the electronic device further includes a second control component, the second storage space including a target memory space shared by the first control component and the second control component, the first control component and the second control component having different operating environments; the processing module can also be used to: when the first control component is unavailable, obtain at least the second log from the target memory space through the second control component, and store at least the second log in the first storage space.

[0211] In some embodiments, the electronic device runs a target program, and the collection module can also be used to: obtain the running log of the target program; classify the running log by level to obtain the first log and the second log.

[0212] In some embodiments, the processing module may further be used to: filter out a third log from the second log stored in the second storage space; and store the third log in the first storage space; wherein the third log is determined based on the occurrence time of the target operational failure, the failure type corresponding to the target operational failure, and / or a preset number of logs.

[0213] In some embodiments, the processing module can also be used to: in response to the number of the second logs stored in the second storage space exceeding a target number, remove the first historical log that was stored in the second storage space earliest, until the number of the second logs stored in the second storage space does not exceed the target number; in response to the existence of a second historical log in the second logs stored in the second storage space, remove the second historical log, wherein the timestamp of the second historical log is earlier than the target expiration timestamp corresponding to the current time.

[0214] In some embodiments, the target log includes the second log and the first log, and the second storage module can also be used to: store the first log and the second log in the second storage space in a target order based on the generation time of the first log and the second log;

[0215] The processing module can also be used to: store the first log and the second log into the first storage space in the target order.

[0216] In some embodiments, the processing module may also be used for at least one of the following: modifying the format of the second log from a second format to a first format that can be written to the first storage space, and storing the modified second log in the first storage space; the format of the first log is the first format; storing the second log with the added target identifier in the first storage space; the log information stored in the first storage space has the target identifier, and the first log is set with the target identifier.

[0217] This application provides an electronic device, including a memory and a processor. For example... Figure 6 As shown, the electronic device 600 includes:

[0218] Memory 610 is used to store computer programs that can run on processor 620;

[0219] The processor 620 is used to execute the program stored in the memory 610 to implement the processing method applied to the processing device described above.

[0220] This application provides a computer program including computer-readable code. When the computer-readable code is run in a computer device, the processor in the computer device executes some or all of the steps in the above-described processing method.

[0221] This application provides a computer program product, including a computer program or instructions, which, when executed by a processor, implement some or all of the steps in the above-described processing method.

[0222] This application provides a computer-readable storage medium storing a computer program that can be executed by a processor to implement the above-described processing method.

[0223] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus, and electronic devices according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0224] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0225] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0226] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

[0227] The descriptions of the above device embodiments are similar to those of the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.

[0228] It should be understood that the phrase "one embodiment" or "an embodiment" throughout the specification means that a specific feature, structure, or characteristic related to the embodiment is included in at least one embodiment of this application. Therefore, "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. Furthermore, these specific features, structures, or characteristics can be combined in any suitable manner in one or more embodiments. It should be understood that in the various embodiments of this application, the sequence numbers of the above-described processes do not imply a sequential 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 this application. The sequence numbers of the above-described embodiments are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0229] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0230] In the several embodiments provided in this application, it should be understood that the disclosed devices and methods can be implemented in other ways. The device embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods, such as: multiple units or components can be combined, or integrated into another system, or some features can be ignored or not executed. In addition, the coupling, direct coupling, or communication connection between the various components shown or discussed can be through some interfaces, and the indirect coupling or communication connection between devices or units can be electrical, mechanical, or other forms.

[0231] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units. They may be located in one place or distributed across multiple network units. Some or all of the units may be selected to achieve the purpose of this embodiment according to actual needs.

[0232] In addition, each functional unit in the various embodiments of this application can be integrated into one processing unit, or each unit can be a separate unit, or two or more units can be integrated into one unit; the integrated unit can be implemented in hardware or in the form of hardware plus software functional units.

[0233] Those skilled in the art will understand that all or part of the steps of the above method embodiments can be implemented by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it performs the steps of the above method embodiments. The aforementioned storage medium includes various media that can store program code, such as mobile storage devices, read-only memory (ROM), magnetic disks, or optical disks.

[0234] Alternatively, if the integrated units described above are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solutions of the embodiments of this application, or the parts that contribute to related technologies, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as mobile storage devices, ROMs, magnetic disks, or optical disks.

[0235] The above description is merely an embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.

Claims

1. A processing method applied to an electronic device, comprising: Collect log information generated during the operation of the electronic device; The log information includes a first log and a second log, wherein the log level of the first log is higher than the log level of the second log; Store the first log in the first storage space; At least the second log should be stored in the second storage space; In response to a target trigger command, at least the second log is retrieved from the second storage space, and at least the second log is stored in the first storage space, so that the target processing component retrieves the second log from the first storage space; The target triggering instruction indicates that the electronic device has generated a target operational fault, and the target processing component is used to process the target operational fault based on the target log, the target log including: the second log, or the second log and the first log.

2. The method according to claim 1, wherein the log level of the first log is higher than the target level; The method further includes: In response to the collection of the first log at the first level, the target trigger command is triggered; The first level is higher than the target level, and the first level indicates that there is a fault in the operation of the target.

3. The method according to claim 1, wherein the electronic device includes a first control component; The collection of log information generated during the operation of the electronic device includes: The first control component collects the log information generated during the operation of the electronic device. The step of retrieving at least the second log from the second storage space and storing at least the second log in the first storage space includes: The first control component retrieves at least the second log from the second storage space and stores at least the second log in the first storage space.

4. The method according to claim 3, wherein the electronic device further comprises a second control component, the second storage space comprising a target memory space shared by the first control component and the second control component, and the first control component and the second control component operate in different environments; The step of obtaining at least the second log from the second storage space and storing at least the second log in the first storage space further includes: If the first control component is unavailable, the second control component shall retrieve at least the second log from the target memory space and store at least the second log in the first storage space.

5. The method according to claim 1, wherein the electronic device runs a target program, and the step of collecting log information generated during the operation of the electronic device includes: Obtain the runtime log of the target program; The operation logs are classified by level to obtain the first log and the second log.

6. The method according to claim 1, wherein obtaining at least the second log from the second storage space and storing at least the second log in the first storage space comprises: The third log is selected from the second log stored in the second storage space; Store the third log in the first storage space; The third log is determined based on the occurrence time of the target operational failure, the failure type corresponding to the target operational failure, and / or a preset number of logs.

7. The method of claim 1, further comprising at least one of the following: In response to the number of the second logs stored in the second storage space exceeding the target number, the first historical log with the earliest entry time in the second storage space is removed until the number of the second logs stored in the second storage space does not exceed the target number; In response to the existence of a second historical log in the second log stored in the second storage space, the second historical log is removed, wherein the timestamp of the second historical log is earlier than the target expiration timestamp corresponding to the current time.

8. The method according to any one of claims 1 to 7, wherein the target log includes the second log and the first log, and the step of storing at least the second log in the second storage space includes: Based on the generation times of the first log and the second log, the first log and the second log are stored in the second storage space in the target order; The step of storing at least the second log in the first storage space includes: The first log and the second log are stored in the first storage space in the order described in the target sequence.

9. The method according to any one of claims 1 to 7, wherein storing at least the second log in the first storage space comprises at least one of the following: The format of the second log is modified from the second format to a first format that can be written to the first storage space, and the modified second log is stored in the first storage space; The format of the first log is the first format; The second log, after adding the target identifier, is stored in the first storage space; The log information stored in the first storage space has the target identifier, and the first log is set with the target identifier.

10. A processing apparatus applied to an electronic device, comprising: The collection module is used to collect log information generated during the operation of the electronic device; The log information includes a first log and a second log, wherein the log level of the first log is higher than the log level of the second log; The first storage module is used to store the first log into the first storage space; The second storage module is used to store the second log into the second storage space; A processing module is configured to, in response to a target triggering command, at least retrieve the second log from the second storage space and at least store the second log in the first storage space, so that the target processing component retrieves the second log from the first storage space; The target triggering instruction indicates that the electronic device has generated a target operational fault, and the target processing component is used to process the target operational fault based on the target log, the target log including: the second log, or the second log and the first log.