A log reporting method and device, computer equipment and storage medium
Patent Information
- Application Number
- CN202211321177.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-26
- Publication Date
- 2026-10-20
- Estimated Expiration
- 2042-10-26
AI Technical Summary
[0002]目前,提交前端缺陷时,在描述问题的时同时会提供用户数据,前端开发解决缺陷通过复现问题获取到系统及日志信息后,才开始排查定位问题,若遇到偶发缺陷复现困难,大多只能延期或待再次复现后处理
[0042]本申请实施例包括:获取针对应用程序的信息采集配置信息;基于信息采集配置信息,采集应用程序在多个不同维度上的日志信息;基于信息采集配置信息中的采集主体信息,对多个不同维度上的日志信息进行整合处理,得到至少一个采集日志;基于每个采集日志对应的采集主体信息,将每个采集日志分别存储至对应的目标文件夹;接收上报指令,基于上报指令将目标文件夹进行上报,通过本申请实施例可以提高测试和开发的工作效率,从而提高生产质量。
Smart Images

Figure CN115617612B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of communication technology, specifically to a log reporting method, apparatus, computer device, and storage medium. Background Technology
[0002] Currently, when submitting front-end defects, user data is provided along with the problem description. Front-end developers resolve defects by reproducing the problem and obtaining system and log information before they begin troubleshooting and locating the issue. If an intermittent defect is difficult to reproduce, it often has to be postponed or handled only after it is reproduced again. Therefore, in the daily defect resolution process, obtaining relevant system and log information takes up a lot of time, and there is even less reference information when handling intermittent defects. Summary of the Invention
[0003] This application provides a log reporting method, apparatus, computer device, and storage medium that can improve the efficiency of testing and developing applications, thereby improving production quality.
[0004] This application provides a log reporting method, including:
[0005] Obtain information collection configuration information for the application;
[0006] Based on the information collection configuration information, log information of the application is collected from multiple different dimensions;
[0007] Based on the collection subject information in the information collection configuration information, the log information from multiple different dimensions is integrated and processed to obtain at least one collection log.
[0008] Based on the data collection subject information corresponding to each data collection log, each data collection log is stored in its corresponding target folder.
[0009] Receive a reporting instruction and report the target folder based on the reporting instruction.
[0010] Accordingly, this application also provides a log reporting device, including:
[0011] The acquisition unit is used to acquire information collection configuration information for the application.
[0012] The collection unit is used to collect configuration information based on the information collected, and to collect log information of the application in multiple different dimensions.
[0013] An integration unit is used to integrate log information from multiple different dimensions based on the collection subject information in the information collection configuration information to obtain at least one collection log.
[0014] The storage unit is used to store each collection log into its corresponding target folder based on the collection subject information corresponding to each collection log.
[0015] The reporting unit is used to receive reporting instructions and report the target folder based on the reporting instructions.
[0016] In one embodiment, the acquisition unit may include:
[0017] The first parsing subunit is used to parse the information collection configuration information to obtain log collection permission information;
[0018] The verification subunit is used to verify the log collection permission information.
[0019] The collection subunit is used to collect log information of the application in multiple different dimensions when the log collection permission information is approved.
[0020] In one embodiment, the acquisition subunit may include:
[0021] The parsing module is used to parse the information collection configuration information when the log collection permission information is approved, so as to obtain at least one data collection dimension information;
[0022] The calling module is used to call the data collection component to collect log information of the application in multiple different dimensions based on the at least one data collection dimension information.
[0023] In one embodiment, the integration unit may include:
[0024] The second parsing subunit is used to parse the data collection subject information to obtain data collection instruction information for each data collection subject;
[0025] The combination subunit is used to combine log information from multiple different dimensions based on the data collection instruction information of each collection subject to obtain a data group corresponding to each collection subject.
[0026] The encapsulation subunit is used to encapsulate the data group corresponding to each collection subject to obtain at least one collection log.
[0027] In one embodiment, the combined subunit may include:
[0028] The filtering module is used to filter log information corresponding to dimensions that match the data collection indication information from log information on multiple different dimensions based on the data collection indication information of the collecting subject.
[0029] The permission verification module is used to verify the permissions of the data collection entity based on the log information corresponding to the matched dimension.
[0030] The combination module is used to combine the log information corresponding to the matching dimension into the data group when the permission verification is successful.
[0031] In one embodiment, the encapsulation subunit may include:
[0032] The identification module is used to identify the log information in the data group and obtain the data error instruction in the log information;
[0033] The mapping module is used to map the data error instructions to obtain the log reference level;
[0034] The layout module is used to format the log information in the data group according to a preset layout format to obtain the initial collection log;
[0035] The setting module is used to set the log level for the initial collection log based on the log reference level, thereby obtaining the collection log.
[0036] In one embodiment, the storage unit may include:
[0037] The sub-unit is determined based on the collection subject information corresponding to each collection log to determine the folder to be stored for each collection log.
[0038] The identification subunit is used to identify the folder to be stored and obtain the attribute information corresponding to the folder to be stored.
[0039] The storage subunit is used to store the collected logs into the folder to be stored when the attribute information of the folder to be stored meets the preset storage conditions, thereby obtaining the target folder.
[0040] Accordingly, this application also provides a computer device, which includes a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to execute any of the log reporting methods provided in this application.
[0041] Accordingly, this application also provides a storage medium storing a computer program, which, when executed by a processor, implements any of the log reporting methods provided in this application.
[0042] This application embodiment includes: acquiring information collection configuration information for an application; collecting log information of the application in multiple different dimensions based on the information collection configuration information; integrating and processing the log information in multiple different dimensions based on the collection subject information in the information collection configuration information to obtain at least one collection log; storing each collection log to a corresponding target folder based on the collection subject information corresponding to each collection log; receiving a reporting instruction and reporting the target folder based on the reporting instruction. This application embodiment can improve the efficiency of testing and development, thereby improving production quality. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 This is a schematic diagram of a scenario for the log reporting method provided in an embodiment of this application;
[0045] Figure 2 This is a flowchart illustrating the log reporting method provided in an embodiment of this application;
[0046] Figure 3 This is another scenario illustration of the log reporting method provided in the embodiments of this application;
[0047] Figure 4 This is another flowchart illustrating the log reporting method provided in the embodiments of this application;
[0048] Figure 5 This is another scenario illustration of the log reporting method provided in the embodiments of this application;
[0049] Figure 6 This is a schematic diagram of the log reporting device provided in the embodiments of this application;
[0050] Figure 7 This is a schematic diagram of the structure of the computer device provided in the embodiments of this application. Detailed Implementation
[0051] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. However, the described embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application without creative effort are within the scope of protection of this application.
[0052] This application provides a log reporting method, which can be executed by a log reporting device, which can be integrated into a computer device having at least one log reporting hardware. The computer device can include at least one of a computer and a server. That is, the log reporting method proposed in this application can be executed by a computer device, a server, or jointly by a terminal and a server capable of communicating with each other.
[0053] The terminals can be smartphones, tablets, laptops, personal computers (PCs), smart home devices, wearable electronic devices, VR / AR devices, in-vehicle computers, etc. The servers can be interconnecting servers between multiple heterogeneous systems or backend servers, or they can be independent physical servers, server clusters or distributed systems composed of multiple physical servers, or cloud servers providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, and big data and artificial intelligence platforms, etc.
[0054] In one embodiment, such as Figure 1 As shown, the log reporting device can be integrated on the terminal 10 to implement the log reporting method proposed in this application embodiment. Specifically, the terminal 10 can obtain information collection configuration information for the application; based on the information collection configuration information, collect log information of the application in multiple different dimensions; based on the collection subject information in the information collection configuration information, integrate and process the log information in multiple different dimensions to obtain at least one collected log; based on the collection subject information corresponding to each collected log, store each collected log to the corresponding target folder; receive a reporting instruction, and report the target folder to the server 11 based on the reporting instruction.
[0055] The following will provide a detailed description of each example. It should be noted that the order of description of the following embodiments is not intended to limit the preferred order of the embodiments.
[0056] This application embodiment will be described from the perspective of a log reporting device, which can be integrated into a computer device.
[0057] like Figure 2 As shown, a log reporting method is provided, and the specific process includes:
[0058] 101. Obtain information collection configuration information for the application.
[0059] Applications include computer programs that perform one or more specific functions. They run in interactive mode, can interact with the users of the application, and have a visual display interface.
[0060] For example, applications can include software on various terminals. These include mobile phone applications (APPs), tablet applications, laptop applications, personal computer (PC) applications, and so on.
[0061] For example, applications can include browsers, video playback software, game software, and so on.
[0062] For example, applications can also include mini-programs. A mini-program is an application that can be used without downloading or installing it. To provide users with more diverse business services, developers can create corresponding mini-programs for terminal applications (such as instant messaging applications, shopping applications, email applications, etc.). These mini-programs can be embedded as sub-applications within the terminal application, and by running the sub-application (i.e., the corresponding mini-program) within the application, corresponding business services can be provided to the user.
[0063] In one embodiment, the application can be a financial application that enables users to perform financial operations. For example, the application can enable users to transfer funds, purchase funds, and perform other similar operations.
[0064] The information collection configuration information can include information generated by developers after making differentiated configurations for the log collection process based on their needs. This configuration information allows you to set which information the log reporting device collects and how to process the collected information.
[0065] For example, information collection configuration information may include information about the collection subject, collection period, log collection permission information, data collection dimension information, and so on.
[0066] In one embodiment, the application generates information from multiple dimensions. For example, the information generated by the application may include user operation information and information generated internally by the system, etc. User operation information may further include information about user actions on various interfaces within the application, etc. The log reporting device does not need to collect all the information generated by the application; instead, it can collect the information needed by developers or business personnel based on the data collection dimensions.
[0067] In one embodiment, an application may be jointly developed by multiple departments within an enterprise. For example, function 'a' in the application is developed by department A, while function 'b' is developed by department B. Regarding the information collected by the log reporting device, each department generally only focuses on information related to the functions it developed, and is not concerned with all information. Therefore, this embodiment can determine the information needed by each department based on the main collected information. Then, it can also generate a collection log corresponding to each department based on the information needed by each department, ensuring that the collection logs obtained by each department are only what it needs. Therefore, when each department tests the application's functions based on the collection logs, it does not need to filter and integrate the information in the collection logs; it can directly use the collection logs to test the application's functions or analyze problems, thereby improving testing efficiency and the efficiency of function problem analysis.
[0068] In one embodiment, some of the information collected by the log reporting device involves user privacy. To protect user privacy and improve information security, log reporting permissions can be set through log collection permission information. For example, log collection permission information can be used to centrally control the log collection switch. Log collection is only allowed when the log collection permission information is set to allow unified control of the log switch. For example, log collection permission information can be used to restrict logs to be reported only to certain departments, and not to all departments. As another example, when the log reporting device is integrated into the user's terminal, there are two locations on the terminal where logs can be stored: a test package and a production package. The test package provides information for developers or business personnel to use for testing; therefore, it can store logs collected by the log reporting device. The production package, however, stores data intended for the user; therefore, it cannot store logs collected by the log reporting device. Thus, log collection permission information can also control where logs are stored, preventing logs from being stored in the production package and causing information leakage.
[0069] In one embodiment, the collection period can be set to indicate when the data reporting device collects information. For example, the collection period can be configured to be one week, in which case the data reporting device can collect information once every week. When the data reporting device collects data according to the collection period, it can obtain information collection configuration information for the application and then collect information based on that configuration information.
[0070] 102. Based on the information collection configuration information, collect log information of the application in multiple different dimensions.
[0071] In one embodiment, the data reporting device can collect log information of the application in multiple different dimensions based on information collection configuration information.
[0072] In this embodiment, the log collection switch can be uniformly controlled. Log collection is only permitted when the log collection permission information is set to allow uniform control of the log collection switch. The uniform control of log collection can be set through the log collection permission information in the information collection configuration information.
[0073] Therefore, the step "collecting application log information across multiple dimensions based on information collection configuration information" can include:
[0074] The information collection configuration information is parsed to obtain log collection permission information;
[0075] Verify and process log collection permission information;
[0076] When the log collection permission information is approved, log information of the application is collected from multiple different dimensions.
[0077] In one embodiment, the information collection configuration information can be parsed to obtain log collection permission information. Then, the log collection permission information is verified. When the log collection permission information is approved, it supports the collection of log information from the application across multiple dimensions. Conversely, when the log collection permission information is denied, it does not support the collection of log information from the application across multiple dimensions.
[0078] For example, the log collection permission information can be in the form of a password. When the log collection permission information matches the preset password, it means that the log collection permission information has been verified. Matching the log collection permission information and the preset password can mean that the log collection permission information and the preset password are identical, or it can mean that the log collection permission information and the preset password satisfy some kind of relationship. For example, it could mean that the log collection permission information and the preset password, after performing an arithmetic operation, satisfy a certain preset value, and so on.
[0079] For example, a log collection permission value of "1" indicates that the log collection permission has been verified and can support the collection of log information from the application across multiple dimensions. Conversely, a log collection permission value of "0" indicates that the log collection permission has not been verified and cannot support the collection of log information from the application across multiple dimensions.
[0080] In one embodiment, when log collection permission information is granted, the data reporting device can collect log information from the application across multiple dimensions. This requires knowing which dimensions the data reporting device should collect. Therefore, when log collection permission information is granted, the information collection configuration information is parsed to obtain at least one data collection dimension. Then, data collection is performed based on this at least one data collection dimension.
[0081] Specifically, the step "when log collection permission information is granted, collect application log information across multiple dimensions" can include:
[0082] When the log collection permission information is approved, the information collection configuration information is parsed to obtain at least one data collection dimension information;
[0083] Based on at least one data collection dimension, the data collection component is invoked to collect log information from the application across multiple different dimensions.
[0084] In one embodiment, when log collection permission information is granted, the information collection configuration information can be parsed to obtain at least one data collection dimension. Then, based on the at least one data collection dimension, the data collection component can be invoked to collect log information from the application across multiple different dimensions.
[0085] The data acquisition component can be LogUtils. Through LogUtils, you can uniformly control log acquisition on / off, log levels, the package / business name / department where logs are printed, log output time, log content, file reading / writing, and encryption of sensitive information.
[0086] For example, by parsing the information collection configuration information, the log reporting device can determine that it needs to collect information on currently logged-in users, user actions, logical processing records, page navigation records, and API requests. Then, the log reporting device can call LogUtils to collect log information on these data. User actions can include clicks, inputs, and selections, etc. API requests can include request time, API name, request input parameters, request status, and output parameters.
[0087] 103. Based on the collection subject information in the information collection configuration information, integrate and process log information from multiple different dimensions to obtain at least one collection log.
[0088] In one embodiment, after collecting log information from different dimensions, in order to improve testing efficiency, the log information from multiple different dimensions can be integrated and processed based on the collection subject information in the information collection configuration information to obtain at least one collection log.
[0089] For example, an application might be jointly developed by multiple departments within an enterprise. For instance, function 'a' in the application might be developed by department A, while function 'b' might be developed by department B. Regarding the information collected by the log reporting device, each department typically only focuses on information relevant to its own developed functions and doesn't concern itself with all information. Therefore, this embodiment can determine the information needed by each department based on the main collected information. Then, based on the information needed by each department, a collection log corresponding to each department can be generated, ensuring that the collection logs obtained by each department are only what it needs. Therefore, when each department tests the application's functionality based on the collection logs, it doesn't need to filter and integrate the information in the collection logs; it can directly use the collection logs to test the application's functionality or analyze problems, thereby improving testing efficiency and the efficiency of functional problem analysis.
[0090] In one embodiment, the step "integrating and processing log information from multiple different dimensions based on the collection subject information in the information collection configuration information to obtain at least one collection log" may include:
[0091] The data collection subject information is parsed to obtain the data collection instruction information for each data collection subject;
[0092] Based on the data collection instruction information of each collection subject, log information from multiple different dimensions is combined and processed to obtain the data group corresponding to each collection subject.
[0093] The data group corresponding to each data collection subject is encapsulated to obtain at least one data collection log.
[0094] In one embodiment, the data collection subject information can be parsed to obtain data collection instruction information for each data collection subject. This data collection instruction information can be used to specify what information each data collection subject requires.
[0095] Then, based on the data collection instruction information of each collection entity, log information from multiple different dimensions can be combined and processed to obtain the data group corresponding to each collection entity. Specifically, the step "based on the data collection instruction information of each collection entity, log information from multiple different dimensions can be combined and processed to obtain the data group corresponding to each collection entity" can include:
[0096] Based on the data collection instruction information of the data collection subject, the log information corresponding to the dimension that matches the data collection instruction information is filtered out from the log information of multiple different dimensions;
[0097] Based on the log information corresponding to the matching dimensions, the permissions of the data collection entity are verified.
[0098] When the permission verification is successful, the log information corresponding to the matching dimension will be combined into a data group.
[0099] In one embodiment, based on the data collection instruction information of the collecting entity, log information corresponding to the dimension matching the data collection instruction information can be filtered from log information across multiple different dimensions. For example, if the data collection instruction information of collecting entity A indicates that log information related to function a is required, then the log reporting device will collect log information related to function a. As another example, if the data collection instruction information of collecting entity B indicates that log information related to function b is required, then the log reporting device will collect log information related to function b.
[0100] In one embodiment, to further enhance information security, each department can be restricted to accessing only log information relevant to itself, and is prohibited from accessing log information from other departments. Therefore, after filtering the log information corresponding to the dimensions that match the data collection instruction information, permission verification can be performed on the collection subject based on the matching log information, determining whether the collection subject is qualified to access the log information corresponding to the current dimension. For example, if the data collection instruction information for collection subject B indicates that it needs log information related to function b, and after permission verification for collection subject B, the permission verification is passed, indicating that the log information related to function b can be combined into a data group. As another example, if the data collection instruction information for collection subject B indicates that it needs log information related to function c, and after permission verification for collection subject B, the permission verification is not passed, indicating that the log information will not be combined into a data group.
[0101] In one embodiment, after obtaining the data group corresponding to each collection subject, the data group corresponding to each collection subject can be encapsulated to obtain at least one collection log, wherein each collection log corresponds to one collection subject.
[0102] There are several ways to encapsulate the data group corresponding to each data collection subject to obtain the collection log corresponding to each data collection subject.
[0103] For example, the log information in the data group can be formatted and processed according to the preset format to obtain the collection log corresponding to the collection subject.
[0104] For example, to facilitate the processing of collected logs by testers or developers, log reference levels can be set for collected logs, allowing testers or developers to focus on different collected logs based on their daily reference levels.
[0105] Specifically, the step of "encapsulating the data group corresponding to each data collection subject to obtain at least one data collection log" may include:
[0106] Identify the log information in the data group to obtain the data error instructions in the log information;
[0107] The error-inducing commands are mapped to obtain the log reference level.
[0108] The log information in the data group is formatted according to the preset format to obtain the initial collection log.
[0109] The initial collection logs are then set with a log level based on the log reference level to obtain the collection logs.
[0110] In one embodiment, log information in the data group can be identified to obtain data error instructions from the log information. For example, data error instructions may include Debug, Info, Warning, Error, and Fatal. Debug indicates that the error recorded in the log information is a minor error; Info indicates that the error recorded in the log information is a low-level error; Warning indicates that the error recorded in the log information is a serious error; Error indicates that the error recorded in the log information needs to be reported; and Fatal indicates that the error recorded in the log information is a very serious error.
[0111] Then, error messages can be mapped to obtain log reference levels. For example, Debug, Info, Warning, Error, and Fatal correspond to levels 1-5 respectively. The higher the log reference level, the more attention should be paid to collecting logs.
[0112] In one embodiment, the log information in the data group can be formatted according to a preset format to obtain the initial collection log. For example, the initial collection log obtained by formatting the log information in the data group according to the preset format can be "[August 4, 2022, 14:22][Consumer Finance][info][Document / Aladdin / Plugins / loanCMy / index51.html]:Thisisademolog".
[0113] Then, a log level can be set for the initial collection log based on the log reference level to obtain the collection log. For example, the log level can be added to the initial collection log to obtain the collection log. For example, the collection log can be "[2][August 4, 2022, 14:22][Consumer Finance][info][Document / Aladdin / Plugins / loanCMy / index51.html]:Thisisademolog".
[0114] 104. Based on the data collection subject information corresponding to each data collection log, store each data collection log to its corresponding target folder.
[0115] In one embodiment, to facilitate the management of the collection logs, each collection log can be stored in its corresponding target folder based on the collection subject information corresponding to each collection log.
[0116] In one embodiment, when the log reporting device is integrated into a user's terminal, the terminal has two storage locations for logs: a test package and a production package. The test package provides information for developers or business personnel to use for testing; therefore, it can store logs collected by the log reporting device. The production package, however, stores data intended for the user; therefore, it cannot store logs collected by the log reporting device. Thus, log collection permission information can control where logs are stored, preventing logs from being stored in the production package and causing information leakage.
[0117] To improve information security, it's possible to determine whether the folder where the collected logs are stored is a test or production package. Specifically, the step "based on the collection subject information corresponding to each collected log, store each collected log to its corresponding target folder" can include:
[0118] Based on the data collection subject information corresponding to each data collection log, determine the folder to be stored for each data collection log.
[0119] The folder to be stored is identified to obtain the attribute information corresponding to the folder;
[0120] When the attribute information of the folder to be stored meets the preset storage conditions, the collected logs will be stored in the folder to be stored, thus obtaining the target folder.
[0121] In one embodiment, based on the data collection entity information corresponding to each data collection log, the folder to be stored for each data collection log can be determined. For example, each department can correspond to a folder to be stored. Figure 3As shown, folder 1 can be used to store the collection logs of department A, folder 2 can be used to store the collection logs of department B, and folder 3 can be used to store the collection logs of department C.
[0122] Then, the folder to be stored is identified to obtain its corresponding attribute information. For example, if the folder to be stored is a production package, the collected logs will not be stored there. However, if the folder to be stored is a test package, the collected logs will be stored there to obtain the target folder.
[0123] In one embodiment, the attribute information of the folder to be stored can indicate whether the folder is a production package or a test package. When the folder to be stored is a production package, the collection logs will not be stored in the folder. However, when the folder to be stored is a test package, the collection logs will be stored in the folder to obtain the target folder.
[0124] 105. Receive the reporting instruction and report the target folder based on the reporting instruction.
[0125] In one embodiment, after receiving a reporting instruction, the log reporting device can report the target folder based on the instruction. For example, the folder corresponding to each department can be reported, and then each department can obtain the collected logs it needs.
[0126] This application proposes a log reporting method, including: obtaining information collection configuration information for an application; collecting log information of the application across multiple dimensions based on the information collection configuration information; integrating and processing the log information across multiple dimensions based on the collection subject information in the information collection configuration information to obtain at least one collected log; storing each collected log to a corresponding target folder based on the collection subject information corresponding to each collected log; receiving a reporting instruction and reporting the target folder based on the reporting instruction. This application embodiment can record detailed information for development to use when submitting defects, improving problem-solving efficiency, reducing investigation time for occasional problems, and decreasing the number of defects delayed due to non-reproducible issues, thereby improving testing and development efficiency and production quality. Furthermore, to prevent the collection and leakage of sensitive user information, the log collection function can be uniformly enabled or disabled based on the input parameters (production / test environment) during packaging.
[0127] Based on the method described in the above embodiments, the following examples will provide further detailed explanations.
[0128] This application will use the integration of a log reporting method into a terminal as an example to illustrate the method of this application.
[0129] In one embodiment, such as Figure 4 As shown, a log reporting method has the following specific process:
[0130] 201. The terminal obtains information collection configuration information for the application.
[0131] For example, the application provides a utility class method LogUtils at the underlying level. This utility class method LogUtils can uniformly control the switching on and off of log collection, log level, package name / business name / business unit where logs are printed, log output time, log content, file reading and writing, encryption of sensitive information, etc.
[0132] 202. The terminal collects log information from the application across multiple dimensions based on the information collection configuration information.
[0133] In one embodiment, the terminal can call LogUtils to collect log information from the application across multiple dimensions based on information collection configuration information.
[0134] 203. Based on the collection subject information in the information collection configuration information, the terminal integrates and processes log information from multiple different dimensions to obtain at least one collection log.
[0135] For example, if data collection instruction information from subject A indicates that log information related to function a is required, then the log reporting device will collect the log information related to function a. Similarly, if data collection instruction information from subject B indicates that log information related to function b is required, then the log reporting device will collect the log information related to function b.
[0136] For example, such as Figure 5 As shown, by formatting the log information in the data group, the collection log can be "[August 4, 2022, 14:22][Consumer Finance][info][Document / Aladdin / Plugins / loanCMy / index51.html]: Thisisademolog".
[0137] 204. Based on the data collection subject information corresponding to each data collection log, the terminal stores each data collection log to its corresponding target folder.
[0138] For example, each department can correspond to a folder to be stored. For example, such as Figure 3 As shown, folder 1 can be used to store the collection logs of department A, folder 2 can be used to store the collection logs of department B, and folder 3 can be used to store the collection logs of department C.
[0139] Then, the folder to be stored is identified to obtain its corresponding attribute information. For example, if the folder to be stored is a production package, the collected logs will not be stored there. However, if the folder to be stored is a test package, the collected logs will be stored there to obtain the target folder.
[0140] In one embodiment, the attribute information of the folder to be stored can indicate whether the folder is a production package or a test package. When the folder to be stored is a production package, the collection logs will not be stored in the folder. However, when the folder to be stored is a test package, the collection logs will be stored in the folder to obtain the target folder.
[0141] In one embodiment, folders are created in the terminal memory to collect the log content output by each business line / business unit. The file size of each folder can be controlled, and logs can be recorded in different files according to the log output date or according to the total size of the logs.
[0142] To prevent the collection or leakage of sensitive production information, the following methods can be adopted:
[0143] (1) Method 1: When packaging the front-end App, uniformly control the log containment function to be enabled by default if it is a test package, and to be automatically disabled by default if it is a production package.
[0144] (2) Method 2: Package the LogUtils logging tool into a compressed package. Do not include the logging function in the production package, but add the function in the test package to prevent someone from accidentally enabling the log containment function in the production environment.
[0145] 205. The terminal receives the reporting instruction and reports the target folder based on the reporting instruction.
[0146] This application proposes an operation method, including: a terminal acquiring information collection configuration information for an application; the terminal collecting log information of the application across multiple dimensions based on the information collection configuration information; the terminal integrating and processing the log information across multiple dimensions based on the collection subject information in the information collection configuration information to obtain at least one collected log; the terminal storing each collected log to a corresponding target folder based on the collection subject information corresponding to each collected log; and the terminal receiving a reporting instruction and reporting the target folder based on the reporting instruction. This application embodiment can improve the efficiency of testing and development, thereby improving the production quality of the application.
[0147] To better implement the log reporting method provided in the embodiments of this application, a log reporting device is also provided in one embodiment, which can be integrated into a computer device. The meanings of the terms are the same as in the log reporting method of the aforementioned product, and specific implementation details can be found in the description of the method embodiments.
[0148] In one embodiment, a log reporting device is provided, which can be integrated into a computer device, such as a television. Figure 6 As shown, the log reporting device includes: an acquisition unit 301, a collection unit 302, an integration unit 303, a storage unit 304, and a reporting unit 305, as detailed below:
[0149] The acquisition unit 301 is used to acquire information collection configuration information for the application.
[0150] The acquisition unit 302 is used to acquire log information of the application in multiple different dimensions based on the acquisition configuration information.
[0151] The integration unit 303 is used to integrate log information from multiple different dimensions based on the collection subject information in the information collection configuration information to obtain at least one collection log.
[0152] Storage unit 304 is used to store each collection log into its corresponding target folder based on the collection subject information corresponding to each collection log;
[0153] The reporting unit 305 is used to receive a reporting instruction and report the target folder based on the reporting instruction.
[0154] In one embodiment, the acquisition unit 302 may include:
[0155] The first parsing subunit is used to parse the information collection configuration information to obtain log collection permission information;
[0156] The verification subunit is used to verify the log collection permission information.
[0157] The collection subunit is used to collect log information of the application in multiple different dimensions when the log collection permission information is approved.
[0158] In one embodiment, the acquisition subunit may include:
[0159] The parsing module is used to parse the information collection configuration information when the log collection permission information is approved, so as to obtain at least one data collection dimension information;
[0160] The calling module is used to call the data collection component to collect log information of the application in multiple different dimensions based on the at least one data collection dimension information.
[0161] In one embodiment, the integration unit 303 may include:
[0162] The second parsing subunit is used to parse the data collection subject information to obtain data collection instruction information for each data collection subject;
[0163] The combination subunit is used to combine log information from multiple different dimensions based on the data collection instruction information of each collection subject to obtain a data group corresponding to each collection subject.
[0164] The encapsulation subunit is used to encapsulate the data group corresponding to each collection subject to obtain at least one collection log.
[0165] In one embodiment, the combined subunit may include:
[0166] The filtering module is used to filter log information corresponding to dimensions that match the data collection indication information from log information on multiple different dimensions based on the data collection indication information of the collecting subject.
[0167] The permission verification module is used to verify the permissions of the data collection entity based on the log information corresponding to the matched dimension.
[0168] The combination module is used to combine the log information corresponding to the matching dimension into the data group when the permission verification is successful.
[0169] In one embodiment, the encapsulation subunit may include:
[0170] The identification module is used to identify the log information in the data group and obtain the data error instruction in the log information;
[0171] The mapping module is used to map the data error instructions to obtain the log reference level;
[0172] The layout module is used to format the log information in the data group according to a preset layout format to obtain the initial collection log;
[0173] The setting module is used to set the log level for the initial collection log based on the log reference level, thereby obtaining the collection log.
[0174] In one embodiment, the storage unit 304 may include:
[0175] The sub-unit is determined based on the collection subject information corresponding to each collection log to determine the folder to be stored for each collection log.
[0176] The identification subunit is used to identify the folder to be stored and obtain the attribute information corresponding to the folder to be stored.
[0177] The storage subunit is used to store the collected logs into the folder to be stored when the attribute information of the folder to be stored meets the preset storage conditions, thereby obtaining the target folder.
[0178] In practice, each of the above units can be implemented as an independent entity or can be arbitrarily combined to be implemented as the same or several entities. For the specific implementation of each of the above units, please refer to the previous method embodiments, which will not be repeated here.
[0179] The aforementioned log reporting device can improve the efficiency of testing and development, thereby improving production quality.
[0180] This application also provides a computer device, which may include a computer or a server. For example, the computer device may be a log reporting computer, such as a smart TV; or it may be a server, such as a log reporting server. Figure 7 As shown, it illustrates a structural schematic diagram of the computer device involved in the embodiments of this application, specifically:
[0181] The computer device may include components such as a processor 401 with one or more processing cores, a memory 402 with one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will understand that... Figure 7 The computer device structure shown does not constitute a limitation on the computer device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein:
[0182] The processor 401 is the control center of the computer device. It connects various parts of the computer device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 402, and by calling data stored in the memory 402, thereby providing overall monitoring of the computer device. Optionally, the processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user page, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 401.
[0183] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and log reporting by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 402 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.
[0184] The computer device also includes a power supply 403 that supplies power to the various components. Preferably, the power supply 403 can be logically connected to the processor 401 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 403 may also include one or more DC or AC power supplies, recharging systems, power fault detection circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0185] The computer device may also include an input unit 404, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0186] Although not shown, the computer device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 401 in the computer device loads the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 runs the applications stored in the memory 402 to realize various functions, as follows:
[0187] Obtain information collection configuration information for the application;
[0188] Based on the information collection configuration information, log information of the application is collected from multiple different dimensions;
[0189] Based on the collection subject information in the information collection configuration information, the log information from multiple different dimensions is integrated and processed to obtain at least one collection log.
[0190] Based on the data collection subject information corresponding to each data collection log, each data collection log is stored in its corresponding target folder.
[0191] Receive a reporting instruction and report the target folder based on the reporting instruction.
[0192] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0193] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations of the above embodiments.
[0194] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by a computer program, or by a computer program controlling related hardware. The computer program can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0195] Therefore, embodiments of this application also provide a storage medium storing a computer program that can be loaded by a processor to execute the steps in any of the log reporting methods provided in embodiments of this application. For example, the computer program can execute the following steps:
[0196] Obtain information collection configuration information for the application;
[0197] Based on the information collection configuration information, log information of the application is collected from multiple different dimensions;
[0198] Based on the collection subject information in the information collection configuration information, the log information from multiple different dimensions is integrated and processed to obtain at least one collection log.
[0199] Based on the data collection subject information corresponding to each data collection log, each data collection log is stored in its corresponding target folder.
[0200] Receive a reporting instruction and report the target folder based on the reporting instruction.
[0201] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0202] Since the computer program stored in the storage medium can execute the steps in any of the log reporting methods provided in the embodiments of this application, the beneficial effects that any of the log reporting methods provided in the embodiments of this application can achieve can be realized. For details, please refer to the previous embodiments, which will not be repeated here.
[0203] The above provides a detailed description of a log reporting method, apparatus, computer device, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A log reporting method, characterized in that, include: Obtain information collection configuration information for the application; The information collection configuration information includes information generated by developers after making differentiated configurations for the log collection process based on their needs; The information collection configuration information can be used to set the information to be collected and the processing of the collected information; Based on the information collection configuration information, log information of the application is collected from multiple different dimensions; The data collection entity information in the information collection configuration information is parsed to obtain the data collection instruction information for each data collection entity; The data acquisition instruction information is used to indicate the information required by each acquisition subject; Based on the data collection instruction information of each collection subject, the log information on multiple different dimensions is combined and processed to obtain the data group corresponding to each collection subject. The data group corresponding to each collection subject is encapsulated to obtain at least one collection log; each collection subject corresponds to one or more functions of the application, and each function corresponds to log information of one or more dimensions; the collection log is log related to application testing or development. Based on the data collection subject information corresponding to each data collection log, each data collection log is stored in its corresponding target folder. Receive a reporting instruction and report the target folder based on the reporting instruction.
2. The method according to claim 1, characterized in that, Based on the information collection configuration information, the application's log information is collected across multiple dimensions, including: The information collection configuration information is parsed to obtain log collection permission information; The log collection permission information is verified. When the log collection permission information is approved, log information of the application is collected in multiple different dimensions.
3. The method according to claim 2, characterized in that, When the log collection permission information is granted, the application's log information is collected across multiple dimensions, including: When the log collection permission information is approved, the information collection configuration information is parsed to obtain at least one data collection dimension information; Based on the at least one data collection dimension information, the data collection component is invoked to collect log information of the application in multiple different dimensions.
4. The method according to claim 1, characterized in that, The process of combining log information from multiple different dimensions based on the data collection instruction information of each collection entity to obtain a data group corresponding to each collection entity includes: Based on the data collection instruction information of the data collection subject, the log information corresponding to the dimension that matches the data collection instruction information is filtered out from the log information of multiple different dimensions; Based on the log information corresponding to the matched dimensions, the collection entity is authorized to perform permission verification. When the permission verification is successful, the log information corresponding to the matching dimension is combined into the data group.
5. The method according to claim 1, characterized in that, The process of encapsulating the data group corresponding to each data collection subject to obtain the at least one data collection log includes: Identify the log information in the data group to obtain the data error instruction in the log information; The data error instructions are mapped to obtain the log reference level; The log information in the data group is formatted according to a preset format to obtain the initial collection log; The initial collection log is then set with a log level based on the log reference level to obtain the collection log.
6. The method according to claim 1, characterized in that, The step of storing each collection log into its corresponding target folder based on the collection subject information corresponding to each collection log includes: Based on the data collection subject information corresponding to each data collection log, determine the folder to be stored for each data collection log. The folder to be stored is identified, and the attribute information corresponding to the folder to be stored is obtained; When the attribute information of the folder to be stored meets the preset storage conditions, the collected logs are stored in the folder to be stored, thus obtaining the target folder.
7. A log reporting device, characterized in that, include: The acquisition unit is used to acquire information collection configuration information for the application. The information collection configuration information includes information generated by developers after making differentiated configurations for the log collection process based on their needs; The information collection configuration information can be used to set the information to be collected and the processing of the collected information; The collection unit is used to collect configuration information based on the information collected, and to collect log information of the application in multiple different dimensions. The integration unit is used to parse the collection subject information in the information collection configuration information to obtain data collection instruction information for each collection subject; The data acquisition instruction information is used to indicate the information required by each acquisition subject; Based on the data collection instruction information of each collection subject, the log information on multiple different dimensions is combined and processed to obtain the data group corresponding to each collection subject. The data group corresponding to each collection subject is encapsulated to obtain at least one collection log; each collection subject corresponds to one or more functions of the application, and each function corresponds to log information of one or more dimensions; the collection log is log related to application testing or development. The storage unit is used to store each collection log into its corresponding target folder based on the collection subject information corresponding to each collection log. The reporting unit is used to receive reporting instructions and report the target folder based on the reporting instructions.
8. A computer device, characterized in that, It includes a memory and a processor; the memory stores a computer program, and the processor is used to run the computer program in the memory to perform the log reporting method according to any one of claims 1 to 6.
9. A storage medium, characterized in that, The storage medium stores multiple computer programs, which are adapted for loading by a processor to execute the log reporting method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Safety management method for distributed SYSLOG (System Log) in network management system
CN102624562A
Distributed service tracking method, system, storage medium and electronic equipment
CN108038145A
Log collection method, device and system, electronic equipment and readable medium
CN114116159A