Log file processing method, electronic equipment, vehicle and computer program product
By identifying the level of vehicle logs and uploading relevant log files to the log cloud platform, the problems of inconvenient acquisition of vehicle logs and insufficient storage space are solved, and the flexibility of problem investigation and the integrity of log files are improved.
Patent Information
- Application Number
- CN202411690017.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-22
- Publication Date
- 2025-02-25
AI Technical Summary
In the prior art, the logs generated by the operation of the vehicle ECU are stored differently, resulting in inconvenient log acquisition, and the vehicle memory is limited, and abnormal logs may be overwritten, so the problem cannot be checked.
By identifying the level of the vehicle log, determine the first level log, and upload N log files related to it (including the current log file and adjacent historical log files) to the log cloud platform.
Overcome the problems of inconvenient log acquisition and insufficient storage space, improve the flexibility of troubleshooting vehicle process problems, and ensure the integrity and stability of log files.
Smart Images

Figure CN119520507A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to a technical field such as data processing, and in particular to a log file processing method, an in-vehicle electronic device, a vehicle, and a computer program product. Background Art
[0002] Currently, the vehicle's ECU (Electronic Control Unit) runs more and more programs, and the logs generated during the program operation are usually stored in the vehicle's local memory without distinction. When it is necessary to use logs to analyze the cause of abnormal operation of the vehicle or program, it is necessary to wake up the vehicle and then obtain the relevant logs from the vehicle's local storage unit for analysis. The existing log storage method is not convenient for obtaining logs at any time. In addition, if the abnormal operation event occurs too early, the logs will be overwritten due to the limited local storage unit of the vehicle. Summary of the invention
[0003] The present disclosure provides a log file processing method, an in-vehicle electronic device, a vehicle, and a computer program product.
[0004] According to one aspect of the present disclosure, a log file processing method is provided, which is applied to a vehicle, and includes: collecting vehicle logs and recording the vehicle logs into log files, wherein the log files are stored in a memory of the vehicle; determining whether the collected vehicle logs are first-level logs, wherein the first-level logs are vehicle logs that record abnormal events; in the case that the collected vehicle logs are first-level logs, determining N log files in the memory, N≥2, the N log files including a current log file that records the first-level log and historical log files that are adjacent to the current log file in time; and uploading the N log files stored in the memory to a log cloud platform, the log cloud platform being used to store the N log files.
[0005] According to the technical solution, the first-level logs are identified when storing vehicle logs, and then N log files associated with the first-level logs are uploaded to the log cloud platform, which overcomes the dependence on the vehicle status when retrieving logs to analyze vehicle process problems and improves the flexibility of troubleshooting vehicle process problems.
[0006] According to at least one embodiment of the log file processing method, determining N log files in the memory includes: searching the memory for a current log file that records the first level log; searching the memory for at least one historical log file that is temporally adjacent to the current log file; and obtaining the N log files including the current log file and at least one of the historical log files.
[0007] According to at least one embodiment of the log file processing method, the N log files stored in the memory are uploaded to the log cloud platform, including: determining the transmission status of each log file in the N log files; and uploading the log files whose transmission status is interrupted and pending to be transmitted to the log cloud platform.
[0008] According to at least one embodiment of the log file processing method, the transmission status of each log file in the N log files is determined, including: obtaining the number of stored bytes of each log file in the log cloud platform; determining the relationship between the number of stored bytes and the total number of bytes of the corresponding log file; and determining the transmission status of the log file whose stored byte number is greater than zero and less than the total number of bytes as an interrupted state, determining the transmission status of the log file whose stored byte number is equal to the total number of bytes as a completed state, and determining the transmission status of the log file whose stored byte number is zero as a pending state.
[0009] According to at least one embodiment of the log file processing method, the log file whose transmission status is an interrupted state and a pending transmission state is uploaded to the log cloud platform, including: when the transmission status of the log file is an interrupted state, using the last byte of the log file stored in the log cloud platform as the breakpoint byte; using the byte of the log file in the memory that is adjacent to the breakpoint byte and located after the breakpoint byte as the first resume transmission byte, and using the part between the first resume transmission byte and the last byte of the log file as the part to be transmitted; and uploading the part to be transmitted to the log cloud platform.
[0010] According to at least one embodiment of the log file processing method, the log file whose transmission status is the interrupted state and the pending state is uploaded to the log cloud platform, including: when the transmission status of the log file is the pending state, the log file is uploaded to the log cloud platform starting from the first byte of the log file.
[0011] According to at least one embodiment of the log file processing method, after determining whether the collected vehicle log is a first-level log, it also includes: if the collected vehicle log is not the first-level log, the log file stored in the memory is not uploaded to the log cloud platform.
[0012] According to at least one embodiment of the log file processing method, after collecting vehicle logs and recording the vehicle logs in log files, it includes: storing the vehicle logs in the memory of the vehicle, the vehicle logs including first-level logs, second-level logs and third-level logs, the second-level logs are vehicle logs that record routine events, and the third-level logs are vehicle logs that record debugging events.
[0013] According to at least one embodiment of the log file processing method, the vehicle log is stored in the memory of the vehicle, including: writing multiple vehicle logs into the log file according to the generation time of the vehicle log; creating a new log file when the total storage space occupied by the multiple vehicle logs reaches the total storage space of the log files; and storing the multiple log files in the memory.
[0014] According to another aspect of the present disclosure, there is provided an in-vehicle electronic device, comprising a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor performs the following processes: collecting vehicle logs and recording the vehicle logs into log files, wherein the log files are stored in the memory; determining whether the collected vehicle logs are first-level logs, wherein the first-level logs are vehicle logs that record abnormal events; in the case that the collected vehicle logs are first-level logs, determining N log files in the memory, N≥2, wherein the N log files include a current log file that records the first-level log and historical log files that are adjacent to the current log file in time; and uploading the N log files stored in the memory to a log cloud platform, wherein the log cloud platform is used to store the N log files.
[0015] According to yet another aspect of the present disclosure, a vehicle is provided, the vehicle comprising the in-vehicle electronic device as described above.
[0016] According to another aspect of the present disclosure, a computer program product is provided. The computer program product includes a computer program. When the computer program is executed by a processor, it is used to implement at least any one of the methods described above. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The accompanying drawings illustrate exemplary embodiments of the present disclosure and together with the description serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.
[0018] Figure 1 It is a schematic diagram of an application scenario of the log file processing method according to an embodiment of the present disclosure.
[0019] Figure 2 It is a schematic interactive diagram of a log file processing method according to an embodiment of the present disclosure.
[0020] Figure 3 It is a schematic flow chart of a log file processing method according to an embodiment of the present disclosure.
[0021] Figure 4It is a schematic diagram of a vehicle log processing process according to an embodiment of the present disclosure.
[0022] Figure 5 It is a schematic diagram of a log file storage process according to an embodiment of the present disclosure.
[0023] Figure 6 The present invention is a flowchart of a log file processing method according to an embodiment of the present invention.
[0024] Figure 7 is a block diagram of an in-vehicle electronic device according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] The present disclosure is further described in detail below in conjunction with the accompanying drawings and examples. It is understood that the specific examples described herein are only used to explain the relevant content, rather than to limit the present disclosure. It should also be noted that, for ease of description, only the parts related to the present disclosure are shown in the accompanying drawings.
[0026] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure can be combined with each other. The technical solution of the present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0027] With the development of technology, the vehicle's on-board control unit (Electronic Control Unit, ECU) needs to run more and more programs. The program running process will be recorded in the form of a log in a log file, where the log file is stored locally in the vehicle, for example, in the memory of the on-board control unit. The content of the log can be the debugging information, routine operation information, potential problems, error information, etc. of the program. Usually, these logs are stored indiscriminately in the vehicle's memory. When it is necessary to use the log to troubleshoot program problems, it is necessary to wake up the vehicle and then obtain the log recording the error information from the vehicle's memory. The vehicle's memory described here can be the memory in the domain controller, or the memory of each on-board control unit, or the memory of the central processing unit, and it can also be a memory in the vehicle specifically used to store log files. Therefore, when troubleshooting vehicle problems, it is necessary to first wake up the vehicle and then obtain the log file from the vehicle's memory, which makes it inconvenient to obtain the log file. In addition, the storage space of the vehicle's memory is limited. If the problem occurred a long time ago, the log file recording the problem may be overwritten by the new log file, resulting in the inability to troubleshoot related problems.
[0028] To this end, the present disclosure proposes the following technical solution, in which an efficient log transmission method is provided, the corresponding log file is uploaded in time when a problem log appears, and further improvements are made in terms of improving transmission efficiency and reducing transmission traffic.
[0029] Figure 1 Schematic diagram of an application scenario of the log file processing method according to an embodiment of the present disclosure. Figure 1 As shown, it includes a vehicle 100 and a log cloud platform 110. The vehicle 100 may include multiple on-board control units, and the on-board control units may be a central processing unit, a domain controller, and other on-board control units. The operation process of the on-board control unit will be recorded in the vehicle log file. For example, the on-board control unit will generate a process in the process of running the program, and generate process-related logs, which are stored in the vehicle's memory in the form of log files. The log cloud platform 110 and the vehicle 100 are connected via a wireless network for data transmission, etc.
[0030] The vehicle log generated by the vehicle 100 is written into the memory of the vehicle 100. In the vehicle, the levels of these vehicle logs are determined, and the first-level logs recording error information are screened out. Then, the vehicle 100 uploads the first-level logs and N log files related thereto to the log cloud platform 110. The log cloud platform 110 can be used to centralize log data for unified management and query, etc. The log cloud platform 110 can be deployed in a cloud server, or it can be a separate cloud server, etc.
[0031] Through the interaction between the vehicle 100 and the log cloud platform 110, the first-level logs in the logs generated by the vehicle can be discovered in a timely manner and written to the log cloud platform. When troubleshooting, the first-level logs and related log files are directly retrieved from the log cloud platform without waking up the vehicle. In this way, the randomness and convenience of log retrieval are improved; it also avoids the problem of previous logs being overwritten and unable to be retrieved due to insufficient storage space in the vehicle's built-in memory, ensuring the stability of problem troubleshooting and vehicle safety.
[0032] For the convenience of description and to make the technical solutions of the specific implementation methods of the present disclosure easier to understand, before describing the specific solutions of the present disclosure, the technical terms involved in the present disclosure are first explained as follows.
[0033] First level log: Vehicle log that records abnormal events. Abnormal events are usually caused by an error process in the vehicle's onboard control unit, such as the motor temperature sensor reading is out of the normal range, the motor power output suddenly decreases, etc. For example, it is marked with "ERROR".
[0034] Second level log: vehicle log that records routine events. Routine events are key steps and status changes during program execution, such as motor start and shutdown, battery voltage level, sensor readings, etc. For example, "INFO" is used to identify information-level logs.
[0035] Third level log: vehicle log that records debugging events. Debug events refer to information useful for diagnosis, problem tracking, and system optimization, such as memory usage, interaction status between multiple vehicle control units, etc. For example, they are marked with "DEBUG".
[0036] Vehicle log: may include timestamp, log level, vehicle information, description text, etc., and record relevant information of one or more processes in the program run by the vehicle's onboard control unit, including abnormal events, regular events, debugging events, etc. Based on the recorded information, vehicle logs are divided into first-level logs, second-level logs, and third-level logs. Of course, other levels may also be included, which are not limited here. A vehicle log may correspond to one process or multiple processes, and the relationship between logs and processes is not unique.
[0037] Log file: A file used to record vehicle logs. Vehicle logs are recorded in the log file in the order of timestamps. Each log file has a certain storage capacity. When the storage capacity is exceeded, a new log file will be created to store the newly generated vehicle logs. The log file is stored in the vehicle's memory.
[0038] Figure 2 is a schematic interactive diagram of a log file processing method according to an embodiment of the present disclosure. Figure 2 When executing the log file processing method, the vehicle log is written into the vehicle's memory. When the first-level log appears, the log upload operation will be triggered, and the relevant log file will be uploaded to the log cloud platform. When troubleshooting a problem, the log file used for troubleshooting can be retrieved from the log cloud platform at any time, which improves the convenience of retrieving log files. In addition, the problem of losing logs due to insufficient storage space in the vehicle memory is solved. For example, when the first-level log appears, it is not checked in time, resulting in it being overwritten by subsequent content.
[0039] The following will refer to Figure 2 The log file processing method of this implementation is described in detail.
[0040] In step 201, the vehicle control unit obtains the vehicle log. The vehicle control unit mentioned in this article can be a domain controller, an electronic control unit (ECU), or a central control unit. The vehicle control unit can also be a dedicated control unit for processing the vehicle log. The memory can be the memory of the corresponding control unit, or it can be a dedicated memory for storing the vehicle log, which is collectively referred to as the vehicle memory in this article.
[0041] When the vehicle is running, it will generate corresponding vehicle logs. For example, when the electronic control unit of the vehicle is running a program, it will generate vehicle logs as the process is executed. These logs are recorded in log files, which are stored in the vehicle's memory.
[0042] As an example, if an abnormality occurs when executing a process, such as the reading of the motor temperature sensor exceeds the normal range, a vehicle log including the abnormal event will be generated. The vehicle log of the abnormal event is a first-level log. For example, the first-level log can be assigned a level identification of "ERROR". If no abnormality occurs when executing the process, such as the normal start-up of the motor, a log recording the routine event will be generated. This log is a second-level log, and its level identification is "INFO". Of course, the first-level log uses "ERROR" as the level identification, and the second-level log uses "INFO" as the level identification, which are examples of the present disclosure and are not intended to limit the level identification of the technical solution of the present disclosure.
[0043] In step 202, the vehicle control unit records the acquired vehicle log into a log file in the memory. The log files in the memory are sorted according to the time of the files (such as the creation time, etc.). Due to the limitation of the storage space of the memory, in the prior art, when the total amount of space occupied by multiple log files in the memory is close to the threshold of the storage space of the memory, the new log file will overwrite the earliest log file in the memory. For example, the earliest log file is deleted to reserve storage space for the new log file. According to this method of the prior art, for example, it will result in: when an abnormal event occurs and the cause of the abnormality is investigated, if it is necessary to use the deleted log file, but the log file no longer exists.
[0044] In step 203 , the onboard control unit identifies the level of the vehicle log.
[0045] For example, the vehicle log is divided into a first-level log, a second-level log and a third-level log according to the recorded content, wherein the first-level log has an ERROR mark, the second-level log has an INFO mark, and the third-level log has a DEBUG mark. According to the level mark in the vehicle log, the level of the vehicle log can be determined.
[0046] In addition, the vehicle log may also include other levels of logs, such as warning level logs, which can be marked with "WARNING", indicating possible problems or potential errors in the process. It can also include fatal level logs, such as "FATAL". Fatal level logs are used to record events in which serious errors occur and may cause program crashes. Generally, when fatal level logs appear, the vehicle should stop running and take measures immediately. Compared with fatal level logs, first level logs will only cause a certain function or operation to fail, and will not cause the entire program to crash. Therefore, the processing of events recorded in the first level log does not have a particularly high real-time requirement, so there is a situation where an abnormal event has occurred for a period of time but the problem has not been solved and the vehicle is in an unstarted state. The present disclosure is a technical solution proposed based on the characteristics of the events recorded in the first level log. The technical solution of the present disclosure can also be used for logs of other levels if there is a processing requirement. For example, for the case of warning level logs, technicians in the field should understand that it can be classified as a first level log. For fatal level logs, they can also be classified as first level logs, and of course other processing methods can also be used.
[0047] In step 204 , the vehicle control unit determines whether the vehicle log is a first level log.
[0048] For example, the level of the log can be identified by the above-mentioned identification. If there is no "ERROR" identification in the vehicle log, it proves that the log is not a first-level log, and the vehicle control unit continues to identify other vehicle logs. In the case that the first-level log is not identified, the vehicle control unit will end the processing. When the first-level log is identified, the vehicle control unit will execute step 205.
[0049] If there is an "ERROR" mark in the vehicle log, it means that the vehicle log is a first-level log. Then, the vehicle control unit executes step 205 to determine N log files related to the first-level log in the memory. The first-level log is stored in a log file, and the N log files can be a log file storing the first-level log and log files related to the log file.
[0050] In the vehicle's memory, each log file corresponds to a time, which can be the file creation time or the last operation time of the file (for example, the time when the vehicle log was last recorded). Each log file stores multiple vehicle logs. As an example, vehicle logs are recorded through log files in days. The vehicle logs generated on a certain day can be recorded in a log file, and the time corresponding to the log file is the time of the file. The logs generated one day after a certain day can be recorded in another log file. Of course, other rules can also be used to record vehicle logs through log files. In the present disclosure, the log file that records the first-level log is called the current log file, and the remaining log files can be called historical log files. According to the technical solution of the present disclosure, when the first-level log appears, it will trigger the processing of uploading the log file to the log cloud platform, so the first-level log is recorded as the log file of the current time.
[0051] When a first-level log appears, other level logs generated before the first-level log, such as the second-level log marked with "INFO", usually record relevant information such as the background of the occurrence of the abnormal event. In order to ensure the integrity of the data required for troubleshooting, the current log file that records the first-level log is uploaded to the log cloud platform as one of the N log files related to the first-level log. In order to ensure the accuracy of troubleshooting and the integrity of the data, etc., without missing the associated information of the abnormal event, the historical log files that are adjacent to the current log file in time can also be uploaded to the log cloud platform according to the time of the log file, and these historical log files are used as the remaining log files of the N log files related to the first-level log. The number of historical log files in the N log files can be any integer greater than or equal to 1, and there is no restriction here. For example, taking N=3 as an example, when a first-level log appears, the log file that records the first-level log is used as one of the three log files (for example, the file time is today), and according to the file time order, the previous two log files are used as the remaining two of the three log files (for example, the time of the two files is yesterday and the day before yesterday). In this way, three log files will be determined, and the time of the three log files is continuous. The N log files associated with the first-level log, which are composed of the current log file and the historical log file, provide more data support for troubleshooting.
[0052] After N log files are determined from the storage in step 205, an uploading step may be performed to upload the determined N log files to the log cloud platform.
[0053] In addition, Figure 2As shown, in order to ensure the success of data upload, step 206 can be further executed. In step 206, the vehicle control unit obtains the number of bytes stored in each of the N log files from the log cloud platform. For example, the vehicle control unit can send a request to the log cloud platform, and after receiving the request, the log cloud platform sends the number of bytes of each file uploaded to the log cloud platform to the vehicle control unit.
[0054] In step 207, the vehicle control unit determines whether the number of bytes stored in each log file on the log cloud platform is greater than 0 and less than the total number of bytes of the file.
[0055] If the number of bytes stored in a log file in the log cloud platform is 0, it means that the log file has not been uploaded and the transmission status is pending. Then, you can start uploading from the first byte of the log file, such as executing step 209. If the number of bytes of a log file in the log cloud platform is equal to the total number of bytes of the file, it means that the log file has been uploaded and its transmission status is completed. There is no need to upload again, and the process ends. Figure 2 If the number of bytes stored in a log file in the log cloud platform is between 0 and the total number of bytes in the file, it indicates that the log file may have been interrupted during the upload process, and the transmission status is interrupted. When the transmission status is the terminal state, step 208 is executed. Before transmitting the file, the on-board control unit needs to determine the breakpoint byte first, and determine the part to be transmitted based on the breakpoint byte.
[0056] Specifically, the last byte stored in the log cloud platform of the log file whose transmission status is interrupted among the N log files is taken as the breakpoint byte. The byte adjacent to the breakpoint byte and after the breakpoint byte in the log file corresponding to the breakpoint byte is taken as the first resumed transmission byte, and the part between the first resumed transmission byte and the last byte of the corresponding log file is taken as the part to be transmitted.
[0057] Take “……[2024-10-09 16:00:00] [INFO][Module: EngineControl] Enginestarted successfully.[2024-10-09 16:00:05][INFO] [Module: NavigationSystem]GPS signal acquired, current location: (37.7749, -122.4194).” as an example of one of the log files.
[0058] Assume that after uploading to "Engine", the upload of the file is interrupted due to circumstances such as vehicle restart. During subsequent uploads, it is determined that the last byte of the file stored in the log cloud platform is "Engine". Then, "Engine" is used as the breakpoint byte, and according to the content of the log file, the subsequent "started" is used as the first resumed byte, and the content from "started" to the end of the file is used as the part to be transmitted. For example, the part from "started" to the end of the log file is the part to be transmitted.
[0059] In the aforementioned log file, “[2024-10-09 16:00:00] [INFO][Module: EngineControl]Engine started successfully” is one of the vehicle logs in the file, including the timestamp “2024-20-09,16:00:00” indicating the time when the log was generated, the level identifier “INFO”, the vehicle module “Module” that generated the log is the control unit “EngineControl” of the motor, and the message content “Engine started successfully (The motor started successfully)”. “[2024-10-09 16:00:05][INFO] [Module: NavigationSystem]GPS signalacquired, current location: (37.7749, -122.4194)” is another vehicle log in the log file. Its timestamp is “2024-10-09 16:00:05”, and its level identifier is “INFO”. The vehicle module “Module” that generated the log is the navigation system “NavigationSystem”, and the message content is “GPS signal acquired, currentlocation: (37.7749, -122.4194)”, which means “GPS signal acquired, current location: (37.7749, -122.4194)”.
[0060] In step 209, the on-board control unit uploads the part to be transmitted to the log cloud platform. The log cloud platform executes step 210 to store N log files. During the process of storing log files on the log cloud platform, if the upload is interrupted, the log cloud platform stores the content that has been received before the interruption. In the process of continuing to upload, by judging the breakpoint bytes, only the content after the breakpoint bytes needs to be uploaded, and then the log cloud platform stores it after receiving the complete file. This avoids the problems of inefficiency and high traffic caused by repeated uploading of the part stored in the log cloud platform when the transmission is interrupted due to restart or the like. At the same time, it solves the problem of missing files due to interruptions, and ensures the integrity of the files.
[0061] In the case where the tester needs to troubleshoot problems in the first-level log, the required log files can be retrieved from the log cloud platform by checking the electronic device. The electronic device for troubleshooting can be, for example, a computer device used by the tester, or a handheld terminal device, etc. In step 211, the electronic device for troubleshooting retrieves the required log files from the log cloud platform, so that the problems in the first-level log can be troubleshooted based on these files. The electronic device for troubleshooting can obtain log files from the log cloud platform at any time and any place according to its needs, without communicating with the owner about the time to wake up the vehicle, and without arriving at the vehicle parking location to obtain the files. At the same time, it also avoids the problem of the log file recording the "ERROR" log being overwritten due to the storage space limitation of the vehicle's memory. In the technical solution disclosed in the present invention, in the case of a first-level log, the process of uploading the relevant log files to the log cloud platform for storage can be actively triggered.
[0062] According to the description in this article, by identifying the level of vehicle logs, the files with the first-level logs and related log files are synchronized to the log cloud platform, so that the electronic equipment can obtain log files anytime and anywhere when troubleshooting problems, without the need to coordinate with the owner's time and vehicle location, which improves the convenience of log file acquisition. In addition, it overcomes the disadvantage of limited storage space in the vehicle memory, avoids the situation where the first-level log is overwritten and cannot be obtained, and ensures the integrity and stability of the log files required for problem troubleshooting.
[0063] Figure 3 It is a six-layer diagram of the adaptability of the log file processing method according to the embodiment of the present disclosure. Figure 3 right Figure 2 The log file processing method performed by the on-board control unit is described in detail.
[0064] For example, after the vehicle is started, the vehicle generates a vehicle log, and then the processing method is started. In step 301, the log is recorded to a log file according to the generation time of the vehicle log. The log file can be a log file that has been stored in the memory of the vehicle, or a newly created log file in the memory of the vehicle. As an example, when the first vehicle log is to be stored on a certain day, a new log file of the day can be created in the memory of the vehicle, and the vehicle log of the day can be stored in the newly created log file starting from the first vehicle log. If the vehicle log of the afternoon of a certain day needs to be stored, it can be directly stored in the existing vehicle log of the day. In step 302, the level of each vehicle log is identified. As described above, each vehicle log can have a level identifier, and the level of each vehicle log can be identified according to the level identifier. In step 303, it is determined whether the vehicle log is a first-level log. For example, it is identified whether the level identifier of the vehicle log is "ERROR". If the first-level log is not identified, the log file processing method is terminated. After the first level log is identified, in step 304, N log files related to the first level log in the memory are determined, where N is a positive integer and ≥ 1. As several examples, the current log file containing the first level log can be used as the only log file, in which case N is 1. The current log file containing the first level log can be used as one of the N log files, and then at least one historical log file adjacent to the current log file in time is determined as another file of the N log files, in which case N ≥ 2. The number of historical log files in the N log files related to the first level log can be set according to demand, and preferably N is 2, that is, including the current log file and one historical log file.
[0065] After determining N log files, N log files can be uploaded to the log cloud platform. In order to ensure the integrity and transmission efficiency of the log files, the log file processing method disclosed in the present invention may include a judgment process for the log file transmission status. For example, in step 305, the number of bytes stored in each log file on the log cloud platform is determined. In the log cloud platform, if the number of bytes stored in a log file is 0, it indicates that its transmission state is to be transmitted, so it can be uploaded from the first byte. If the number of bytes stored in a log file is the total number of bytes of the file, it indicates that the file transmission is complete and no repeated upload is required. If the number of bytes stored in a log file is between 0 and its total number of bytes, it indicates that the log file is in an interrupted state, that is, the file may be interrupted for some reason. At this time, it is determined that the part to be transmitted. In step 306, it is determined whether the number of bytes stored in each log file on the log cloud platform is less than the total number of bytes of each log file. In the case of less than, step 307 is executed. In the case of less than, it indicates that each log file has been successfully uploaded to the log cloud platform, and then the log file processing method is terminated. In step 307, the number of bytes stored in each log file in the log cloud platform can be further judged. If the number of bytes stored in a log file is 0, it means that the log file has not been uploaded. Then the entire log file is used as the part to be transmitted. If the number of bytes stored in a log file is greater than 0, it means that a part has been uploaded, then according to the example described above, the unuploaded part of the log file can be used as the part to be transmitted. In this way, repeated uploading of the transmitted part is avoided, the transmission efficiency is improved, and the waste of traffic is avoided; and it is ensured that the files whose transmission is interrupted can be monitored and the part to be transmitted can be synchronized to the log cloud platform, avoiding the loss of files caused by interrupted transmission. In step 308, the log file is uploaded to the log cloud platform.
[0066] Figure 4 It is a schematic diagram of a vehicle log processing process according to an embodiment of the present disclosure. Figure 4 The log file processing method shows the log flow process when processing the log of a specific process.
[0067] Process X to process Y are some instances when the vehicle's onboard control unit runs a program. Each process will generate at least one vehicle log. The log processing system runs on Figure 2The vehicle control unit includes a log processing module, a log filtering module, an upload module and a memory, and the upload module includes a transmission status identification unit. The log collection module collects various logs generated by the vehicle process, and then organizes these vehicle logs into log files and writes them into the vehicle's memory. At the same time, the log collection module will also synchronize these vehicle logs to the log filtering module, and the log filtering module determines whether there is a first-level log marked with "ERROR" according to the level identification of each log. After monitoring the first-level log, the upload module is triggered to determine the current log file containing the log from the memory, as well as the historical log files adjacent to the current log file time, and upload these N log files to the log cloud platform. Of course, during the upload process, these log files will pass through the transmission status identification unit to determine their transmission status. That is, according to the number of bytes stored in the corresponding log file in the log cloud platform, it is determined whether the log file is in an interrupted state. For log files in an interrupted state, only the part to be transmitted is transmitted.
[0068] Figure 5 Schematic diagram of the log file storage process according to the embodiment of the present disclosure. For the method of the transmission status identification unit identifying the transmission status of the log file and the process of determining the part to be transmitted, please refer to Figure 5 .
[0069] Assume that log file _xx is the current log file containing the first-level log, and its total number of bytes is K. After log file _xx is determined to be one of the N log files related to the first-level log, it is passed to the transmission status identification unit. The transmission status identification unit sends a query request about the number of stored bytes of the file to the log cloud platform, and after the log cloud platform returns the number of stored bytes J of the file, the transmission status identification unit determines the relationship between the total number of bytes K and the number of stored bytes J of log file _xx. If 0<J<K, it proves that log file _xx is in an interrupted state, and then the part to be transmitted is determined to be KJ. Otherwise, the state to be transmitted or the completed state is returned. The method for determining the part to be transmitted can be referred to the previous text and will not be repeated here.
[0070] Through the aforementioned circulation process, the vehicle log is stored in the storage. At the same time, the first-level logs and other related logs required by engineers to troubleshoot problems are synchronously stored in the log cloud platform. When troubleshooting problems, engineers can directly retrieve the log files containing these logs from the log cloud platform, reducing the dependence on the vehicle startup status and improving the convenience of obtaining logs.
[0071] Figure 6 is a flow chart of a log file processing method according to an embodiment of the present disclosure. Figure 6 As shown, the log file processing method M600 of the present disclosure includes the following contents.
[0072] Step S610, collecting vehicle logs and recording the vehicle logs into log files, wherein the log files are stored in the vehicle's memory; Step S620, determining whether the collected vehicle logs are first-level logs, wherein the first-level logs are vehicle logs that record abnormal events; Step S630, in the case where the collected vehicle logs are first-level logs, determining N log files in the memory, N ≥ 2, the N log files including a current log file that records the first-level log and historical log files that are adjacent to the current log file in time; and Step S640, uploading the N log files stored in the memory to a log cloud platform, which is used to store the N log files.
[0073] In some embodiments, step S630 includes: searching the memory for a current log file that records a first-level log; searching the memory for at least one historical log file that is temporally adjacent to the current log file; and obtaining N log files including the current log file and at least one historical log file.
[0074] In some implementations, step S640 includes: determining the transmission status of each log file among the N log files; and uploading the log files whose transmission status is interrupted or waiting to be transmitted to the log cloud platform.
[0075] In some embodiments, determining the transmission status of each log file among N log files includes: obtaining the number of bytes stored in each log file among the N log files in the log cloud platform; determining the relationship between the number of bytes stored and the total number of bytes of the corresponding log file; and determining the transmission status of the log file whose number of bytes stored is greater than zero and less than the total number of bytes as an interrupted state, determining the transmission status of the log file whose number of bytes stored is equal to the total number of bytes as a completed state, and determining the transmission status of the log file whose number of bytes stored is zero as a pending state.
[0076] In some embodiments, a log file whose transmission status is an interrupted state and a pending transmission state is uploaded to a log cloud platform, including: when the transmission status of the log file is an interrupted state, using the last byte of the log file stored in the log cloud platform as the breakpoint byte; using the byte of the log file in the memory that is adjacent to the breakpoint byte and located after the breakpoint byte as the first resumed transmission byte, and using the part between the first resumed transmission byte and the last byte of the log file as the part to be transmitted; and uploading the part to be transmitted to the log cloud platform.
[0077] In some embodiments, uploading a log file whose transmission status is an interrupted state and a pending state to a log cloud platform includes: when the transmission status of the log file is a pending state, uploading the log file to the log cloud platform starting from the first byte of the log file.
[0078] In some implementations, after step S620, the method further includes: when the collected vehicle log is not a first-level log, the log file stored in the memory is not uploaded to the log cloud platform.
[0079] In some embodiments, after step S610, the process includes: storing a vehicle log in a memory of the vehicle, the vehicle log including a first level log, a second level log and a third level log, the second level log being a vehicle log for recording routine events, and the third level log being a vehicle log for recording debugging events.
[0080] In some embodiments, storing vehicle logs in a memory of the vehicle includes: writing multiple vehicle logs into a log file according to the generation time of the vehicle logs; creating a new log file when the total storage space occupied by the multiple vehicle logs reaches the total storage space of the log files; and storing the multiple log files in the memory.
[0081] The specific implementation methods and principles of each step are mentioned above and will not be repeated here.
[0082] The log file processing method disclosed in the present invention, by identifying the level of vehicle logs, synchronizes the first-level logs and related log files to the log cloud platform, so that logs can be obtained anytime and anywhere when troubleshooting problems, without the need to coordinate with the owner's time and vehicle location, thereby improving the convenience of log acquisition. In addition, it overcomes the drawback of limited storage space in the vehicle memory, avoids the situation where the first-level logs may be overwritten, and ensures the integrity and stability of the logs required for problem troubleshooting.
[0083] Figure 7 is a schematic block diagram of an in-vehicle electronic device according to an embodiment of the present disclosure.
[0084] like Figure 7As shown, the vehicle-mounted electronic device 700 can be implemented using a bus architecture. The bus architecture can include any number of interconnected buses and bridges, depending on the specific application and overall design constraints of the hardware. The bus 710 connects various circuits including one or more processors 720, memory 730 and / or hardware modules together. The bus 710 can also connect various other circuits such as peripherals, voltage regulators, power management circuits, external antennas, etc. The bus 710 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one connecting line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0085] The processor 720 may call the computer program in the memory 730 to execute the methods of the above disclosed embodiments. It should also be understood that the corresponding modules that execute one or several steps of the above methods may be one or more hardware modules specially configured to execute the corresponding steps.
[0086] In the vehicle-mounted electronic device 700, the memory 730 stores a computer program. When the computer program is executed by the processor 720, the processor 720 performs the following processes: collecting vehicle logs and recording the vehicle logs in log files, wherein the log files are stored in the vehicle's memory; determining whether the collected vehicle logs are first-level logs; in the case where the collected vehicle logs are first-level logs, determining N log files in the memory, N≥2, wherein the first-level logs are vehicle logs that record abnormal events, and the N log files include a current log file that records the first-level logs and historical log files that are adjacent to the current log file in time; and uploading the N log files stored in the memory to a log cloud platform, which is used to store the N log files.
[0087] In some embodiments, when the collected vehicle log is a first-level log, determining N log files in the memory includes: searching the memory for a current log file that records the first-level log; searching the memory for at least one historical log file that is temporally adjacent to the current log file; and obtaining N log files including the current log file and at least one historical log file.
[0088] In some embodiments, uploading N log files stored in a memory to a log cloud platform includes: determining the transmission status of each log file in the N log files; and uploading log files whose transmission status is interrupted or pending to be transmitted to the log cloud platform.
[0089] In some embodiments, determining the transmission status of each log file among N log files includes: obtaining the number of bytes stored in each log file among the N log files in the log cloud platform; determining the relationship between the number of bytes stored and the total number of bytes of the corresponding log file; and determining the transmission status of the log file whose number of bytes stored is greater than zero and less than the total number of bytes as an interrupted state, determining the transmission status of the log file whose number of bytes stored is equal to the total number of bytes as a completed state, and determining the transmission status of the log file whose number of bytes stored is zero as a pending state.
[0090] In some embodiments, a log file whose transmission status is an interrupted state and a pending transmission state is uploaded to a log cloud platform, including: when the transmission status of the log file is an interrupted state, using the last byte of the log file stored in the log cloud platform as the breakpoint byte; using the byte of the log file in the memory that is adjacent to the breakpoint byte and located after the breakpoint byte as the first resumed transmission byte, and using the part between the first resumed transmission byte and the last byte of the log file as the part to be transmitted; and uploading the part to be transmitted to the log cloud platform.
[0091] In some embodiments, uploading a log file whose transmission status is an interrupted state and a pending state to a log cloud platform includes: when the transmission status of the log file is a pending state, uploading the log file to the log cloud platform starting from the first byte of the log file.
[0092] In some implementations, the method further includes: when the collected vehicle log is not a first-level log, the log file stored in the memory is not uploaded to the log cloud platform.
[0093] In some embodiments, the method includes storing a vehicle log in a memory of the vehicle, wherein the vehicle log includes a first level log, a second level log, and a third level log, wherein the second level log is a vehicle log for recording routine events, and the third level log is a vehicle log for recording debugging events.
[0094] In some embodiments, storing vehicle logs in a memory of the vehicle includes: writing multiple vehicle logs into a log file according to the generation time of the vehicle logs; creating a new log file when the total storage space occupied by the multiple vehicle logs reaches the total storage space of the log files; and storing the multiple log files in the memory.
[0095] The vehicle-mounted electronic device 700 may be Figure 2The implementation principles and more specific execution methods of the on-board control unit in the vehicle involved in each step can be referred to above and will not be repeated here.
[0096] According to the technical solution disclosed in the present invention, by identifying the level of vehicle logs, the first-level logs and related log files are synchronized to the log cloud platform, so that logs can be obtained anytime and anywhere when troubleshooting problems, without the need to coordinate with the owner's time and vehicle location, thereby improving the convenience of log acquisition. In addition, the disadvantage of limited storage space in the vehicle memory is overcome, the situation where the first-level logs may be overwritten is avoided, and the integrity and stability of the logs required for problem troubleshooting are guaranteed.
[0097] The present disclosure also provides a readable storage medium, in which execution instructions are stored, and when the execution instructions are executed by a processor, they are used to implement the above method. "Readable storage medium" can be any device that can contain, store, communicate, propagate or transmit programs for use in an instruction execution system, device or equipment or in combination with these instruction execution systems, devices or equipment. More specific examples of readable storage media include the following: an electrical connection portion (electronic device) with one or more wirings, a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), an optical fiber device, and a portable read-only memory (CDROM), etc.
[0098] The present disclosure also provides a computer program product, and the method of the present disclosure can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed, the process or function of the present disclosure is executed in whole or in part. A computer-readable storage medium can be used as an implementation of a computer program product, that is, the present disclosure also provides a computer-readable storage medium, which includes a computer program, and when the computer program is executed by a processor, any of the above methods is implemented.
[0099] The computer program or instructions may be stored in a readable storage medium or transmitted from one readable storage medium to another readable storage medium, for example, the computer program or instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center by wired or wireless means. The readable storage medium may be any available medium that can be accessed or a data storage device such as a server, data center, etc. that integrates one or more available media. The available medium may be a magnetic medium, such as a floppy disk, a hard disk, or a magnetic tape; it may also be an optical medium, such as a digital video disk; it may also be a semiconductor medium, such as a solid state drive. The computer readable storage medium may be a volatile or non-volatile storage medium, or may include both volatile and non-volatile types of storage media.
[0100] Those skilled in the art will appreciate that the embodiments of the present disclosure may be provided as methods, systems, or computer program products. Therefore, the present disclosure may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present disclosure may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0101] The present disclosure is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to the present disclosure. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0102] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0103] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0104] In the description of this specification, the description with reference to the terms "one embodiment / method", "some embodiments / methods", "example", "specific example", or "some examples" etc. means that the specific features, structures, or characteristics described in conjunction with the embodiment / method or example are included in at least one embodiment / method or example of the present disclosure. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment / method or example. Moreover, the specific features, structures, or characteristics described may be combined in a suitable manner in any one or more embodiments / methods or examples. In addition, those skilled in the art may combine and combine different embodiments / methods or examples described in this specification and features of different embodiments / methods or examples, unless they are contradictory.
[0105] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0106] Those skilled in the art should understand that the above embodiments are only for the purpose of clearly illustrating the present disclosure, and are not intended to limit the scope of the present disclosure. For those skilled in the art, other changes or modifications may be made based on the above disclosure, and these changes or modifications are still within the scope of the present disclosure.
Claims
1. A log file processing method, applied to a vehicle, characterized in that: include: collecting vehicle logs and recording the vehicle logs into a log file, wherein the log file is stored in a memory of the vehicle; Determining whether the collected vehicle log is a first-level log, wherein the first-level log is a vehicle log that records abnormal events; In the case where the collected vehicle log is the first level log, determining N log files in the memory, N≥2, the N log files including a current log file recording the first level log and a historical log file adjacent to the current log file in time; as well as The N log files stored in the memory are uploaded to a log cloud platform, and the log cloud platform is used to store the N log files.
2. The log file processing method according to claim 1, characterized in that: Determining N log files in the memory includes: Searching the memory for a current log file having the first level log recorded therein; searching the memory for at least one historical log file that is adjacent in time to the current log file; and The N log files including the current log file and at least one of the historical log files are obtained.
3. The log file processing method according to claim 1, characterized in that: Uploading the N log files stored in the memory to the log cloud platform includes: Determining a transmission status of each of the N log files; and The log files whose transmission status is interrupted or waiting to be transmitted are uploaded to the log cloud platform.
4. The log file processing method according to claim 3, characterized in that: Determining the transmission status of each log file in the N log files includes: Obtain the number of bytes stored in each of the N log files in the log cloud platform; determining a relationship between the number of stored bytes and the total number of bytes of the corresponding log file; and The transmission status of the log file whose stored byte number is greater than zero and less than the total byte number is determined as an interrupted status, the transmission status of the log file whose stored byte number is equal to the total byte number is determined as a completed status, and the transmission status of the log file whose stored byte number is zero is determined as a pending status.
5. The log file processing method according to claim 3, characterized in that: Uploading the log files whose transmission status is interrupted or waiting to be transmitted to the log cloud platform includes: When the transmission status of the log file is interrupted, the last byte of the log file stored in the log cloud platform is used as the breakpoint byte; Using a byte of the log file in the memory that is adjacent to the breakpoint byte and located after the breakpoint byte as a first resumed transmission byte, and using a portion from the first resumed transmission byte to the last byte of the log file as a portion to be transmitted; and The part to be transmitted is uploaded to the log cloud platform.
6. The log file processing method according to claim 3, characterized in that: Uploading the log files whose transmission status is interrupted or waiting to be transmitted to the log cloud platform includes: When the transmission status of the log file is in the pending state, the log file is uploaded to the log cloud platform starting from the first byte of the log file.
7. The log file processing method according to claim 1, characterized in that: After collecting vehicle logs and recording the vehicle logs into log files, include: A vehicle log is stored in a memory of the vehicle, wherein the vehicle log includes a first level log, a second level log and a third level log, wherein the second level log is a vehicle log for recording routine events, and the third level log is a vehicle log for recording debugging events.
8. The log file processing method according to claim 7, characterized in that: Storing a vehicle log in a memory of the vehicle, comprising: According to the generation time of the vehicle logs, multiple vehicle logs are written into the log file; When the total storage space occupied by the multiple vehicle logs reaches the total storage space of the log files, creating a new log file; and A plurality of the log files are stored in the memory.
9. A vehicle-mounted electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the method according to any one of claims 1 to 8.
10. A vehicle, characterized in that: The vehicle includes the in-vehicle electronic device according to claim 9.
11. A computer program product, characterized in that The computer program product comprises a computer program, which is used to implement at least the method according to any one of claims 1 to 8 when being executed by a processor.