System exception log data storage method and device
By detecting abnormal flag bits and saving log data when the car system is abnormal, it solves the problem of data loss in abnormal situations with traditional storage methods, achieves timely storage and accurate diagnosis of log data, and improves the efficiency of troubleshooting and system recovery.
Patent Information
- Application Number
- CN202410811892.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-09-17
AI Technical Summary
When the automotive system encounters an abnormal situation, the traditional log data storage method cannot work properly, resulting in the loss of key abnormal log data and affecting the efficiency of troubleshooting and system recovery.
By detecting whether there is an abnormal flag bit in the system, if it exists, it is judged whether there is storage space in the first partition in the memory, obtaining and saving the abnormal log data to the reserved memory space, and writing it from the reserved memory space to the first partition in the memory. , clear the flag bit and initialize the memory space to ensure that log data is stored in time under abnormal circumstances.
When the automobile system is abnormal, log data can be stored in time to help technicians accurately diagnose problems, improve the efficiency of troubleshooting and system recovery, and enhance the robustness and recoverability of the system.
Smart Images

Figure CN118656354A
Abstract
Description
Technical Field
[0001] The disclosed embodiments relate to the field of automobile control technology, and more particularly to a method and device for storing log data of system abnormalities. Background Art
[0002] In the key domain control system of the car, the recording of log data is crucial for system operation status, fault detection and problem analysis. Usually, the system generates log data in real time, where the content recorded in the log data includes key information such as sensor data, system status, error information and user operations.
[0003] Currently, the recording of log data usually relies on stable storage. In the electronic control unit of the car, the log data is generally stored on non-volatile storage media, such as hard disk or solid-state drive. This method is very effective when the system is running normally, because it can provide detailed log data for subsequent analysis.
[0004] However, when the automotive system encounters abnormal conditions, such as serious software errors, hardware failures, or power problems, the memory may become unstable or inaccessible. In these cases, traditional logging methods will not work properly, resulting in the loss of critical abnormal log data. The inability to read and analyze these log data makes it difficult for technicians to accurately diagnose the problem, thus affecting the efficiency of troubleshooting and system recovery.
[0005] Therefore, there is an urgent need for a system abnormality log data storage method that can store log data in a timely manner when the automobile system encounters an abnormal situation, so that technicians can accurately diagnose the problem and improve the efficiency of troubleshooting and system recovery. Summary of the invention
[0006] In order to solve the above technical problem or at least partially solve the above technical problem, the embodiments of the present disclosure provide a method and device for storing log data of system abnormalities.
[0007] A first aspect of an embodiment of the present disclosure provides a method for storing log data of system abnormalities, including:
[0008] If it is detected that the system is in the startup state, the boot program is started, and based on the boot program, whether there is an abnormal flag bit is detected; wherein the abnormal flag bit is used to indicate that the system is in an abnormal state before being in the startup state;
[0009] If the abnormal flag bit exists, it is determined whether there is storage space in the first partition of the memory; wherein the memory is used to store log data; the log data is a file generated during the operation of the system;
[0010] If so, abnormal log data is obtained based on the boot program, and the abnormal log data is saved in the first partition in the memory; wherein the log data includes the abnormal log data; the abnormal log data is the log data generated when the system is in an abnormal state.
[0011] In one example, the step of saving the abnormal log data to a first partition in the memory includes:
[0012] Based on the boot program, the abnormal log data is saved in a reserved memory space;
[0013] Based on the boot program, the abnormal log data is written from the reserved memory space into the first partition in the memory.
[0014] In one example, after saving the abnormal log data in the first partition in the memory, the method further includes:
[0015] Based on the boot program, the abnormal flag is cleared and the reserved memory space is initialized.
[0016] In one example, after detecting whether there is an abnormal flag bit based on the boot program, the method further includes:
[0017] If the abnormal flag does not exist, the reserved memory space is initialized based on the boot program.
[0018] In one example, after reserving memory space based on the boot program initialization, the method further includes:
[0019] The system is controlled to be in a restart state.
[0020] In one example, the method further includes:
[0021] If it is detected that the system is in an abnormal state, the abnormal flag bit is added, and the system is controlled to be in a startup state again.
[0022] In one example, the method further includes:
[0023] If it is detected that the system is in the startup state, determining whether the abnormal log data exists in the first partition in the memory;
[0024] If yes, backing up the abnormal log data to the second partition in the memory, clearing the abnormal log data in the first partition, and controlling the system to run normally;
[0025] If not, the system is controlled to operate normally.
[0026] In one example, the method further includes:
[0027] In response to a first retrieving operation, the abnormal log data is retrieved from the second partition to a server or other hardware device; wherein the first retrieving operation is used to represent the retrieving of the abnormal log data.
[0028] In one example, after determining whether there is storage space in the first partition in the memory, the method further includes:
[0029] If not, clear the abnormal flag bit and initialize the reserved memory space.
[0030] In one example, after clearing the exception flag bit and initializing the reserved memory space, the method further includes:
[0031] In response to a second retrieving operation, the abnormal log data is retrieved from the first partition to other hardware devices; wherein the second retrieving operation is used to represent the retrieving of the abnormal log data.
[0032] A second aspect of an embodiment of the present disclosure provides a system abnormality log data storage device, the device comprising:
[0033] A startup module, configured to start a boot program if it is detected that the system is in a startup state, and detect whether there is an abnormal flag bit based on the boot program; wherein the abnormal flag bit is used to indicate that the system is in an abnormal state before being in the startup state;
[0034] A judgment module, used for judging whether there is storage space in the first partition of the memory if the abnormal flag bit exists; wherein the memory is used to store log data; the log data is a file generated during the operation of the system;
[0035] A saving module is used to obtain abnormal log data based on the boot program and save the abnormal log data to the first partition in the memory; wherein the log data includes the abnormal log data; the abnormal log data is the log data generated when the system is in an abnormal state.
[0036] In one example, a save module includes:
[0037] A saving submodule, used for saving the abnormal log data into a reserved memory space based on the boot program;
[0038] A writing submodule is used to write the abnormal log data from the reserved memory space into the first partition in the memory based on the boot program.
[0039] In one example, the apparatus further comprises:
[0040] The first clearing module is used to clear the abnormal flag bit and initialize the reserved memory space based on the boot program.
[0041] In one example, the apparatus further comprises:
[0042] An initialization module is used to initialize the reserved memory space based on the boot program if the abnormal flag bit does not exist.
[0043] In one example, the apparatus further comprises:
[0044] The control module is used to control the system to restart.
[0045] In one example, the apparatus further comprises:
[0046] The adding module is used to add the abnormal flag bit if it is detected that the system is in an abnormal state, and re-control the system to be in a startup state.
[0047] In one example, the apparatus further comprises:
[0048] A detection module, configured to determine whether the abnormal log data exists in the first partition in the memory if it is detected that the system is in a startup state;
[0049] If yes, backing up the abnormal log data to the second partition in the memory, clearing the abnormal log data in the first partition, and controlling the system to run normally;
[0050] If not, the system is controlled to operate normally.
[0051] In one example, the apparatus further comprises:
[0052] The first retrieving module is used to retrieve the abnormal log data from the second partition to a server or other hardware device in response to a first retrieving operation; wherein the first retrieving operation is used to represent the retrieving of the abnormal log data.
[0053] In one example, the apparatus further comprises:
[0054] The second clearing module is used for clearing the abnormal flag bit and initializing the reserved memory space after judging whether there is storage space in the first partition of the memory, if not.
[0055] In one example, the apparatus further comprises:
[0056] The second calling module is used to call the exception log data from the first partition to other hardware devices in response to a second calling operation after clearing the exception flag and initializing the reserved memory space; wherein the second calling operation is used to represent the calling of the exception log data.
[0057] A third aspect of an embodiment of the present disclosure provides an electronic device, comprising: a processor and a memory, wherein a computer program is stored in the memory, and when the computer program is executed by the processor, the processor executes the method of the first aspect above.
[0058] A fourth aspect of an embodiment of the present disclosure provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method of the first aspect described above can be implemented.
[0059] The disclosed embodiment provides a method for storing log data of system abnormalities, the method comprising: if it is detected that the system is in a startup state, then starting the boot program, and detecting whether there is an abnormal flag bit based on the boot program; wherein the abnormal flag bit is used to indicate that the system is in an abnormal state before being in the startup state; if the abnormal flag bit exists, then judging whether there is storage space in the first partition of the memory; wherein the memory is used to store log data; the log data is a file generated during the operation of the system; if so, obtaining abnormal log data based on the boot program, and saving the abnormal log data to the first partition of the memory; wherein the log data includes the abnormal log data; the abnormal log data is the log data generated when the system is in an abnormal state. By adopting this technical solution, log data can be stored in time when the automobile system encounters an abnormal situation, so that technicians can accurately diagnose the problem and improve the efficiency of troubleshooting and system recovery. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.
[0061] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0062] Figure 1 is a schematic diagram of a system architecture provided by an embodiment of the present disclosure;
[0063] Figure 2 This is a schematic diagram of a structure for storing log data when a system is operating normally, provided by an embodiment of the present disclosure;
[0064] Figure 3 is a structural diagram of a system under abnormal conditions provided by an embodiment of the present disclosure;
[0065] Figure 4 It is a flowchart of a method for storing log data of system abnormality provided by an embodiment of the present disclosure;
[0066] Figure 5 It is a flowchart of another method for storing log data of system abnormality provided by an embodiment of the present disclosure;
[0067] Figure 6 It is a structural diagram of abnormal log data writing provided by an embodiment of the present disclosure;
[0068] Figure 7 It is a structural diagram of a log data storage device for system abnormality provided by an embodiment of the present disclosure;
[0069] Figure 8 It is a structural schematic diagram of an electronic device in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0070] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.
[0071] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.
[0072] Figure 1It is a schematic diagram of a system architecture provided by an embodiment of the present disclosure. It can be seen from the figure that the system 10 includes: a power management chip 101 (Power Management Integrated Circuit, referred to as PMIC), a static random access memory 102 (Dynamic Random Access Memory, referred to as DRAM), a microcontroller unit 103 (Microcontroller, referred to as MCU), a system-level chip 104 (System on chip, referred to as SOC) and a non-volatile storage medium 105. Among them, the power management chip 101 is used to supply power to various hardware modules of the system. Static random access memory 102 generally refers to memory, which is a type of volatile memory. The microcontroller unit 103 is an integrated circuit that integrates a microprocessor, memory, input / output interface and other functional modules on a chip to perform specific control functions. It is mainly used here to monitor and control the system-level chip. The system-level chip 104 usually includes multiple integrated circuit cores and an advanced reduced instruction set machine core. The non-volatile storage medium 105 can be a non-volatile storage medium such as NOR-Flash, eMMC, UFS, etc. Among them, Figure 1 The static random access memory 102 is a reserved memory space, and the non-volatile storage medium 105 is a memory.
[0073] Figure 2 This is a schematic diagram of a structure for storing log data when a system is operating normally, provided by an embodiment of the present disclosure. Figure 2 As can be seen, when the system is operating normally, log data will continue to be generated and sent to the storage. Then, when the log data needs to be viewed, it can be obtained from the storage through the server or offline.
[0074] Figure 3 Schematic diagram of a structure under abnormal conditions of a system provided by an embodiment of the present disclosure. Figure 3 It can be seen that an exception occurs during system startup or operation, and the system attempts to save the log data to the memory, but because the system has not started normally or the system has a serious exception, the log data cannot be saved to the memory.
[0075] To solve Figure 3 In the case shown in FIG. 1 , the present disclosure provides a method for storing log data of system abnormalities. For details, see Figure 4 The flowchart of a method for storing log data of system abnormalities is shown in FIG. The method can be performed by an electronic device. The electronic device can be exemplarily understood as a device such as a mobile phone, a tablet computer, a laptop computer, a desktop computer, a smart TV, etc. Figure 4As shown, the method provided in this embodiment includes the following steps:
[0076] S401. If it is detected that the system is in a startup state, start the boot program, and detect whether there is an abnormal flag bit based on the boot program; wherein the abnormal flag bit is used to indicate that the system is in an abnormal state before being in the startup state.
[0077] In an example, the state of the system may be a startup state, a shutdown state, an abnormal state, and a normal operation state. The startup state may be a state where the system is restarted after being in an abnormal state, or a startup state where the system is switched from a shutdown state.
[0078] In one example, the boot program may be a Bootloader. When the system is detected to be in a startup state, the boot program is called, and then the boot program is used to determine whether there is an abnormal flag bit. The abnormal flag bit may be a symbol of a preset number of bits, for example, the abnormal flag bit may be 1. The advantage of such a setting is that it is based on the integration and automatic processing of the Bootloader, which can reduce the need for manual intervention and simplify the maintenance and operation process.
[0079] S402: If an abnormal flag bit exists, determine whether there is storage space in the first partition of the memory; wherein the memory is used to store log data; and the log data is a file generated during the operation of the system.
[0080] In one example, if there is an abnormal flag bit, it means that the current system startup is due to the abnormal state last time, which led to the restart. The memory is used to store log data; the log data is a file generated during the operation of the system. The first partition in the memory is used to store abnormal log data when the system runs abnormally. Optionally, first determine whether the first partition in the memory can continue to store abnormal log data. The advantage of this setting is that it is more cost-effective to implement it through software improvement compared to data protection solutions that require additional hardware support.
[0081] S403: If yes, obtain abnormal log data based on the boot program, and save the abnormal log data to the first partition in the memory; wherein the log data includes abnormal log data; the abnormal log data is log data generated when the system is in an abnormal state.
[0082] In one example, if yes, the abnormal log data is obtained through the boot program, and the obtained abnormal log data is saved in the first partition in the memory.
[0083] Optionally, the log data includes abnormal log data; the abnormal log data is log data generated when the system is in an abnormal state.
[0084] The disclosed embodiment provides a method for storing log data of system abnormalities, the method comprising: if it is detected that the system is in a startup state, then starting the boot program, and detecting whether there is an abnormal flag bit based on the boot program; wherein the abnormal flag bit is used to indicate that the system is in an abnormal state before being in the startup state; if there is an abnormal flag bit, then judging whether there is storage space in the first partition of the memory; wherein the memory is used to store log data; the log data is a file generated during the operation of the system; if so, obtaining abnormal log data based on the boot program, and saving the abnormal log data to the first partition of the memory; wherein the log data includes abnormal log data; the abnormal log data is log data generated when the system is in an abnormal state. By adopting this technical solution, when the automobile system encounters an abnormal situation, the log data can be stored in time, so that the technicians can accurately diagnose the problem and improve the efficiency of troubleshooting and system recovery.
[0085] Figure 5 The flowchart of another method for storing log data of system abnormalities provided by the embodiment of the present disclosure is shown. The embodiment of the present disclosure is optimized on the basis of the above embodiment, and the embodiment of the present disclosure can be combined with various optional solutions in one or more of the above embodiments.
[0086] like Figure 5 As shown, the system abnormal log data storage method may include the following steps:
[0087] S501: If it is detected that the system is in an abnormal state, an abnormal flag is added and the system is re-controlled to be in a startup state.
[0088] In one example, if it is detected that the system is in an abnormal state, an abnormal flag bit is set, wherein the abnormal flag bit may be 1, and then the system is re-controlled to be in a startup state.
[0089] Specifically, the MCU detects that the SOC is abnormal, and the SOC has been communicating with the MCU before, then the MCU sets an abnormal flag bit, and restarts the SOC through the MCU alone, so that the SOC is in a startup state.
[0090] S502: If it is detected that the system is in the startup state, the boot program is started, and based on the boot program, whether there is an abnormal flag bit is detected; wherein the abnormal flag bit is used to indicate that the system is in an abnormal state before being in the startup state.
[0091] Optionally, this step can refer to the explanation part of step S401 and will not be repeated here.
[0092] S503: If an abnormal flag bit exists, determine whether there is storage space in the first partition of the memory; wherein the memory is used to store log data; and the log data is a file generated during the operation of the system.
[0093] Optionally, this step can refer to the explanation part of step S402 and will not be repeated here.
[0094] S504: If yes, obtain abnormal log data based on the boot program.
[0095] Optionally, this step can refer to the explanation part of step S403 and will not be repeated here.
[0096] S505: Based on the boot program, save the abnormal log data into the reserved memory space.
[0097] Optionally, the reserved memory can be Figure 1 The static random access memory in the system saves the abnormal log data to the reserved memory space based on the boot program. The advantage of this setting is that when the system is abnormal, the abnormal log data is not directly written into the memory that may be unstable, but first cached into a specially designed reserved memory space. This reserved memory space is designed to maintain data integrity when the system crashes.
[0098] S506. Based on the boot program, write the abnormal log data from the reserved memory space into the first partition in the memory; wherein the log data includes abnormal log data; the abnormal log data is log data generated when the system is in an abnormal state.
[0099] Optionally, based on the boot program, the abnormal log data is written from the reserved memory space into the first partition in the memory. Figure 6 A structural schematic diagram of abnormal log data writing is shown.
[0100] S507: Based on the boot program, clear the abnormal flag bit and initialize the reserved memory space.
[0101] Optionally, after the abnormal log data is stored, it means that the abnormal log data has been processed, and then based on the boot program, the abnormal flag bit can be cleared and the reserved memory space can be initialized so that the reserved memory space can store other data information.
[0102] S508: If there is no abnormal flag bit, the reserved memory space is initialized based on the boot program.
[0103] Optionally, if there is no abnormal flag bit, it means there is no abnormal log data, and the reserved memory space is initialized based on the boot program so that the reserved memory space can store other data information. After this step is performed, step S510 is performed.
[0104] S509: If not, clear the abnormal flag bit and initialize the reserved memory space.
[0105] In one example, this step is parallel to step S504. In this embodiment, if there is no storage space in the first partition of the memory, it means that the previous abnormal log data has not been saved due to insufficient storage space in the first partition. At this time, the abnormal flag is cleared and the reserved memory space is initialized to allow the system to continue to run.
[0106] In one example, after clearing the exception flag bit and initializing the reserved memory space, the method further includes:
[0107] In response to the second calling operation, the abnormal log data is called from the first partition to other hardware devices; wherein the second calling operation is used to represent the calling of the abnormal log data.
[0108] In one example, the second retrieval operation may be performed by an automated script or may be initiated by a user. After receiving the second retrieval operation, the abnormal log data is retrieved from the first partition to other hardware devices, and then the user may obtain the abnormal log data from the other hardware devices.
[0109] S510: The control system is restarted.
[0110] In one example, if it is detected that the system is in a startup state, it is determined whether there is abnormal log data in the first partition in the memory.
[0111] In one example, if it is detected that the system is in a startup state, it is necessary to determine whether there is abnormal log data in the first partition in the memory. If so, it means that the abnormal log data has been stored when the system is in an abnormal state.
[0112] In one example, if yes, the abnormal log data is backed up to the second partition in the memory, the abnormal log data in the first partition is cleared, and the system is controlled to operate normally.
[0113] In one example, if the system is in an abnormal state and the abnormal log data has been stored, the second partition in the memory is used to be called, so the abnormal log data is backed up in the second partition in the memory. Further, the abnormal log data in the first partition is cleared so that the abnormal log data can be stored in the first partition later. After the abnormal log data in the first partition is cleared, the control system operates normally.
[0114] In one example, in response to a first retrieving operation, the abnormal log data is retrieved from the second partition to a server or other hardware device; wherein the first retrieving operation is used to characterize the retrieving of the abnormal log data.
[0115] In one example, the first retrieval operation may be performed by an automated script or may be initiated by a user. After receiving the first retrieval operation, the abnormal log data is retrieved from the second partition to a server or other hardware device, and then the user may obtain the abnormal log data from the server or other hardware device. Retrieving to other hardware devices represents that the abnormal log data is retrieved in an offline manner.
[0116] In one example, if not, the control system operates normally.
[0117] In one example, if there is no abnormal log data in the first partition in the memory, it means that the system has been in a normal operating state, and the control system operates normally.
[0118] The disclosed embodiment provides a method for storing log data of system abnormalities, the method comprising: if it is detected that the system is in a startup state, determining whether there is abnormal log data in the first partition of the memory, and if so, backing up the abnormal log data to the second partition of the memory, clearing the abnormal log data in the first partition, and controlling the normal operation of the system. If not, clear the abnormal flag bit and initialize the reserved memory space. The adoption of this technical solution enhances the robustness of the entire system, and can ensure the integrity and recoverability of key log data even in the face of extreme abnormal situations.
[0119] Figure 7 1 is a schematic diagram of a system abnormality log data storage device provided by an embodiment of the present disclosure. The system abnormality log data storage device can be understood as the above electronic device or a part of the functional modules in the above electronic device. Figure 7 As shown, the abnormal log data storage device 70 of the system includes:
[0120] The startup module 701 is used to start the boot program if it is detected that the system is in the startup state, and detect whether there is an abnormal flag bit based on the boot program; wherein the abnormal flag bit is used to indicate that the system is in an abnormal state before being in the startup state;
[0121] The judgment module 702 is used to judge whether there is storage space in the first partition of the memory if there is an abnormal flag bit; wherein the memory is used to store log data; the log data is a file generated during the operation of the system;
[0122] The saving module 703 is used to obtain abnormal log data based on the boot program and save the abnormal log data to the first partition in the memory; wherein the log data includes abnormal log data; the abnormal log data is the log data generated when the system is in an abnormal state.
[0123] In one example, the saving module 703 includes:
[0124] The saving submodule 7031 is used to save the abnormal log data into the reserved memory space based on the boot program;
[0125] The writing submodule 7032 is used to write the abnormal log data from the reserved memory space into the first partition in the memory based on the boot program.
[0126] In one example, the apparatus 70 further includes:
[0127] The first clearing module 704 is used to clear the abnormal flag bit and initialize the reserved memory space based on the boot program.
[0128] In one example, the apparatus 70 further includes:
[0129] The initialization module 705 is used to initialize the reserved memory space based on the boot program if there is no abnormal flag bit.
[0130] In one example, the apparatus 70 further includes:
[0131] The control module 706 is used to control the system to be in a restart state.
[0132] In one example, the apparatus 70 further includes:
[0133] The adding module 707 is used to add an abnormal flag bit if it is detected that the system is in an abnormal state, and re-control the system to be in a startup state.
[0134] In one example, the apparatus 70 further includes:
[0135] The detection module 708 is used to determine whether there is abnormal log data in the first partition of the memory if it is detected that the system is in the startup state;
[0136] If yes, back up the abnormal log data to the second partition in the memory, clear the abnormal log data in the first partition, and control the normal operation of the system;
[0137] If not, the control system operates normally.
[0138] In one example, the apparatus 70 further includes:
[0139] The first retrieving module 709 is used to retrieve the abnormal log data from the second partition to a server or other hardware device in response to a first retrieving operation; wherein the first retrieving operation is used to represent the retrieving of the abnormal log data.
[0140] In one example, the apparatus 70 further includes:
[0141] The second clearing module 710 is used to determine whether there is storage space in the first partition of the memory, and if not, clear the abnormal flag and initialize the reserved memory space.
[0142] In one example, the apparatus 70 further includes:
[0143] The second calling module 711 is used to call the exception log data from the first partition to other hardware devices in response to the second calling operation after clearing the exception flag and initializing the reserved memory space; wherein the second calling operation is used to represent the calling of the exception log data.
[0144] The device provided in this embodiment can execute the method of any of the above embodiments, and its execution method and beneficial effects are similar, which will not be repeated here.
[0145] An embodiment of the present disclosure further provides an electronic device, which includes: a memory, in which a computer program is stored; and a processor, which is used to execute the computer program. When the computer program is executed by the processor, the method of any of the above embodiments can be implemented.
[0146] For example, Figure 8 Schematic diagram of the structure of an electronic device in the embodiment of the present disclosure. Figure 8 , which shows a schematic diagram of the structure of an electronic device 1000 suitable for implementing the embodiment of the present disclosure. The electronic device 1000 in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0147] like Figure 8 As shown, the electronic device 1000 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 1001, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 1002 or a program loaded from a storage device 1008 into a random access memory (RAM) 1003. In the RAM 1003, various programs and data required for the operation of the electronic device 1000 are also stored. The processing device 1001, the ROM 1002, and the RAM 1003 are connected to each other via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0148] Typically, the following devices may be connected to the I / O interface 1005: an input device 1006 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 1007 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 1008 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 1009. The communication device 1009 may allow the electronic device 1000 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 8 The electronic device 1000 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0149] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 1009, or installed from a storage device 1008, or installed from a ROM 1002. When the computer program is executed by the processing device 1001, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0150] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable storage medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0151] In some embodiments, the client, electronic device can communicate using any currently known or future developed network protocol such as HTTP (HyperText TransferProtocol), and can be interconnected with any form or medium of digital data communication (e.g., communication network). Examples of communication networks include local area networks ("LAN"), wide area networks ("WAN"), internets (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
[0152] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0153] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by the electronic device, the electronic device: if it is detected that the system is in a startup state, then the boot program is started, and based on the boot program, whether there is an abnormal flag bit is detected; wherein the abnormal flag bit is used to indicate that the system is in an abnormal state before it is in the startup state; if the abnormal flag bit exists, it is determined whether there is storage space in the first partition of the memory; wherein the memory is used to store log data; the log data is a file generated during the operation of the system; if so, the abnormal log data is obtained based on the boot program, and the abnormal log data is saved in the first partition of the memory; wherein the log data includes abnormal log data; the abnormal log data is log data generated when the system is in an abnormal state.
[0154] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or electronic device. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0155] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0156] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, wherein the name of a unit does not, in some cases, limit the unit itself.
[0157] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0158] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0159] The embodiments of the present disclosure also provide a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the method of any of the above embodiments can be implemented. The execution method and beneficial effects are similar and will not be repeated here.
[0160] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.
[0161] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method for storing log data of system abnormalities, characterized in that: include: If it is detected that the system is in the startup state, the boot program is started, and based on the boot program, whether there is an abnormal flag bit is detected; wherein the abnormal flag bit is used to indicate that the system is in an abnormal state before being in the startup state; If the abnormal flag bit exists, it is determined whether there is storage space in the first partition of the memory; wherein the memory is used to store log data; the log data is a file generated during the operation of the system; If so, abnormal log data is obtained based on the boot program, and the abnormal log data is saved in the first partition in the memory; wherein the log data includes the abnormal log data; the abnormal log data is the log data generated when the system is in an abnormal state.
2. The method according to claim 1, characterized in that The step of storing the abnormal log data in the first partition of the memory includes: Based on the boot program, the abnormal log data is saved in a reserved memory space; Based on the boot program, the abnormal log file log data is written from the reserved memory space to the first partition in the memory.
3. The method according to claim 2, characterized in that After the abnormal log data is saved in the first partition in the memory, the method further includes: Based on the boot program, the abnormal flag is cleared and the reserved memory space is initialized.
4. The method according to claim 1, characterized in that: After detecting whether there is an abnormal flag bit based on the boot program, the method further includes: If the abnormal flag does not exist, the reserved memory space is initialized based on the boot program.
5. The method according to claim 3 or 4, characterized in that: After reserving memory space based on the boot program initialization, the method further includes: The system is controlled to be in a restart state.
6. The method according to claim 5, characterized in that The method further comprises: If it is detected that the system is in an abnormal state, the abnormal flag bit is added, and the system is controlled to be in a startup state again.
7. The method according to claim 5, characterized in that The method further comprises: If it is detected that the system is in the startup state, determining whether the abnormal log data exists in the first partition in the memory; If yes, backing up the abnormal log data to the second partition in the memory, clearing the abnormal log data in the first partition, and controlling the system to run normally; If not, the system is controlled to operate normally.
8. The method according to claim 7, characterized in that The method further comprises: In response to a first retrieving operation, the abnormal log data is retrieved from the second partition to a server or other hardware device; wherein the first retrieving operation is used to represent the retrieving of the abnormal log data.
9. The method according to claim 1, characterized in that: After determining whether there is storage space in the first partition of the memory, the method further includes: If not, clear the abnormal flag bit and initialize the reserved memory space; After clearing the exception flag bit and initializing the reserved memory space, the method further includes: In response to a second retrieving operation, the abnormal log data is retrieved from the first partition to other hardware devices; wherein the second retrieving operation is used to represent the retrieving of the abnormal log data.
10. A log data storage device for system abnormalities, characterized in that: include: A startup module, configured to start a boot program if it is detected that the system is in a startup state, and detect whether there is an abnormal flag bit based on the boot program; wherein the abnormal flag bit is used to indicate that the system is in an abnormal state before being in the startup state; A judgment module, used for judging whether there is storage space in the first partition of the memory if the abnormal flag bit exists; wherein the memory is used to store log data; the log data is a file generated during the operation of the system; A saving module is used to obtain abnormal log data based on the boot program and save the abnormal log data to the first partition in the memory; wherein the log data includes the abnormal log data; the abnormal log data is the log data generated when the system is in an abnormal state.
Citation Information
Patent Citations
Method and device for obtaining log
CN106250125A
Method for reading log information of Android system
CN110716845A
Log storage method and device in system starting process, storage medium and terminal
CN117075976A
