WO2022036865A1 - Method and apparatus for automatically capturing log file, and computer device - Google Patents

Method and apparatus for automatically capturing log file, and computer device Download PDF

Info

Publication number
WO2022036865A1
WO2022036865A1 PCT/CN2020/125556 CN2020125556W WO2022036865A1 WO 2022036865 A1 WO2022036865 A1 WO 2022036865A1 CN 2020125556 W CN2020125556 W CN 2020125556W WO 2022036865 A1 WO2022036865 A1 WO 2022036865A1
Authority
WO
WIPO (PCT)
Prior art keywords
log
log file
preset
grabbing
file
Prior art date
Application number
PCT/CN2020/125556
Other languages
French (fr)
Chinese (zh)
Inventor
孙思凯
Original Assignee
深圳创维-Rgb电子有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳创维-Rgb电子有限公司 filed Critical 深圳创维-Rgb电子有限公司
Publication of WO2022036865A1 publication Critical patent/WO2022036865A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/162Delete operations

Definitions

  • the present disclosure relates to the field of computers, and in particular, to a method, an apparatus, and a computer device for automatically grabbing log files.
  • a log generation module is set in the computer equipment. , so as to record the time or messages during the running process of the computer equipment operating system.
  • the logs generated after a problem are often not stored well, or it is difficult to locate and analyze the problem after a long time, thus affecting the customer's experience.
  • the present disclosure provides a method, device and computer equipment for automatically grabbing log files, so as to obtain the required log files in the computer equipment in time, so as to locate and analyze problems in time and improve user experience.
  • a method for automatically grabbing log files including:
  • the preset type of logs includes at least one of error logs, access logs, message logs, warning logs, and debug logs.
  • the log file of the preset type written into the preset storage space by the log grabbing script includes:
  • the size of the log file is greater than or equal to the preset value, a new log file is created in the preset storage space, and subsequent logs of the preset type are written into the new log file.
  • the method for automatically grabbing log files further includes:
  • the number of log files in the preset storage space is greater than the preset number, and if it is greater than the preset number, the log file with the earliest creation date is deleted.
  • the preset storage space includes a preset partition of the internal storage space of the device and/or an external storage space pre-connected to the device.
  • the method for automatically grabbing log files further includes:
  • the method for automatically grabbing log files further includes:
  • the method for automatically grabbing log files further includes:
  • the method for automatically grabbing log files further includes:
  • the present disclosure also provides an automatic grabbing device for log files, including:
  • the crawling script startup module is configured to start the corresponding log crawling script when a preset type of log crawling instruction is received;
  • a log file writing module configured to write the preset type log into the log file of the preset storage space through the log grab script whenever the preset type log is generated;
  • the crawling script closing module is configured to close the log crawling script after receiving the stop crawling instruction.
  • the present disclosure also provides a computer device including a memory and a processor, the memory stores a computer program, and the processor runs the computer program to make the computer device execute the method for automatically grabbing log files.
  • the log file writing module is further configured to obtain size information of the log file, and if the size of the log file is lower than a preset value, continue writing to the log file into the preset type log;
  • the log file writing module is further configured to create a new log file in the preset storage space if the size of the log file is greater than or equal to the preset value, and assign the subsequent preset type to the log file. The log is written to a new log file.
  • the apparatus further includes a log file processing module
  • the log file processing module is configured to determine whether the number of log files in the preset storage space is greater than a preset number before creating a new log file in the preset storage space, and if it is greater than the preset number, delete the creation date The oldest log file.
  • the apparatus further includes a log file processing module
  • the log file processing module is also configured to transmit the log file to the after-sales service terminal;
  • the log file processing module is further configured to receive an upgrade package based on the log file sent by the after-sale service terminal, and run the upgrade package.
  • the apparatus further includes a log file processing module
  • the log file processing module is further configured to close the log capture script after the preset problem log is reproduced.
  • the apparatus further includes a log file processing module
  • the log file processing module is further configured to upload the corresponding date file to the after-sales service terminal after the preset problem log is reproduced.
  • the apparatus further includes a log file processing module
  • the log file processing module is further configured to notify service personnel to obtain the corresponding log file through a remote network after the preset problem log is reproduced.
  • the present disclosure also provides a readable storage medium, which stores a computer program, and when the computer program runs on a processor, executes the method for automatically grabbing log files.
  • the present disclosure provides a method for automatically grabbing log files.
  • the method for automatically grabbing log files includes: when receiving a log grabbing instruction of a preset type, starting a corresponding log grabbing script; whenever a log of the preset type is generated When the log grabbing script is used, the log of the preset type is written into the log file of the preset storage space; after receiving the stop grabbing instruction, the log grabbing script is closed.
  • the method for automatically grabbing log files of the present disclosure can obtain the required log files in a computer device in time, so as to locate and analyze problems in time and improve user experience.
  • FIG. 1 is a flowchart of a method for automatically grabbing log files provided by an embodiment of the present disclosure
  • FIG. 2 is a flowchart of writing a log file provided by an embodiment of the present disclosure
  • FIG. 5 is a flowchart of another method for automatically grabbing log files provided by an embodiment of the present disclosure
  • FIG. 6 is a schematic structural diagram of an apparatus for automatically grabbing log files according to an embodiment of the present disclosure.
  • FIG. 1 is a flowchart of a method for automatically grabbing log files shown in the present disclosure, and the method includes the following steps:
  • Step S11 when a preset type log grabbing instruction is received, start a corresponding log grabbing script.
  • a log generation module is set in the computer equipment. , so as to record the time or messages during the running process of the computer equipment operating system, so as to diagnose, track and deal with various problems generated by the computer equipment subsequently.
  • log grabbing scripts of various preset types of logs may be pre-stored in the computer device, and the user may input preset types of log grabbing instructions to the computer device according to requirements to enable corresponding log grabbing instructions.
  • Log grabbing script use the log grabbing script to grab the corresponding logs.
  • a computer device often reproduces the same error. In order to solve this error, the corresponding error log needs to be used.
  • the user can input the error log capture command to the computer device to start the corresponding error log capture script to capture the error log in real time.
  • the preset type of logs includes at least one of an error log, an access log, a message log, a warning log, and a debug log.
  • Step S12 Whenever the log of the preset type is generated, the log of the preset type is written into the log file of the preset storage space through the log capture script.
  • the log of the preset type can be written into the log file of the preset storage space through the log capture script, so that the user can Set the storage space to query the corresponding log.
  • the user can start the capture script of the corresponding log, upload the corresponding log file to the after-sales service after the problem recurs, or notify the service personnel to obtain the corresponding log file from the preset space through the remote network. log file in order to troubleshoot problems.
  • Step S13 After receiving the stop scraping instruction, close the log scraping script.
  • the above-mentioned computer equipment includes a mobile terminal, a tablet computer, and a smart display device, etc., which are not limited here.
  • the user can use the above method and steps to open the log capture script corresponding to the problem, then run the TV normally and wait for the problem to recur, and then obtain the corresponding log file of the problem, so that the log file can be used to analyze the problem. and problem solving.
  • the user can obtain the required log file in the computer device in time, so as to locate and analyze the problem in time, and improve the user's experience.
  • FIG. 2 is a flow chart of writing a log file provided by the present disclosure, including the following steps:
  • Step S21 Obtain the size information of the log file, and if the size of the log file is lower than a preset value, continue to write the preset type of log to the log file.
  • the size information of the log file to be written can also be obtained, and it is determined whether the size of the log file is lower than the preset size. If the value is lower than the preset value, the log of the preset type can continue to be written to the log file.
  • Step S22 If the size of the log file is greater than or equal to the preset value, create a new log file in the preset storage space, and write subsequent logs of the preset type into the new log file.
  • the size of the log file to be written is greater than or equal to the preset value, a new log file is created in the preset storage space, and the preset type of log is written into the new log file . That is, the size of the log file is limited, and the size can be set by the user.
  • FIG. 3 is another flowchart of writing a log file provided by the present disclosure, further comprising the following steps:
  • Step S23 Before establishing a new log file in the preset storage space, determine whether the number of log files in the preset storage space is greater than the preset number, and if greater than the preset number, delete the log file with the earliest creation date.
  • the number of log files in the preset storage space may also be limited.
  • the log file with the earliest creation date will be deleted after a new log file is created.
  • the size of the preset storage space can be limited, so as to prevent the preset storage space from occupying the resources of the computer device.
  • FIG. 4 is a flowchart of another method for automatically grabbing log files provided by the present disclosure, and the method includes the following steps:
  • Step S41 when a preset type log grabbing instruction is received, start a corresponding log grabbing script.
  • This step is the same as the above-mentioned step S11, and is not repeated here.
  • Step S42 Whenever the preset type of log is generated, write the preset type of log into a log file of a preset storage space through the log capture script.
  • This step is the same as the above-mentioned step S12, and is not repeated here.
  • Step S43 After receiving the stop scraping instruction, close the log scraping script.
  • This step is the same as the above-mentioned step S13, and is not repeated here.
  • Step S44 Transmit the log file to the after-sale service terminal.
  • Step S45 Receive an upgrade package based on the log file sent by the after-sale service terminal, and run the upgrade package.
  • the log file after the log file is generated, the log file can also be sent to the after-sales service terminal, so that the staff of the after-sales service terminal can monitor the operation of the computer equipment according to the log file. You can analyze the problem and generate the corresponding upgrade package based on the log file.
  • the computer equipment can also accept an upgrade package based on the log file from the after-sale service, and perform corresponding upgrades to solve the problem that the computer equipment recurs during operation.
  • FIG. 5 is a flowchart of another method for automatically grabbing log files provided by the present disclosure, and the method includes the following steps:
  • Step S51 when a preset type log grabbing instruction is received, start a corresponding log grabbing script.
  • This step is the same as the above-mentioned step S11, and is not repeated here.
  • Step S52 Whenever the preset type of log is generated, write the preset type of log into a log file of a preset storage space through the log capture script.
  • This step is the same as the above-mentioned step S12, and is not repeated here.
  • Step S53 After receiving the stop scraping instruction, close the log scraping script.
  • This step is the same as the above-mentioned step S13, and is not repeated here.
  • Step S54 After the preset problem log is reproduced, the log grabbing script is closed.
  • the user can set a preset problem log correspondingly after a problem occurs in the computer device.
  • the log generated by the error can be set as the preset problem log.
  • the preset problem log is captured and written to the log file, and the log capture script is closed, so as to avoid the long-term operation of the log capture script from occupying computer equipment resources.
  • FIG. 6 is a schematic structural diagram of an automatic log file grabbing device provided by the present disclosure.
  • the log file automatic grabbing device 600 includes:
  • a crawling script startup module 610 configured to start a corresponding log crawling script when a preset type of log crawling instruction is received
  • the log file writing module 620 is configured to write the preset type log into the log file of the preset storage space through the log grab script whenever the preset type log is generated;
  • the crawling script closing module 630 is configured to close the log crawling script after receiving the stop crawling instruction.
  • the log file writing module 620 is further configured to obtain the size information of the log file, and if the size of the log file is lower than a preset value, continue to write a preset type of log to the log file;
  • the file writing module 620 is further configured to create a new log file in the preset storage space if the size of the log file is greater than or equal to the preset value, and write subsequent logs of the preset type into the new log file.
  • the log file automatic grabbing device 600 further includes a log file processing module:
  • the log file processing module is configured to determine whether the number of log files in the preset storage space is greater than the preset number before creating a new log file in the preset storage space, and if it is greater than the preset number, delete the log file with the earliest creation date.
  • the log file processing module is further configured to transmit the log file to the after-sales service terminal; the log file processing module is further configured to receive the log file-based upgrade package sent by the after-sales service terminal, and run the upgrade package.
  • the log file processing module is also configured to close the log capture script after the preset problem log recurs.
  • the log file processing module is also configured to upload the corresponding date file to the after-sales service terminal after the preset problem log is reproduced.
  • the log file processing module is further configured to notify the service personnel to obtain the corresponding log file through the remote network after the preset problem log recurs.
  • the present disclosure also provides a computer device, the computer device includes a memory and a processor, the memory can be configured to store a computer program, and the processor runs the computer program, so that the computer device executes the above method or the above log file automatically Function of the individual modules in the gripper.
  • the memory may include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like; data (such as audio data, phone book, etc.) Additionally, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
  • This embodiment also provides a readable storage medium configured to store the computer program used in the above-mentioned computer device.
  • each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more functions configured to implement the specified logical function(s) executable instructions. It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures.
  • each block of the block diagrams and/or flow diagrams, and combinations of blocks in the block diagrams and/or flow diagrams can be implemented using dedicated hardware-based systems that perform the specified functions or actions. be implemented, or may be implemented in a combination of special purpose hardware and computer instructions.
  • each functional module or unit in each embodiment of the present disclosure may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part.
  • the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the present disclosure can be embodied in the form of software products in essence, or the parts that contribute to the prior art or the parts of the technical solutions.
  • the computer software products are stored in a storage medium, including Several instructions are used to cause a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in various implementations of the present disclosure.
  • the aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .
  • the present disclosure provides a method for automatically grabbing log files.
  • the method for automatically grabbing log files includes: when receiving a log grabbing instruction of a preset type, starting a corresponding log grabbing script; whenever a log of the preset type is generated When the log grabbing script is used, the log of the preset type is written into the log file of the preset storage space; after receiving the stop grabbing instruction, the log grabbing script is closed.
  • the method for automatically grabbing log files of the present disclosure can obtain the required log files in a computer device in time, so as to locate and analyze problems in time and improve user experience.

Abstract

A method and apparatus for automatically capturing a log file, and a computer device. The method for automatically capturing a log file comprises: when a capturing instruction regarding a preset-type log is received, enabling a corresponding log capturing script (S11); each time the preset-type log is generated, writing the preset-type log into a log file of a preset storage space by means of the log capturing script (S12); and after a capturing stop instruction is received, disabling the log capturing script (S13). By means of the method, a required log file in a computer device can be acquired in a timely manner, such that a problem is located and analyzed in a timely manner, and the user experience is improved.

Description

日志文件自动抓取方法、装置和计算机设备Log file automatic grabbing method, device and computer equipment
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请要求于2020年08月20日提交中国专利局的申请号为2020108447108、名称为“日志文件自动抓取方法、装置和计算机设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application No. 2020108447108, which was filed with the China Patent Office on August 20, 2020, and is entitled "Method, Apparatus and Computer Equipment for Automatically Grabbing Log Files", the entire contents of which are incorporated by reference in in this application.
技术领域technical field
本公开涉及计算机领域,具体而言,涉及一种日志文件自动抓取方法、装置和计算机设备。The present disclosure relates to the field of computers, and in particular, to a method, an apparatus, and a computer device for automatically grabbing log files.
背景技术Background technique
计算机设备操作系统中各种软件模块之间的耦合度越来越高,各种软件模块之间的交互越来越频繁,因此经常会出现一些问题,因此在计算机设备中设置有日志生成的模块,以便记录计算机设备操作系统在运行的过程中的时间或者消息等。但是在出现问题后生成的日志往往不能很好的进行存储,或者在时间久后难以进行问题的定位以及分析,从而影响客户的体验度。The degree of coupling between various software modules in the computer equipment operating system is getting higher and higher, and the interaction between various software modules is becoming more and more frequent, so some problems often occur. Therefore, a log generation module is set in the computer equipment. , so as to record the time or messages during the running process of the computer equipment operating system. However, the logs generated after a problem are often not stored well, or it is difficult to locate and analyze the problem after a long time, thus affecting the customer's experience.
发明内容SUMMARY OF THE INVENTION
鉴于上述问题,本公开提供了一种日志文件自动抓取方法、装置和计算机设备,以及时获取计算机设备中所需的日志文件,以便及时定位以及分析问题,提高用户的体验度。In view of the above problems, the present disclosure provides a method, device and computer equipment for automatically grabbing log files, so as to obtain the required log files in the computer equipment in time, so as to locate and analyze problems in time and improve user experience.
为了实现上述目的,本公开采用如下的技术方案:In order to achieve the above object, the present disclosure adopts the following technical solutions:
一种日志文件自动抓取方法,包括:A method for automatically grabbing log files, including:
在接收到预设类型日志抓取指令时,开启相应的日志抓取脚本;When receiving a preset type of log grabbing instruction, start the corresponding log grabbing script;
每当产生所述预设类型日志时,通过所述日志抓取脚本将所述预设类型日志写入预设存储空间的日志文件;Whenever the preset type log is generated, write the preset type log into the log file of the preset storage space through the log grab script;
在接收到停止抓取指令后,关闭所述日志抓取脚本。After receiving the stop scraping instruction, close the log scraping script.
在一种可能的实现方式中,所述的日志文件自动抓取方法中,所述预设类型日志包括错误日志、访问日志、消息日志、警告日志以及调试日志中至少一种日志。In a possible implementation manner, in the method for automatically grabbing log files, the preset type of logs includes at least one of error logs, access logs, message logs, warning logs, and debug logs.
在一种可能的实现方式中,所述的日志文件自动抓取方法中,所述通过所述日志抓取脚本将所述预设类型日志写入预设存储空间的日志文件包括:In a possible implementation manner, in the automatic log file grabbing method, the log file of the preset type written into the preset storage space by the log grabbing script includes:
获取所述日志文件的大小信息,若所述日志文件的大小低于预设值时,继续向所述日志文件写入所述预设类型日志;Obtain the size information of the log file, and if the size of the log file is lower than a preset value, continue to write the preset type log to the log file;
若所述日志文件的大小大于或等于所述预设值时,在所述预设存储空间创建新的日志文件,并将后续的所述预设类型日志写入新的日志文件。If the size of the log file is greater than or equal to the preset value, a new log file is created in the preset storage space, and subsequent logs of the preset type are written into the new log file.
在一种可能的实现方式中,所述的日志文件自动抓取方法中,还包括:In a possible implementation manner, the method for automatically grabbing log files further includes:
在所述预设存储空间建立新的日志文件之前,判断所述预设存储空间的日志文件数量是否大于预设数量,若大于预设数量,则删除建立日期最早的日志文件。Before creating a new log file in the preset storage space, it is determined whether the number of log files in the preset storage space is greater than the preset number, and if it is greater than the preset number, the log file with the earliest creation date is deleted.
在一种可能的实现方式中,所述的日志文件自动抓取方法中,所述预设存储空间包括设备内部存储空间的预设分区和/或预先连接所述设备的外部存储空间。In a possible implementation manner, in the method for automatically grabbing log files, the preset storage space includes a preset partition of the internal storage space of the device and/or an external storage space pre-connected to the device.
在一种可能的实现方式中,所述的日志文件自动抓取方法中,还包括:In a possible implementation manner, the method for automatically grabbing log files further includes:
将所述日志文件传输至售后服务端;transmitting the log file to the after-sales service terminal;
接收所述售后服务端发送的基于所述日志文件的升级包,并运行所述升级包。Receive an upgrade package based on the log file sent by the after-sale service terminal, and run the upgrade package.
在一种可能的实现方式中,所述的日志文件自动抓取方法中,还包括:In a possible implementation manner, the method for automatically grabbing log files further includes:
在预设问题日志复现后,关闭所述日志抓取脚本。After the preset problem log is reproduced, the log grabbing script is closed.
在一种可能的实现方式中,所述的日志文件自动抓取方法中,还包括:In a possible implementation manner, the method for automatically grabbing log files further includes:
在预设问题日志复现后,将相应的日子文件上传至售后服务端。After the preset problem log recurs, upload the corresponding date file to the after-sales service terminal.
在一种可能的实现方式中,所述的日志文件自动抓取方法中,还包括:In a possible implementation manner, the method for automatically grabbing log files further includes:
在预设问题日志复现后,通知服务人员通过远程网络获取相应的日志文件。After the preset problem log recurs, notify the service personnel to obtain the corresponding log file through the remote network.
本公开还提供一种日志文件自动抓取装置,包括:The present disclosure also provides an automatic grabbing device for log files, including:
抓取脚本启动模块,配置成在接收到预设类型日志抓取指令时,开启相应的日志抓取脚本;The crawling script startup module is configured to start the corresponding log crawling script when a preset type of log crawling instruction is received;
日志文件写入模块,配置成每当产生所述预设类型日志时,通过所述日志抓取脚本将所述预设类型日志写入预设存储空间的日志文件;A log file writing module, configured to write the preset type log into the log file of the preset storage space through the log grab script whenever the preset type log is generated;
抓取脚本关闭模块,配置成在接收到停止抓取指令后,关闭所述日志抓取脚本。The crawling script closing module is configured to close the log crawling script after receiving the stop crawling instruction.
本公开还提供一种计算机设备,包括存储器以及处理器,所述存储器存储有计算机程序,所述处理器运行所述计算机程序以使所述计算机设备执行所述的日志文件自动抓取方法。The present disclosure also provides a computer device including a memory and a processor, the memory stores a computer program, and the processor runs the computer program to make the computer device execute the method for automatically grabbing log files.
在一种可能的实现方式中,所述日志文件写入模块,还配置成获取所述日志文件的大小信息,若所述日志文件的大小低于预设值时,继续向所述日志文件写入所述预设类型日志;In a possible implementation manner, the log file writing module is further configured to obtain size information of the log file, and if the size of the log file is lower than a preset value, continue writing to the log file into the preset type log;
所述日志文件写入模块,还配置成若所述日志文件的大小大于或等于所述预设值时,在所述预设存储空间创建新的日志文件,并将后续的所述预设类型日志写入新的日志文件。The log file writing module is further configured to create a new log file in the preset storage space if the size of the log file is greater than or equal to the preset value, and assign the subsequent preset type to the log file. The log is written to a new log file.
在一种可能的实现方式中,所述装置还包括日志文件处理模块;In a possible implementation, the apparatus further includes a log file processing module;
所述日志文件处理模块,配置成在所述预设存储空间建立新的日志文件之前,判断所述预设存储空间的日志文件数量是否大于预设数量,若大于预设数量,则删除建 立日期最早的日志文件。The log file processing module is configured to determine whether the number of log files in the preset storage space is greater than a preset number before creating a new log file in the preset storage space, and if it is greater than the preset number, delete the creation date The oldest log file.
在一种可能的实现方式中,所述装置还包括日志文件处理模块;In a possible implementation, the apparatus further includes a log file processing module;
所述日志文件处理模块,还配置成将所述日志文件传输至售后服务端;The log file processing module is also configured to transmit the log file to the after-sales service terminal;
所述日志文件处理模块,还配置成接收所述售后服务端发送的基于所述日志文件的升级包,并运行所述升级包。The log file processing module is further configured to receive an upgrade package based on the log file sent by the after-sale service terminal, and run the upgrade package.
在一种可能的实现方式中,所述装置还包括日志文件处理模块;In a possible implementation, the apparatus further includes a log file processing module;
所述日志文件处理模块,还配置成在预设问题日志复现后,关闭所述日志抓取脚本。The log file processing module is further configured to close the log capture script after the preset problem log is reproduced.
在一种可能的实现方式中,所述装置还包括日志文件处理模块;In a possible implementation, the apparatus further includes a log file processing module;
所述日志文件处理模块,还配置成在预设问题日志复现后,将相应的日子文件上传至售后服务端。The log file processing module is further configured to upload the corresponding date file to the after-sales service terminal after the preset problem log is reproduced.
在一种可能的实现方式中,所述装置还包括日志文件处理模块;In a possible implementation, the apparatus further includes a log file processing module;
所述日志文件处理模块,还配置成在预设问题日志复现后,通知服务人员通过远程网络获取相应的日志文件。The log file processing module is further configured to notify service personnel to obtain the corresponding log file through a remote network after the preset problem log is reproduced.
本公开还提供一种可读存储介质,其存储有计算机程序,所述计算机程序在处理器上运行时执行所述的日志文件自动抓取方法。The present disclosure also provides a readable storage medium, which stores a computer program, and when the computer program runs on a processor, executes the method for automatically grabbing log files.
本公开提供一种日志文件自动抓取方法,该日志文件自动抓取方法包括:在接收到预设类型日志抓取指令时,开启相应的日志抓取脚本;每当产生所述预设类型日志时,通过所述日志抓取脚本将所述预设类型日志写入预设存储空间的日志文件;在接收到停止抓取指令后,关闭所述日志抓取脚本。本公开的日志文件自动抓取方法,可以及时获取计算机设备中所需的日志文件,以便及时定位以及分析问题,提高用户的体验度。The present disclosure provides a method for automatically grabbing log files. The method for automatically grabbing log files includes: when receiving a log grabbing instruction of a preset type, starting a corresponding log grabbing script; whenever a log of the preset type is generated When the log grabbing script is used, the log of the preset type is written into the log file of the preset storage space; after receiving the stop grabbing instruction, the log grabbing script is closed. The method for automatically grabbing log files of the present disclosure can obtain the required log files in a computer device in time, so as to locate and analyze problems in time and improve user experience.
为使本公开的上述目的、特征和优点能更明显易懂,下文特举可选实施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned objects, features and advantages of the present disclosure more obvious and easy to understand, optional embodiments are exemplified below, and are described in detail as follows in conjunction with the accompanying drawings.
附图说明Description of drawings
为了更清楚地说明本公开的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本公开的某些实施例,因此不应被看作是对本公开保护范围的限定。在各个附图中,类似的构成部分采用类似的编号。In order to illustrate the technical solutions of the present disclosure more clearly, the accompanying drawings required in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of the present disclosure, and therefore should not be It is regarded as a limitation on the scope of protection of the present disclosure. In the various figures, similar components are numbered similarly.
图1是本公开实施例提供的一种日志文件自动抓取方法的流程图;1 is a flowchart of a method for automatically grabbing log files provided by an embodiment of the present disclosure;
图2是本公开实施例提供的一种写入日志文件的流程图;FIG. 2 is a flowchart of writing a log file provided by an embodiment of the present disclosure;
图3是本公开实施例提供的另一种写入日志文件的流程图;3 is another flowchart of writing a log file provided by an embodiment of the present disclosure;
图4是本公开实施例提供的另一种日志文件自动抓取方法的流程图;4 is a flowchart of another method for automatically grabbing log files provided by an embodiment of the present disclosure;
图5是本公开实施例提供的又一种日志文件自动抓取方法的流程图;5 is a flowchart of another method for automatically grabbing log files provided by an embodiment of the present disclosure;
图6是本公开实施例提供的一种日志文件自动抓取装置的结构示意图。FIG. 6 is a schematic structural diagram of an apparatus for automatically grabbing log files according to an embodiment of the present disclosure.
具体实施方式detailed description
下面将结合本公开实施例中附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的本实施例中介绍的各实现方式仅是本公开一部分可能的实现方式,而不是全部的实现方式。The technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the implementations introduced in the described embodiments are only part of the possible implementations of the present disclosure. rather than all implementations.
通常在此处附图中描述和示出的本公开实现方式的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本公开的实现方式的详细描述并非旨在限制要求保护的本公开的范围,而是仅仅表示本公开的选定实施例。基于本公开的实现方式,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本公开保护的范围。The components of implementations of the present disclosure generally described and illustrated in the drawings herein may be arranged and designed in a variety of different configurations. Therefore, the following detailed description of implementations of the present disclosure provided in the accompanying drawings are not intended to limit the scope of the disclosure as claimed, but are merely representative of selected embodiments of the disclosure. Based on the implementation manner of the present disclosure, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present disclosure.
在下文中,可在本公开的各种实施例中使用的术语“包括”、“具有”及其同源词仅意在表示特定特征、数字、步骤、操作、元件、组件或前述项的组合,并且不应被理解为首先排除一个或更多个其它特征、数字、步骤、操作、元件、组件或前述项的组合的存在或增加一个或更多个特征、数字、步骤、操作、元件、组件或前述项的组合的可能性。Hereinafter, the terms "comprising", "having" and their cognates, which may be used in various embodiments of the present disclosure, are only intended to mean a particular feature, number, step, operation, element, component, or combination of the foregoing, and should not be construed as first excluding the presence of or adding one or more other features, numbers, steps, operations, elements, components or combinations of the foregoing or the possibility of a combination of the foregoing.
此外,术语“第一”、“第二”、“第三”等仅用于区分描述,而不能理解为指示或暗示相对重要性。Furthermore, the terms "first", "second", "third", etc. are only used to differentiate the description and should not be construed as indicating or implying relative importance.
除非另有限定,否则在这里使用的所有术语(包括技术术语和科学术语)具有与本公开的各种实施例所属领域普通技术人员通常理解的含义相同的含义。所述术语(诸如在一般使用的词典中限定的术语)将被解释为具有与在相关技术领域中的语境含义相同的含义并且将不被解释为具有理想化的含义或过于正式的含义,除非在本公开的各种实施例中被清楚地限定。Unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art to which various embodiments of this disclosure belong. The terms (such as those defined in commonly used dictionaries) will be interpreted as having the same meaning as the contextual meaning in the relevant technical field and will not be interpreted as having an idealized or overly formal meaning, unless explicitly defined in various embodiments of the present disclosure.
图1是本公开所示的一种日志文件自动抓取方法的流程图,该方法包括如下步骤:FIG. 1 is a flowchart of a method for automatically grabbing log files shown in the present disclosure, and the method includes the following steps:
步骤S11:在接收到预设类型日志抓取指令时,开启相应的日志抓取脚本。Step S11 : when a preset type log grabbing instruction is received, start a corresponding log grabbing script.
计算机设备操作系统中各种软件模块之间的耦合度越来越高,各种软件模块之间的交互越来越频繁,因此经常会出现一些问题,因此在计算机设备中设置有日志生成的模块,以便记录计算机设备操作系统在运行的过程中的时间或者消息等,以便后续对计算机设备产生的各种问题进行诊断、追踪以及处理。The degree of coupling between various software modules in the computer equipment operating system is getting higher and higher, and the interaction between various software modules is becoming more and more frequent, so some problems often occur. Therefore, a log generation module is set in the computer equipment. , so as to record the time or messages during the running process of the computer equipment operating system, so as to diagnose, track and deal with various problems generated by the computer equipment subsequently.
在一种可能的实现方式中,在计算机设备中可以预先存储有各种预设类型日志的日志抓取脚本,用户可以根据需求向计算机设备输入预设类型的日志抓取指令,以开启相应的日志抓取脚本,利用该日志抓取脚本抓取出相应的日志。例如,计算机设备经常复现一个相同的错误,为了解决这个错误需要用到相应的错误日志,用户则可以向计算机设备输入错误日志抓取指令,以开启相应的错误日志抓取脚本,以实时抓取计算机设备在运行过程 中的错误日志,而在错误复现后,用户则可以关闭该抓取脚本,获取脚本生成的日志文件,则可进行相应错误数据的分析。其中,预设类型日志包括错误日志、访问日志、消息日志、警告日志以及调试日志中至少一种日志。In a possible implementation manner, log grabbing scripts of various preset types of logs may be pre-stored in the computer device, and the user may input preset types of log grabbing instructions to the computer device according to requirements to enable corresponding log grabbing instructions. Log grabbing script, use the log grabbing script to grab the corresponding logs. For example, a computer device often reproduces the same error. In order to solve this error, the corresponding error log needs to be used. The user can input the error log capture command to the computer device to start the corresponding error log capture script to capture the error log in real time. Obtain the error log of the computer device during the running process, and after the error recurs, the user can close the grab script, obtain the log file generated by the script, and then analyze the corresponding error data. The preset type of logs includes at least one of an error log, an access log, a message log, a warning log, and a debug log.
步骤S12:每当产生所述预设类型日志时,通过所述日志抓取脚本将所述预设类型日志写入预设存储空间的日志文件。Step S12: Whenever the log of the preset type is generated, the log of the preset type is written into the log file of the preset storage space through the log capture script.
在一种可能的实现方式中,在计算机设备产生新的预设类型的日志时,通过该日志抓取脚本则可将预设类型日志写入预设存储空间的日志文件,以便用户可以在预设存储空间进行相应日志的查询。并且,在计算机设备出现问题时,用户可以开启相应日志的抓取脚本,在问题复现后将相应的日志文件上传至售后服务端,或者通知服务人员通过远程网络从预设空间中获取相应的日志文件,以便解决出现的问题。In a possible implementation manner, when the computer device generates a new log of the preset type, the log of the preset type can be written into the log file of the preset storage space through the log capture script, so that the user can Set the storage space to query the corresponding log. Moreover, when there is a problem with the computer equipment, the user can start the capture script of the corresponding log, upload the corresponding log file to the after-sales service after the problem recurs, or notify the service personnel to obtain the corresponding log file from the preset space through the remote network. log file in order to troubleshoot problems.
步骤S13:在接收到停止抓取指令后,关闭所述日志抓取脚本。Step S13: After receiving the stop scraping instruction, close the log scraping script.
在一种可能的实现方式中,在用户获取到相应的日志文件,不需要再进行预设类型日志的抓取后可以输入停止抓取指令至计算机设备,以控制计算机设备关闭日志抓取脚本。In a possible implementation manner, after the user obtains the corresponding log file and does not need to capture the preset type of logs, he can input a stop capture instruction to the computer device to control the computer device to close the log capture script.
在一种可能的实现方式中,上述计算机设备包括移动终端、平板电脑以及智能显示设备等,这里不做限定。例如在电视机出现问题的时候,利用上述方法步骤用户可以开启问题相应的日志抓取脚本,然后正常运行电视机等待问题复现,即可获得相应的问题日志文件,以便利用该日志文件分析问题以及解决问题。通过上述方法用户可以及时获取计算机设备中所需的日志文件,以便及时定位以及分析问题,提高用户的体验度。In a possible implementation manner, the above-mentioned computer equipment includes a mobile terminal, a tablet computer, and a smart display device, etc., which are not limited here. For example, when there is a problem with the TV, the user can use the above method and steps to open the log capture script corresponding to the problem, then run the TV normally and wait for the problem to recur, and then obtain the corresponding log file of the problem, so that the log file can be used to analyze the problem. and problem solving. Through the above method, the user can obtain the required log file in the computer device in time, so as to locate and analyze the problem in time, and improve the user's experience.
图2是本公开提供的一种写入日志文件的流程图,包括如下步骤:FIG. 2 is a flow chart of writing a log file provided by the present disclosure, including the following steps:
步骤S21:获取所述日志文件的大小信息,若所述日志文件的大小低于预设值时,继续向所述日志文件写入所述预设类型日志。Step S21: Obtain the size information of the log file, and if the size of the log file is lower than a preset value, continue to write the preset type of log to the log file.
在一种可能的实现方式中,在抓取新产生的预设类型日志写入预设存储空间前,还可以获取需要写入的日志文件的大小信息,并判断日志文件的大小是否低于预设值,若低于预设值则可继续向日志文件写入该预设类型日志。In a possible implementation, before capturing the newly generated preset type log and writing it to the preset storage space, the size information of the log file to be written can also be obtained, and it is determined whether the size of the log file is lower than the preset size. If the value is lower than the preset value, the log of the preset type can continue to be written to the log file.
步骤S22:若所述日志文件的大小大于或等于所述预设值时,在所述预设存储空间创建新的日志文件,并将后续的所述预设类型日志写入新的日志文件。Step S22: If the size of the log file is greater than or equal to the preset value, create a new log file in the preset storage space, and write subsequent logs of the preset type into the new log file.
在一种可能的实现方式中,若待写入的日志文件大小大于或等于预设值时,则在预设存储空间中创建新的日志文件,将预设类型日志写入新的日志文件中。也即日志文件的大小是限定的,并且大小可以由用户来进行设置。In a possible implementation, if the size of the log file to be written is greater than or equal to the preset value, a new log file is created in the preset storage space, and the preset type of log is written into the new log file . That is, the size of the log file is limited, and the size can be set by the user.
图3是本公开提供的另一种写入日志文件的流程图,还包括如下步骤:3 is another flowchart of writing a log file provided by the present disclosure, further comprising the following steps:
步骤S23:在所述预设存储空间建立新的日志文件之前,判断所述预设存储空间的日 志文件数量是否大于预设数量,若大于预设数量,则删除建立日期最早的日志文件。Step S23: Before establishing a new log file in the preset storage space, determine whether the number of log files in the preset storage space is greater than the preset number, and if greater than the preset number, delete the log file with the earliest creation date.
在一种可能的实现方式中,预设存储空间中的日志文件数量也可以进行限制,在日志文件数量达到上限时,在建立新的日志文件后将删除建立日期最早的日志文件。通过对日志文件的大小以及数量的限制,可以限定预设存储空间的大小,避免预设存储空间过大占用计算机设备的资源。In a possible implementation manner, the number of log files in the preset storage space may also be limited. When the number of log files reaches the upper limit, the log file with the earliest creation date will be deleted after a new log file is created. By limiting the size and number of log files, the size of the preset storage space can be limited, so as to prevent the preset storage space from occupying the resources of the computer device.
图4是本公开提供的另一种日志文件自动抓取方法的流程图,该方法包括如下步骤:4 is a flowchart of another method for automatically grabbing log files provided by the present disclosure, and the method includes the following steps:
步骤S41:在接收到预设类型日志抓取指令时,开启相应的日志抓取脚本。Step S41 : when a preset type log grabbing instruction is received, start a corresponding log grabbing script.
此步骤与上述步骤S11一致,在此不再赘述。This step is the same as the above-mentioned step S11, and is not repeated here.
步骤S42:每当产生所述预设类型日志时,通过所述日志抓取脚本将所述预设类型日志写入预设存储空间的日志文件。Step S42: Whenever the preset type of log is generated, write the preset type of log into a log file of a preset storage space through the log capture script.
此步骤与上述步骤S12一致,在此不再赘述。This step is the same as the above-mentioned step S12, and is not repeated here.
步骤S43:在接收到停止抓取指令后,关闭所述日志抓取脚本。Step S43: After receiving the stop scraping instruction, close the log scraping script.
此步骤与上述步骤S13一致,在此不再赘述。This step is the same as the above-mentioned step S13, and is not repeated here.
步骤S44:将所述日志文件传输至售后服务端。Step S44: Transmit the log file to the after-sale service terminal.
步骤S45:接收所述售后服务端发送的基于所述日志文件的升级包,并运行所述升级包。Step S45: Receive an upgrade package based on the log file sent by the after-sale service terminal, and run the upgrade package.
在一种可能的实现方式中,在生成日志文件后还可以将该日志文件发送至售后服务端,以便售后服务端的工作人员根据日志文件监控计算机设备的运行情况,在发现计算机设备运行出问题时可以根据该日志文件进行问题的分析以及生成相应的升级包。而计算机设备还可以接受售后服务端基于日志文件的升级包,进行相应的升级以解决计算机设备在运行时复现的问题。In a possible implementation manner, after the log file is generated, the log file can also be sent to the after-sales service terminal, so that the staff of the after-sales service terminal can monitor the operation of the computer equipment according to the log file. You can analyze the problem and generate the corresponding upgrade package based on the log file. The computer equipment can also accept an upgrade package based on the log file from the after-sale service, and perform corresponding upgrades to solve the problem that the computer equipment recurs during operation.
图5是本公开提供的又一种日志文件自动抓取方法的流程图,该方法包括如下步骤:5 is a flowchart of another method for automatically grabbing log files provided by the present disclosure, and the method includes the following steps:
步骤S51:在接收到预设类型日志抓取指令时,开启相应的日志抓取脚本。Step S51 : when a preset type log grabbing instruction is received, start a corresponding log grabbing script.
此步骤与上述步骤S11一致,在此不再赘述。This step is the same as the above-mentioned step S11, and is not repeated here.
步骤S52:每当产生所述预设类型日志时,通过所述日志抓取脚本将所述预设类型日志写入预设存储空间的日志文件。Step S52: Whenever the preset type of log is generated, write the preset type of log into a log file of a preset storage space through the log capture script.
此步骤与上述步骤S12一致,在此不再赘述。This step is the same as the above-mentioned step S12, and is not repeated here.
步骤S53:在接收到停止抓取指令后,关闭所述日志抓取脚本。Step S53: After receiving the stop scraping instruction, close the log scraping script.
此步骤与上述步骤S13一致,在此不再赘述。This step is the same as the above-mentioned step S13, and is not repeated here.
步骤S54:在预设问题日志复现后,关闭所述日志抓取脚本。Step S54: After the preset problem log is reproduced, the log grabbing script is closed.
在一种可能的实现方式中,用户在计算机设备出现问题后,可以相应的设置一个预设问题日志,例如在计算机设备出现错误时,可以将该错误产生的日志设置为预设问题日志,在该预设问题日志复现后,进行该预设问题日志的抓取以及写入日志文件,并关闭该日志抓取脚本,避免日志抓取脚本长期运行占用计算机设备资源。In a possible implementation manner, the user can set a preset problem log correspondingly after a problem occurs in the computer device. For example, when an error occurs in the computer device, the log generated by the error can be set as the preset problem log. After the preset problem log is reproduced, the preset problem log is captured and written to the log file, and the log capture script is closed, so as to avoid the long-term operation of the log capture script from occupying computer equipment resources.
图6是本公开提供的一种日志文件自动抓取装置的结构示意图。FIG. 6 is a schematic structural diagram of an automatic log file grabbing device provided by the present disclosure.
该日志文件自动抓取装置600包括:The log file automatic grabbing device 600 includes:
抓取脚本启动模块610,配置成在接收到预设类型日志抓取指令时,开启相应的日志抓取脚本;A crawling script startup module 610, configured to start a corresponding log crawling script when a preset type of log crawling instruction is received;
日志文件写入模块620,配置成每当产生所述预设类型日志时,通过所述日志抓取脚本将所述预设类型日志写入预设存储空间的日志文件;The log file writing module 620 is configured to write the preset type log into the log file of the preset storage space through the log grab script whenever the preset type log is generated;
抓取脚本关闭模块630,配置成在接收到停止抓取指令后,关闭所述日志抓取脚本。The crawling script closing module 630 is configured to close the log crawling script after receiving the stop crawling instruction.
在一种可能的实现方式中,日志文件写入模块620,还配置成获取日志文件的大小信息,若日志文件的大小低于预设值时,继续向日志文件写入预设类型日志;日志文件写入模块620,还配置成若日志文件的大小大于或等于预设值时,在预设存储空间创建新的日志文件,并将后续的预设类型日志写入新的日志文件。In a possible implementation manner, the log file writing module 620 is further configured to obtain the size information of the log file, and if the size of the log file is lower than a preset value, continue to write a preset type of log to the log file; The file writing module 620 is further configured to create a new log file in the preset storage space if the size of the log file is greater than or equal to the preset value, and write subsequent logs of the preset type into the new log file.
在一种可能的实现方式中,日志文件自动抓取装置600还包括日志文件处理模块:In a possible implementation manner, the log file automatic grabbing device 600 further includes a log file processing module:
日志文件处理模块,配置成在预设存储空间建立新的日志文件之前,判断预设存储空间的日志文件数量是否大于预设数量,若大于预设数量,则删除建立日期最早的日志文件。The log file processing module is configured to determine whether the number of log files in the preset storage space is greater than the preset number before creating a new log file in the preset storage space, and if it is greater than the preset number, delete the log file with the earliest creation date.
日志文件处理模块,还配置成将日志文件传输至售后服务端;日志文件处理模块,还配置成接收售后服务端发送的基于日志文件的升级包,并运行升级包。The log file processing module is further configured to transmit the log file to the after-sales service terminal; the log file processing module is further configured to receive the log file-based upgrade package sent by the after-sales service terminal, and run the upgrade package.
日志文件处理模块,还配置成在预设问题日志复现后,关闭日志抓取脚本。The log file processing module is also configured to close the log capture script after the preset problem log recurs.
日志文件处理模块,还配置成在预设问题日志复现后,将相应的日子文件上传至售后服务端。The log file processing module is also configured to upload the corresponding date file to the after-sales service terminal after the preset problem log is reproduced.
日志文件处理模块,还配置成在预设问题日志复现后,通知服务人员通过远程网络获取相应的日志文件。The log file processing module is further configured to notify the service personnel to obtain the corresponding log file through the remote network after the preset problem log recurs.
在一种可能的实现方式中,上述各个模块更加详细的功能描述可以参考前述实施例中相应部分的内容,在此不再赘述。In a possible implementation manner, for more detailed functional descriptions of the above-mentioned modules, reference may be made to the contents of the corresponding parts in the foregoing embodiments, which will not be repeated here.
此外,本公开还提供了一种计算机设备,该计算机设备包括存储器和处理器,存储器可配置成存储计算机程序,处理器通过运行所述计算机程序,从而使计算机设备执行上述方法或者上述日志文件自动抓取装置中的各个模块的功能。In addition, the present disclosure also provides a computer device, the computer device includes a memory and a processor, the memory can be configured to store a computer program, and the processor runs the computer program, so that the computer device executes the above method or the above log file automatically Function of the individual modules in the gripper.
存储器可包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据计算机设备的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory may include a stored program area and a stored data area, wherein the stored program area may store an operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like; data (such as audio data, phone book, etc.) Additionally, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
本实施例还提供了一种可读存储介质,配置成储存上述计算机设备中使用的计算机程序。This embodiment also provides a readable storage medium configured to store the computer program used in the above-mentioned computer device.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置和方法,也可以通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,附图中的流程图和结构图显示了根据本公开的多个实施例的装置、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段或代码的一部分,所述模块、程序段或代码的一部分包含一个或多个配置成实现规定的逻辑功能的可执行指令。也应当注意,在作为替换的实现方式中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个连续的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,结构图和/或流程图中的每个方框、以及结构图和/或流程图中的方框的组合,可以用执行规定的功能或动作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may also be implemented in other manners. The apparatus embodiments described above are only schematic, for example, the flowcharts and structural diagrams in the accompanying drawings show the possible implementation architectures and functions of the apparatuses, methods and computer program products according to various embodiments of the present disclosure and operation. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more functions configured to implement the specified logical function(s) executable instructions. It should also be noted that, in alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It is also noted that each block of the block diagrams and/or flow diagrams, and combinations of blocks in the block diagrams and/or flow diagrams, can be implemented using dedicated hardware-based systems that perform the specified functions or actions. be implemented, or may be implemented in a combination of special purpose hardware and computer instructions.
另外,在本公开各个实施例中的各功能模块或单元可以集成在一起形成一个独立的部分,也可以是各个模块单独存在,也可以两个或更多个模块集成形成一个独立的部分。In addition, each functional module or unit in each embodiment of the present disclosure may be integrated together to form an independent part, or each module may exist alone, or two or more modules may be integrated to form an independent part.
所述功能如果以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是智能手机、个人计算机、服务器、或者网络设备等)执行本公开各个实现方式所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光盘等各种可以存储程序代码的介质。If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the present disclosure can be embodied in the form of software products in essence, or the parts that contribute to the prior art or the parts of the technical solutions. The computer software products are stored in a storage medium, including Several instructions are used to cause a computer device (which may be a smart phone, a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in various implementations of the present disclosure. The aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .
以上所述,仅为本公开的可选地实施方式,但本公开的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本公开的保护范围之内。因此,本公开的保护范围应所述以权利要求的保护范围为准。The above are only optional embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any person skilled in the art who is familiar with the technical field of the present disclosure can easily think of changes or substitutions within the technical scope of the present disclosure. , should be covered within the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
工业实用性Industrial Applicability
本公开提供一种日志文件自动抓取方法,该日志文件自动抓取方法包括:在接收到预 设类型日志抓取指令时,开启相应的日志抓取脚本;每当产生所述预设类型日志时,通过所述日志抓取脚本将所述预设类型日志写入预设存储空间的日志文件;在接收到停止抓取指令后,关闭所述日志抓取脚本。本公开的日志文件自动抓取方法,可以及时获取计算机设备中所需的日志文件,以便及时定位以及分析问题,提高用户的体验度。The present disclosure provides a method for automatically grabbing log files. The method for automatically grabbing log files includes: when receiving a log grabbing instruction of a preset type, starting a corresponding log grabbing script; whenever a log of the preset type is generated When the log grabbing script is used, the log of the preset type is written into the log file of the preset storage space; after receiving the stop grabbing instruction, the log grabbing script is closed. The method for automatically grabbing log files of the present disclosure can obtain the required log files in a computer device in time, so as to locate and analyze problems in time and improve user experience.

Claims (18)

  1. 一种日志文件自动抓取方法,其特征在于,所述方法包括:A method for automatically grabbing log files, characterized in that the method comprises:
    在接收到预设类型日志抓取指令时,开启相应的日志抓取脚本;When receiving a preset type of log grabbing instruction, start the corresponding log grabbing script;
    每当产生所述预设类型日志时,通过所述日志抓取脚本将所述预设类型日志写入预设存储空间的日志文件;Whenever the preset type log is generated, write the preset type log into the log file of the preset storage space through the log grab script;
    在接收到停止抓取指令后,关闭所述日志抓取脚本。After receiving the stop scraping instruction, close the log scraping script.
  2. 根据权利要求1所述的日志文件自动抓取方法,其特征在于,所述预设类型日志包括错误日志、访问日志、消息日志、警告日志以及调试日志中至少一种日志。The method for automatically grabbing log files according to claim 1, wherein the preset type of logs includes at least one of an error log, an access log, a message log, a warning log, and a debug log.
  3. 根据权利要求1或2所述的日志文件自动抓取方法,其特征在于,所述通过所述日志抓取脚本将所述预设类型日志写入预设存储空间的日志文件包括:The method for automatically grabbing log files according to claim 1 or 2, wherein the writing of the preset type log into the log file of the preset storage space through the log grabbing script comprises:
    获取所述日志文件的大小信息,若所述日志文件的大小低于预设值时,继续向所述日志文件写入所述预设类型日志;Obtain the size information of the log file, and if the size of the log file is lower than a preset value, continue to write the preset type of log to the log file;
    若所述日志文件的大小大于或等于所述预设值时,在所述预设存储空间创建新的日志文件,并将后续的所述预设类型日志写入新的日志文件。If the size of the log file is greater than or equal to the preset value, a new log file is created in the preset storage space, and subsequent logs of the preset type are written into the new log file.
  4. 根据权利要求3所述的日志文件自动抓取方法,其特征在于,所述方法还包括:The method for automatically grabbing log files according to claim 3, wherein the method further comprises:
    在所述预设存储空间建立新的日志文件之前,判断所述预设存储空间的日志文件数量是否大于预设数量,若大于预设数量,则删除建立日期最早的日志文件。Before creating a new log file in the preset storage space, it is determined whether the number of log files in the preset storage space is greater than the preset number, and if it is greater than the preset number, the log file with the earliest creation date is deleted.
  5. 根据权利要求1-4任意一项所述的日志文件自动抓取方法,其特征在于,所述预设存储空间包括设备内部存储空间的预设分区和/或预先连接所述设备的外部存储空间。The method for automatically grabbing log files according to any one of claims 1-4, wherein the preset storage space includes a preset partition of an internal storage space of a device and/or an external storage space pre-connected to the device .
  6. 根据权利要求1-5任意一项所述的日志文件自动抓取方法,其特征在于,所述方法还包括:The method for automatically grabbing log files according to any one of claims 1-5, wherein the method further comprises:
    将所述日志文件传输至售后服务端;transmitting the log file to the after-sales service terminal;
    接收所述售后服务端发送的基于所述日志文件的升级包,并运行所述升级包。Receive an upgrade package based on the log file sent by the after-sale service terminal, and run the upgrade package.
  7. 根据权利要求1-6任意一项所述的日志文件自动抓取方法,其特征在于,所述方法还包括:The method for automatically grabbing log files according to any one of claims 1-6, wherein the method further comprises:
    在预设问题日志复现后,关闭所述日志抓取脚本。After the preset problem log is reproduced, the log grabbing script is closed.
  8. 根据权利要求1-7任意一项所述的日志文件自动抓取方法,其特征在于,所述方法还包括:The method for automatically grabbing log files according to any one of claims 1-7, wherein the method further comprises:
    在预设问题日志复现后,将相应的日子文件上传至售后服务端。After the preset problem log recurs, upload the corresponding date file to the after-sales service terminal.
  9. 根据权利要求1-7任意一项所述的日志文件自动抓取方法,其特征在于,所述 方法还包括:The method for automatically grabbing log files according to any one of claims 1-7, wherein the method further comprises:
    在预设问题日志复现后,通知服务人员通过远程网络获取相应的日志文件。After the preset problem log recurs, notify the service personnel to obtain the corresponding log file through the remote network.
  10. 一种日志文件自动抓取装置,其特征在于,包括:An automatic grabbing device for log files, comprising:
    抓取脚本启动模块,配置成在接收到预设类型日志抓取指令时,开启相应的日志抓取脚本;The crawling script startup module is configured to start the corresponding log crawling script when a preset type of log crawling instruction is received;
    日志文件写入模块,配置成每当产生所述预设类型日志时,通过所述日志抓取脚本将所述预设类型日志写入预设存储空间的日志文件;A log file writing module, configured to write the preset type log into the log file of the preset storage space through the log grab script whenever the preset type log is generated;
    抓取脚本关闭模块,配置成在接收到停止抓取指令后,关闭所述日志抓取脚本。The crawling script closing module is configured to close the log crawling script after receiving the stop crawling instruction.
  11. 根据权利要求10所述的日志文件自动抓取装置,其特征在于,所述日志文件写入模块,还配置成获取所述日志文件的大小信息,若所述日志文件的大小低于预设值时,继续向所述日志文件写入所述预设类型日志;The log file automatic grabbing device according to claim 10, wherein the log file writing module is further configured to obtain the size information of the log file, if the size of the log file is lower than a preset value When , continue to write the preset type log to the log file;
    所述日志文件写入模块,还配置成若所述日志文件的大小大于或等于所述预设值时,在所述预设存储空间创建新的日志文件,并将后续的所述预设类型日志写入新的日志文件。The log file writing module is further configured to create a new log file in the preset storage space if the size of the log file is greater than or equal to the preset value, and assign the subsequent preset type to the log file. The log is written to a new log file.
  12. 根据权利要求10或11所述的日志文件自动抓取装置,其特征在于,所述装置还包括日志文件处理模块;The log file automatic grabbing device according to claim 10 or 11, wherein the device further comprises a log file processing module;
    所述日志文件处理模块,配置成在所述预设存储空间建立新的日志文件之前,判断所述预设存储空间的日志文件数量是否大于预设数量,若大于预设数量,则删除建立日期最早的日志文件。The log file processing module is configured to determine whether the number of log files in the preset storage space is greater than a preset number before creating a new log file in the preset storage space, and if it is greater than the preset number, delete the creation date The oldest log file.
  13. 根据权利要求10-12任意一项所述的日志文件自动抓取装置,其特征在于,所述装置还包括日志文件处理模块;The automatic log file grabbing device according to any one of claims 10-12, wherein the device further comprises a log file processing module;
    所述日志文件处理模块,还配置成将所述日志文件传输至售后服务端;The log file processing module is also configured to transmit the log file to the after-sales service terminal;
    所述日志文件处理模块,还配置成接收所述售后服务端发送的基于所述日志文件的升级包,并运行所述升级包。The log file processing module is further configured to receive an upgrade package based on the log file sent by the after-sale service terminal, and run the upgrade package.
  14. 根据权利要求10-13任意一项所述的日志文件自动抓取装置,其特征在于,所述装置还包括日志文件处理模块;The automatic log file grabbing device according to any one of claims 10-13, wherein the device further comprises a log file processing module;
    所述日志文件处理模块,还配置成在预设问题日志复现后,关闭所述日志抓取脚本。The log file processing module is further configured to close the log capture script after the preset problem log is reproduced.
  15. 根据权利要求10-14任意一项所述的日志文件自动抓取装置,其特征在于,所述装置还包括日志文件处理模块;The automatic log file grabbing device according to any one of claims 10-14, wherein the device further comprises a log file processing module;
    所述日志文件处理模块,还配置成在预设问题日志复现后,将相应的日子文件上传至售后服务端。The log file processing module is further configured to upload the corresponding date file to the after-sales service terminal after the preset problem log is reproduced.
  16. 根据权利要求10-14任意一项所述的日志文件自动抓取装置,其特征在于,所述装置还包括日志文件处理模块;The automatic log file grabbing device according to any one of claims 10-14, wherein the device further comprises a log file processing module;
    所述日志文件处理模块,还配置成在预设问题日志复现后,通知服务人员通过远程网络获取相应的日志文件。The log file processing module is further configured to notify service personnel to obtain the corresponding log file through a remote network after the preset problem log is reproduced.
  17. 一种计算机设备,其特征在于,包括存储器以及处理器,所述存储器存储有计算机程序,所述处理器运行所述计算机程序以使所述计算机设备执行根据权利要求1至9中任一项所述的日志文件自动抓取方法。A computer device, characterized by comprising a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to cause the computer device to execute the computer program according to any one of claims 1 to 9. The log file automatic crawling method described above.
  18. 一种可读存储介质,其特征在于,其存储有计算机程序,所述计算机程序在处理器上运行时执行权利要求1至9中任一项所述的日志文件自动抓取方法。A readable storage medium, characterized in that it stores a computer program, and the computer program executes the method for automatically grabbing log files according to any one of claims 1 to 9 when the computer program runs on a processor.
PCT/CN2020/125556 2020-08-20 2020-10-30 Method and apparatus for automatically capturing log file, and computer device WO2022036865A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010844710.8A CN111930703A (en) 2020-08-20 2020-08-20 Automatic log file capturing method and device and computer equipment
CN202010844710.8 2020-08-20

Publications (1)

Publication Number Publication Date
WO2022036865A1 true WO2022036865A1 (en) 2022-02-24

Family

ID=73304919

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/125556 WO2022036865A1 (en) 2020-08-20 2020-10-30 Method and apparatus for automatically capturing log file, and computer device

Country Status (2)

Country Link
CN (1) CN111930703A (en)
WO (1) WO2022036865A1 (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115190009B (en) * 2021-03-22 2024-03-19 广州汽车集团股份有限公司 Vehicle-mounted multimedia part log export method and system and storage medium
CN113900903B (en) * 2021-10-27 2023-06-16 深圳星火半导体科技有限公司 Log storage device, log capturing method and storage medium
CN115190189A (en) * 2022-07-08 2022-10-14 中国银行股份有限公司 Message information processing method and device
CN117130808A (en) * 2023-02-22 2023-11-28 荣耀终端有限公司 Log acquisition method and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103678089A (en) * 2012-09-20 2014-03-26 北京南车时代信息技术有限公司 Log output method and system for distributed software system
CN103778049A (en) * 2012-10-19 2014-05-07 北京市三希电子科技开发公司 Embedded system development log system
CN107766219A (en) * 2017-10-30 2018-03-06 郑州云海信息技术有限公司 Automated testing log collection method, system, equipment and computer memory device
CN110457258A (en) * 2019-08-06 2019-11-15 北京字节跳动网络技术有限公司 A kind of blog management method, device, equipment and medium
CN111475379A (en) * 2020-03-27 2020-07-31 苏州浪潮智能科技有限公司 Log processing method and device, electronic equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103678089A (en) * 2012-09-20 2014-03-26 北京南车时代信息技术有限公司 Log output method and system for distributed software system
CN103778049A (en) * 2012-10-19 2014-05-07 北京市三希电子科技开发公司 Embedded system development log system
CN107766219A (en) * 2017-10-30 2018-03-06 郑州云海信息技术有限公司 Automated testing log collection method, system, equipment and computer memory device
CN110457258A (en) * 2019-08-06 2019-11-15 北京字节跳动网络技术有限公司 A kind of blog management method, device, equipment and medium
CN111475379A (en) * 2020-03-27 2020-07-31 苏州浪潮智能科技有限公司 Log processing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111930703A (en) 2020-11-13

Similar Documents

Publication Publication Date Title
WO2022036865A1 (en) Method and apparatus for automatically capturing log file, and computer device
US9129058B2 (en) Application monitoring through continuous record and replay
US11188560B2 (en) Synchronizing object in local object storage node
US9124669B2 (en) Cooperative client and server logging
CN104636435A (en) Cloud terminal screen recording method
KR101590947B1 (en) Method, apparatus, program and storage medium for sharing data
CN110333981B (en) APP abnormal information feedback method and device and electronic equipment
WO2013189263A1 (en) Method and device for monitoring api function scheduling in mobile terminal
CN109783316B (en) Method and device for identifying tampering behavior of system security log, storage medium and computer equipment
CN109587141B (en) System and method for obtaining evidence by remote server
US10831634B1 (en) Replication of user interface events
CN108647284B (en) Method and device for recording user behavior, medium and computing equipment
US11968095B2 (en) Capturing and correlating multiple sources of debugging information relating to a network resource via a browser extension
JP2008257413A (en) System which automatically detects fault information of system and automatically samples, encrypts and transmits log files during installation/normal operation/fault
CN111343132B (en) File transmission detection method and device and storage medium
US8171345B2 (en) Disablement of an exception generating operation of a client system
CN109583192A (en) A kind of fixed safety system of mobile terminal application and method based on emulation
CN111311194B (en) Method, system and storage medium for linking pen records with audio/video records in interrogation process
RU2671999C1 (en) Method and system for diagnostics of mobile computer devices
EA036911B1 (en) Method and system for diagnostics of mobile computer devices
US11836063B2 (en) System, control device, log extraction method, and computer-readable medium
US20240143473A1 (en) Systems and methods for dynamically configuring a client application
CN111145794A (en) Recording method, device, system, recording equipment and storage medium
US11777833B2 (en) Non-intrusive disaster recovery and resilience
CN116070268B (en) Privacy data identification monitoring method, device and equipment

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 20950068

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 29.06.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 20950068

Country of ref document: EP

Kind code of ref document: A1