Log interface code file generation method and device and application log generation method and device

By defining common logging standards and using parsing and code generation tools, the problem of differences in log content and formats of different operating system platforms is solved, and the application log generation of unified formats and content is realized, simplifying the log management process.

CN119440943APending Publication Date: 2025-02-14NANJING LINGXING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411454939.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-17
Publication Date
2025-02-14

AI Technical Summary

Technical Problem

In the prior art, the process of agreeing on log content is cumbersome and the update is lagging, resulting in large differences in the log content and format generated by different mobile operating system platforms, making it difficult to realize cross-platform log reading and analysis.

Method used

By defining a set of common logging standards, determining the log content using the description language, and calling pre-developed parsing and code generation tools, the log description information is converted into log interface code files for applications of different operating systems, thereby generating a unified format and content application log.

Benefits of technology

It realizes the generation of structured and consistent application logs in different operating systems, simplifies the management process of log specification changes, and avoids differences caused by human factors and lag caused by document synchronization.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119440943A_ABST
    Figure CN119440943A_ABST
Patent Text Reader

Abstract

The invention provides a log interface code file generation method and device and an application log generation method and device. Comprising the steps of dividing an application service corresponding to an application program into a plurality of service modules; obtaining a plurality of business modules and log description information corresponding to a preset field under each business module, wherein real-time application operation information in an event field in the preset field is occupied by using a preset placeholder; and calling a pre-developed analysis and code generation tool to convert the log description information into log interface code files of application programs of different operating systems, so that terminals of the different operating systems generate application logs of the application programs according to the application programs and the log interface code files corresponding to the different operating systems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a log interface code file generation method, an application log generation method and a device. Background Art

[0002] With the rapid development of the Internet, the number of smartphone applications has increased dramatically, and with it comes the increasing complexity of iterative functions and business logic in the process of application software development. The number of application debug logs has surged, and different mobile operating system platforms (such as Hongmeng, Android, iOS, Flutter, mini-programs, etc.) often embed their own unique user log content when developing applications. When an exception occurs, due to the differences in log content, developers of the corresponding platform are usually required to conduct special troubleshooting, which greatly reduces the efficiency of troubleshooting. In addition, non-technical personnel such as operations and customer service often find it difficult to understand these technical logs, limiting the widespread application of log information.

[0003] In order to shorten the time of troubleshooting, the existing technical solutions usually adopt the agreed log format to generate logs, that is, the developer only agrees on the log format, and the application developers of each mobile operating system complete the log recording work independently, which makes the log content difficult to read and analyze across platforms. This decentralized log management method limits the versatility and accessibility of logs, and mainly serves the developers themselves.

[0004] Development agreement log content for each mobile operating system application: By formulating a unified log development agreement and providing corresponding documents, developers of different platforms are required to follow the document specifications for logging. Although this method aims to standardize log content, it has several disadvantages:

[0005] Cumbersome process: The entire process from document writing to code implementation is long and susceptible to human errors.

[0006] Update lag: Once a document is updated, all developers need to be notified to modify the code, but developers cannot perceive it in time. This is not only inefficient, but also difficult to ensure accuracy. Summary of the invention

[0007] The technical problem to be solved by the embodiments of the present application is to provide a log interface code file generation method, an application log generation method and a device, so as to solve the problem of cumbersome procedures and delayed updates for agreeing on log content, and to achieve the purpose of enabling different operating systems to generate logs with unified formats and contents.

[0008] In a first aspect, an embodiment of the present application provides a method for generating a log interface code file, which is applied to a management platform, and the method includes:

[0009] Divide the application business corresponding to the application into several business modules;

[0010] Acquire log description information corresponding to a plurality of the business modules and a preset field under each of the business modules, wherein the real-time application running information in the event field in the preset field is occupied by a preset placeholder;

[0011] The pre-developed parsing and code generation tool is called to convert the log description information into the log interface code file of the application of different operating systems, so that the terminals of different operating systems can generate the application log of the application according to the application and the log interface code files corresponding to the different operating systems.

[0012] In a second aspect, an embodiment of the present application provides an application log generation method, which is applied to a terminal on which a target operating system is installed, and the method includes:

[0013] When generating an application log of a target application, obtaining a log interface code file matching the target application and the target operating system from a management platform;

[0014] Obtaining application running information of the target application when it is running;

[0015] According to the input parameter function provided in the log interface code file, the application characters corresponding to the application running information replace the corresponding placeholders in the log interface code file to generate the application log of the target application.

[0016] In a third aspect, an embodiment of the present application provides a log interface code file generation device, which is applied to a management platform, and the device includes:

[0017] An application business division module is used to divide the application business corresponding to the application program into several business modules;

[0018] A log description information writing module is used to obtain log description information corresponding to a plurality of the business modules and a preset field under each of the business modules, and the real-time application running information in the event field in the preset field is occupied by a preset placeholder;

[0019] The interface code file acquisition module is used to call the pre-developed parsing and code generation tool to convert the log description information into the log interface code file of the application of different operating systems, so that the terminals of different operating systems can generate the application log of the application according to the application and the log interface code files corresponding to the different operating systems.

[0020] In a fourth aspect, an embodiment of the present application provides an application log generating device, which is applied to a terminal on which a target operating system is installed, and the device includes:

[0021] A log file acquisition module, used to acquire a log interface code file matching the target application and the target operating system from a management platform when generating an application log of the target application;

[0022] An application running information acquisition module, used to acquire application running information of the target application when it is running;

[0023] The application log generation module is used to replace the corresponding placeholder in the log interface code file with the application characters corresponding to the application running information according to the input function provided in the log interface code file, so as to generate the application log of the target application.

[0024] Optionally, the device further comprises:

[0025] A quantity acquisition module, used to acquire the number of placeholders in the log interface code file and the input parameter quantity of the log interface code file;

[0026] A log verification module is used to perform integrity verification on the application log according to the number of placeholders and the input parameter quantity.

[0027] In a fifth aspect, an embodiment of the present application provides an electronic device, including:

[0028] A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for generating a log interface code file described in any one of the above items, or the method for generating an application log described in any one of the above items is implemented.

[0029] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium. When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device can execute any of the log interface code file generation methods described above, or any of the application log generation methods described above.

[0030] Compared with the prior art, the embodiments of the present application have the following advantages:

[0031] In the embodiment of the present application, by defining a set of universal log recording standards, determining the content of the log through a descriptive language, and calling a pre-developed parsing and code generation tool to convert the log description information into a log interface code file of applications of different operating systems, the purpose of enabling applications of different operating systems to generate structured and consistent application logs can be achieved. At the same time, when the log specification changes, it is only necessary to run the parsing and code generation tool to complete the modification of all systems without changing the code. It can ensure that the format and content are completely consistent, and there will be no differences caused by human factors. There will also be no lag caused by the lack of a unified format or the use of documents for log unification, and the differences caused by human editing of the code.

[0032] It should be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] Figure 1 A flow chart of the steps of a log interface code file generation method provided in an embodiment of the present application;

[0034] Figure 2 A schematic diagram of generating interface code files for different operating systems provided in an embodiment of the present application;

[0035] Figure 3 A schematic diagram of an application log generation process instance provided in an embodiment of the present application;

[0036] Figure 4 A schematic diagram of a comparison of application log generation processes provided in an embodiment of the present application;

[0037] Figure 5 A flowchart of a method for generating an application log provided in an embodiment of the present application;

[0038] Figure 6 A schematic diagram of the structure of a log interface code file generation device provided in an embodiment of the present application;

[0039] Figure 7 A schematic diagram of the structure of an application log generating device provided in an embodiment of the present application;

[0040] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0041] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below in conjunction with the accompanying drawings and specific implementation methods.

[0042] The terms used in the embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to limit the present application. The singular forms "a", "said" and "the" used in the embodiments of the present application and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings.

[0043] Reference Figure 1 , shows a flow chart of the steps of a log interface code file generation method provided by an embodiment of the present application, and the log interface code file generation method can be applied to a management platform. Figure 1 As shown, the log interface code file generation method may include: step 101, step 102 and step 103.

[0044] Step 101: Divide the application business corresponding to the application program into several business modules.

[0045] The embodiments of the present application can be applied to a scenario where a unified description of logs is defined and converted into interface code files of different operating systems, so that different operating systems generate application logs with unified format content.

[0046] The embodiments of the present application can be applied to a management platform, that is, the execution entity is the management platform.

[0047] An application is a computer program that is used to complete one or more specific tasks. It runs in user mode, can interact with users, and has a visual user interface. In this example, the application may be, but is not limited to, a game application, a navigation application, etc.

[0048] Application services refer to the services that an application program can provide. Taking a navigation application program as an example, the application services it provides may include: search services, navigation path screening and other services.

[0049] In this example, a single application program may provide a single application service or multiple application services. This may be determined based on actual conditions and is not limited in this embodiment.

[0050] When unifying the log format and content of the application, the application business corresponding to the application can be divided into several business modules. For example, taking a navigation application as an example, it provides a search business, which is the application business of the navigation application. The search business can provide modules such as destination search and merchant search.

[0051] It can be understood that the above examples are merely examples listed for a better understanding of the technical solutions of the embodiments of the present application, and are not intended to be the sole limitation to the embodiments.

[0052] After the application service corresponding to the application program is divided into a number of service modules, step 102 is executed.

[0053] Step 102: obtaining log description information corresponding to a plurality of the business modules and a preset field under each of the business modules, wherein the real-time application running information in the event field in the preset field is filled with a preset placeholder.

[0054] After the application business corresponding to the application program is divided into several business modules, the preset fields under each business module can be obtained, that is, the business module (model) can include: scene (scene), event (event), name (name) and other fields.

[0055] Then, several business modules and log description information corresponding to the preset fields under each business module can be obtained. In this example, the log description information can be written by a developer, or compiled by a preset log description information compilation tool, etc. The method for obtaining the log description information can be determined according to business requirements, and this embodiment does not limit this.

[0056] The real-time application running information in the event field in the preset field can be filled with preset placeholders. For example, taking the search service of a navigation application as an example, the description content of its service module and the preset fields under the service module can be as follows: Figure 2 As shown:

[0057] Business module model, the log description information of the business module is: model: search. The preset fields under the business module include: scene, event, level, and name.

[0058] The log description information of the scene is: destination.

[0059] The log description information of the event is: the user enters xx, searches for xx, enters the keyword "xx", and clicks the xxth option in the search result list. The option title is xx, xx sub-POI point" (where xx represents a placeholder).

[0060] The log description information of level is: info.

[0061] The log description information of name (name) is: searchEndPoint (i.e. search endpoint).

[0062] It can be understood that the above examples are merely examples listed for a better understanding of the technical solutions of the embodiments of the present application, and are not intended to be the sole limitation to the embodiments.

[0063] In a specific implementation, the log description information may be written by a business person or by a pre-compiled log description information writing tool. The writing method of the log description information may be determined according to business requirements, and this embodiment does not impose any limitation on this.

[0064] Of course, the format of the log description information may be, but is not limited to, JSON, XML, etc. The format of the log description information may be determined according to business requirements, and this embodiment does not impose any limitation on this.

[0065] After obtaining several business modules and log description information corresponding to the preset fields under each business module, step 103 is executed.

[0066] Step 103: Call a pre-developed parsing and code generation tool to convert the log description information into a log interface code file of the application of different operating systems, so that the terminals of different operating systems can generate the application log of the application according to the application and the log interface code files corresponding to the different operating systems.

[0067] In a specific implementation, a parsing and code generation tool may be developed in advance, which can parse the log description information and convert its content into interface codes for different operating systems. The tool supports the expansion of new operating systems or development platforms.

[0068] After obtaining the log description information corresponding to several business modules and the preset fields under each business module, the pre-developed parsing and code generation tool can be called to convert the log description information into the log interface code files of the applications of different operating systems. Specifically, the parsing and code generation tool can be called to parse the log description information, obtain the description file parsing information, and convert the description file parsing information according to the pre-set log format according to the code requirements of different operating systems to generate log interface code files of different operating systems.

[0069] In actual applications, the log description file can be read and parsed to extract information such as log fields, types, and formats. Then, the parsed log description information can be stored in an easy-to-process data structure. Finally, according to the parsed information in the description file, the log interface code is generated according to the log interface specifications of different operating systems, and the log interface code is encapsulated with some necessary functions (such as parameter input functions) to generate a log interface code file. Figure 2As shown, the parsing and code generation tool can parse the log description information and obtain the content parsing results: module, scene, event, name and other fields. Then, the interface code files of different operating systems (Hongmeng, Android, iOS, etc.) can be generated. Finally, code synchronization tools (such as git, etc.) can be used to manage description files and generated interface code files (such as synchronization of log interface code files, that is, synchronization to application developers of different operating systems through code synchronization tools (Git).

[0070] After generating the log interface code files of applications for different operating systems, when different operating systems generate application logs for the applications, terminals of different operating systems can obtain the application and the log interface code files corresponding to the different operating systems from the management platform, and replace the corresponding placeholders in the log interface code file with the application characters corresponding to the application running information of the application according to the input function provided in the log interface code file, thereby generating the application log of the application.

[0071] For the log interface code and log generation process, you can combine Figure 3 The following is a detailed description. Figure 3 As shown, the process may include:

[0072] 1. Define the description file (DSL).

[0073] 2. Description file parsing and code generation tool (a tool that converts description file contents into code for different operating systems).

[0074] 3. In the description file, complete the description of the log event to be developed.

[0075] 4. Run the description file parsing and code generation tool to generate interface codes for operating systems A, B, and C.

[0076] 5. In the same git repository, create modules for different operating systems so that developers can access the modules for use. For example, in the directory content under the git repository: DSLFiles: description files, AFiles: interface code module for operating system A, BFiles: interface code module for operating system B, CFiles: interface code module for operating system C.

[0077] 6. Developers of operating system A can reference the log module in AFiles, developers of operating system B can reference the log module in BFiles, and developers of operating system C can reference the log module in CFiles, thereby generating user logs with unified format and content.

[0078] 7. Developers and non-developers can use user logs without distinguishing the operating system of the device used by the user.

[0079] The embodiment of the present application defines a set of universal log recording standards, determines the content of the log through a description language, and calls a pre-developed parsing and code generation tool to convert the log description information into a log interface code file for applications of different operating systems, so as to achieve the purpose of enabling applications of different operating systems to generate structured and consistent application logs. At the same time, when the log specification changes, it is only necessary to run the parsing and code generation tool to complete the modification of all systems without changing the code. It can ensure that the format and content are completely consistent, and there will be no differences caused by human factors. There will also be no lag caused by the lack of a unified format or the use of documents for log unification, and differences caused by human editing of codes.

[0080] In the embodiment of the present application, when the application program has a change in application service, the log interface code files of different operating systems can be modified in time. The implementation process can be described in detail in conjunction with the following specific implementation method.

[0081] In a specific implementation of the present application, after the above step 103, the following may also be included:

[0082] Step A1: Acquire the application change service of the application program.

[0083] In this embodiment, when the application service of the application program changes, the changed application service of the application program may be acquired.

[0084] In a specific implementation, the changed application service may be an application service newly added to the application program, an application service reduced from the application program, or an application service both added and reduced from the application program. This embodiment does not limit the type of changed application service.

[0085] After the application change service of the application program is acquired, step A2 is executed.

[0086] Step A2: Obtain the first interface code corresponding to the changed application service of different operating systems.

[0087] The first interface code refers to the log interface code corresponding to the changed application service.

[0088] After obtaining the application change service of the application program, the first interface code corresponding to the application change service of different operating systems can be obtained. Specifically, the log description information of several business modules divided by the application change service and the preset fields under each business module can be obtained, and the parsing and code generation tool can be called to convert the log description information according to the code requirements of different operating systems, so as to obtain the first interface code.

[0089] After the first interface code corresponding to the application change service of the different operating systems is obtained, step A3 is executed.

[0090] Step A3: Based on the first interface codes of different operating systems, the log interface code files of the corresponding operating systems are updated to generate the first log interface code files of the application programs of different operating systems.

[0091] After obtaining the first interface code corresponding to the changed application business of different operating systems, the log interface code file of the corresponding operating system can be updated based on the first interface code of the different operating systems to generate the first log interface code file of the application program of the different operating systems. The specific update method can be:

[0092] 1. When the application service is changed to a reduced application service, the first interface code of the different operating systems can be deleted from the log interface code files of the different operating systems to obtain the first log interface code files of the application programs of the different operating systems.

[0093] 2. When the application service is changed to an additional application service, the log interface code files and the first log interface code files of different operating systems may be merged to obtain the first log interface code files of application programs of different operating systems.

[0094] Understandably, when there are both reduced application services and increased application services, the parsing and code generation tool can be called to generate interface codes for the reduced application services and interface codes for the increased application services. Then, the log interface code file is updated by combining the above two methods to obtain a first log interface code file.

[0095] In an embodiment of the present application, when there is a change business module of the application business in the application program, the log interface code files of different operating systems can be updated in time. The specific update process can be described in detail with reference to the following specific implementation method.

[0096] In another specific implementation of the present application, after the above step 103, the following may also be included:

[0097] Step B1: Acquire a change service module of an application service of the application program.

[0098] In this embodiment, when there is a changed service module in the application service of the application program, the changed service module of the application service of the application program may be obtained.

[0099] In actual applications, the changed service module may be a newly added service module in the application service of the application program, or a reduced service module in the application service of the application program, or a service module added and reduced at the same time in the application service of the application program, etc. Specifically, the type of the changed service module may be determined according to actual conditions, and this embodiment does not limit this.

[0100] After obtaining the change service module of the application service of the application program, step B2 is executed.

[0101] Step B2: Obtain the second interface code corresponding to the change service module of different operating systems.

[0102] The second interface code refers to the log interface code corresponding to the change business module.

[0103] After obtaining the change business module of the application business of the application, the second interface code corresponding to the change business module of different operating systems can be obtained. Specifically, the written change business module and the log description information of the preset fields under the change business module can be obtained. Then, the parsing and code generation tool can be called to convert the log description information according to the code requirements of different operating systems, thereby obtaining the log interface code of different operating systems, that is, the second interface code.

[0104] After obtaining the second interface code corresponding to the change service module of the different operating systems, execute step B3.

[0105] Step B3: Based on the second interface code of the different operating systems, the log interface code file of the corresponding operating system is updated to generate the second log interface code file of the application program of the different operating systems.

[0106] After obtaining the second interface code corresponding to the change business module of different operating systems, the log interface code file of the corresponding operating system can be updated based on the second interface code of the different operating systems to generate the second log interface code file of the application program of the different operating systems. The specific update method can be:

[0107] 1. When changing the business module to a reduced business module, the second interface code of the different operating systems can be deleted from the log interface code files of the different operating systems to obtain the second log interface code files of the application programs of the different operating systems.

[0108] 2. When the business module is changed to an added business module, the log interface code files and the second log interface code files of different operating systems can be merged to obtain the second log interface code files of the application programs of different operating systems.

[0109] It can be understood that when there are both reduced business modules and increased business modules of the application business, the parsing and code generation tool can be called to generate the interface code of the reduced business modules of the application business and the interface code of the increased business modules. Then, the log interface code file is updated by combining the above two methods to obtain a second log interface code file.

[0110] In the embodiment of the present application, when there is a change field under the target business module of the application business of the application, the log interface code files of the application programs of different operating systems can be updated in time. The implementation process can be described in detail in conjunction with the following specific implementation methods.

[0111] In another specific implementation of the present application, after the above step 103, the following may also be included:

[0112] Step C1: when there is a changed field under the target business module of the application business of the application program, obtain target log description information of several business modules and the changed field under each business module.

[0113] In this embodiment, when there are changed fields under the target business module of the application business of the application program, the target log description information of the changed fields under several business modules and each business module can be obtained. The several business modules are the business modules after the business modules are changed. Specifically, when there are changed fields under the target business module, the developer can rewrite the target log description information of the changed fields under several business modules and each business module. Alternatively, when there are changed fields under the target business module, the target log description information of the changed fields under several business modules and each business module can be recompiled by a preset log description information compilation tool.

[0114] In this example, the changed fields may be reduced fields, newly added fields, or both newly added fields and reduced fields.

[0115] After obtaining the target log description information of several business modules and the changed fields under each business module, step C2 is executed.

[0116] Step C2: calling the parsing and code generation tool to convert the target log description information into a third log interface code file of different operating systems.

[0117] After obtaining target log description information of several business modules and the changed fields under each business module, the parsing and code generation tool may be called to convert the target log description information into a third log interface code file of different operating systems.

[0118] After calling the parsing and code generation tool to convert the target log description information into a third log interface code file of a different operating system, step C3 is performed.

[0119] Step C3: updating the log interface code files of different operating systems based on the third log interface code files of different operating systems.

[0120] After calling the parsing and code generation tool to convert the target log description information into the third log interface code file of the different operating systems, the log interface code files of the different operating systems can be updated based on the third log interface code files of the different operating systems. Specifically, the updating method can be to replace the log interface code corresponding to the application in the original log interface code file, so as to obtain the updated log interface code file.

[0121] Next, combine Figure 4 The log generation process of the prior art solution is compared with the log generation process of the solution of the present application.

[0122] 1. The existing technical process is to use a document synchronization solution, which is to pre-write online documents. Developers on different platforms can refer to the document development log: Log ("Event A"), and the operating systems include: Hongmeng, Android, and iOS. The examples are as follows:

[0123] For example, when a ride-hailing user searches for a destination, the user searches for "XX South Station" and selects the first option in the search result. When different system developers log the results separately, the results may be as follows:

[0124] Hongmeng: The user entered the site selection page, searched for XX South Station, and selected XX South Station.

[0125] Android: Opened the site selection page, entered XX South Station, and selected the first option.

[0126] iOS: open end search page, search XX South Station, selected index 0.

[0127] From the above examples, we can see that the three systems may generate log contents that are quite different and cannot be used by non-developers or developers of non-operating systems. That is, iOS developers cannot accurately understand Hongmeng's user logs, and Hongmeng developers cannot accurately understand iOS logs.

[0128] 2. The process of generating logs by the technical solution of the present application can be: 1. Agree on the description format of the log and the development of the parsing tool. 2. Write the description of the log. 3. The parsing tool converts the description of the log into the interface code for log development in different platform languages ​​(i.e. different operating systems). 4. Different platforms call the converted interface code: LogEventA, taking the above example as an example, can generate completely consistent log content: "The user enters the search page and searches for the destination. The user enters the keyword "XX South Station" and clicks on the first option in the search result list. The option title is XX South Station, and there are sub-POI points (such as specific facilities, locations or services around or inside XX South Station, etc.)".

[0129] The mobile operating system targeted by the embodiments of the present application can be expanded to different development languages ​​and application implementation solutions for implementing applications under the same mobile operating system. For example, applications for the Android operating system can be developed through different languages ​​and methods such as applets, Java, Kotlin, etc.

[0130] In the embodiments of the present application, the content and format of application logs of different operating systems can be completely unified: each log and the API of the program interface are one-to-one corresponding. When the content of the log changes, you only need to run the parsing tool to complete the modification of all systems without changing the code. It can ensure that the format and content are completely consistent, and there will be no differences caused by human factors. There will also be no lag caused by the lack of a unified format or the use of documents for log unification, and differences caused by manual editing of codes. Moreover, developers no longer need to check the content of the document, and the documents can be written into code, which improves the efficiency of developing logs.

[0131] At the same time, agreements are made for specific events. Developers need to check the consistency of business logic during log development, otherwise log development cannot be completed. This can help developers unify logic. Expand the scope of log use: After the format and content of logs are unified, the scope of log use is no longer limited to developers. Non-technical personnel can also easily understand user logs. For example, customer service staff can use user logs to help users answer questions.

[0132] The log interface code file generation method provided in the embodiment of the present application can achieve the purpose of enabling applications of different operating systems to generate structured and consistent application logs by defining a set of universal log recording standards, determining the content of the log through a description language, and calling a pre-developed parsing and code generation tool to convert the log description information into a log interface code file of an application program of different operating systems. At the same time, when the log specification changes, it is only necessary to run the parsing and code generation tool to complete the modification of all systems without changing the code. It can ensure that the format and content are completely consistent, and there will be no differences caused by human factors. There will also be no lag caused by the lack of a unified format or the use of documents for log unification, and differences caused by human editing of the code.

[0133] Reference Figure 5 , shows a flow chart of the steps of an application log generation method provided by an embodiment of the present application, and the application log generation method can be applied to a terminal that installs a target operating system. Figure 5 As shown, the application log generating method may include: step 501, step 502 and step 503.

[0134] Step 501: when generating an application log of a target application, a log interface code file matching the target application and the target operating system is obtained from a management platform.

[0135] The embodiments of the present application can be applied to a terminal on which a target operating system is installed, that is, the execution subject is the terminal on which the target operating system is installed.

[0136] When generating an application log of a target application, a log interface code file matching the target application and the target operating system can be obtained from the management platform. The log interface code file can be used to instruct the terminal to generate an application log of a specified log format and content of the target application.

[0137] After the log interface code file matching the target application and the target operating system is acquired from the management platform, step 502 is executed.

[0138] Step 502: Obtain application running information of the target application at runtime.

[0139] After obtaining the log interface code file matching the target application and the target operating system from the management platform, the application operation information of the target application at runtime can be obtained. In this example, the application operation information can be the runtime data and information of events (such as search events, etc.), such as searching for a destination, etc.

[0140] In a specific implementation, an event-triggered monitoring process can be set in the target application, and the real-time application running information of the event triggered by the user in the application interface provided by the target application can be monitored in real time through the monitoring process. Of course, it is not limited to this. In a specific implementation, other methods can also be used to obtain the application running information of the target application when it is running, and this embodiment does not limit this.

[0141] After the application running information of the target application program at runtime is acquired, step 503 is executed.

[0142] Step 503: according to the input parameter function provided in the log interface code file, the application characters corresponding to the application running information replace the corresponding placeholders in the log interface code file to generate the application log of the target application.

[0143] After obtaining the application running information of the target application at runtime, the application characters corresponding to the application running information can be replaced with the corresponding placeholders in the log interface code file according to the input function provided in the log interface code file to generate the application log of the target application. Specifically, you can first check the log interface code file to determine the placeholders therein. Then, you can replace the obtained application running information with the placeholder position in the log interface code file. Finally, the replaced log code file can be saved or output as the final log.

[0144] The embodiments of the present application define a set of universal logging standards, determine the content of the log through a description language, and call a pre-developed parsing and code generation tool to convert the log description information into a log interface code file for applications on different operating systems, thereby achieving the purpose of enabling applications on different operating systems to generate structured and consistent application logs.

[0145] After generating the application log of the target application, the terminal can verify the application log according to the input parameter quantity and the placeholder quantity. The implementation process can be described in detail in conjunction with the following specific implementation method.

[0146] In a specific implementation of the present application, after the above step 503, the following may also be included:

[0147] Step D1: Obtain the number of placeholders in the log interface code file and the number of input parameters of the log interface code file.

[0148] In this embodiment, the number of placeholders refers to the number of placeholders included in the log interface code file.

[0149] The input parameter quantity refers to the quantity of parameters input to the log interface code file when generating the application log of the target application.

[0150] After generating the application log of the target application, the number of placeholders in the log interface code file and the number of input parameters of the log interface code file can be obtained.

[0151] Step D2: performing integrity check on the application log according to the number of placeholders and the input parameter quantity.

[0152] After obtaining the number of placeholders in the log interface code file and the number of input parameters in the log interface code file, the application log can be checked for integrity based on the number of placeholders and the number of input parameters. That is, determine whether the number of placeholders is the same as the number of input parameters. If they are the same, it means that the application log verification is successful, and the application log is saved. If they are not the same, that is, the number of input parameters is less than the number of placeholders, it means that the generated application log is incomplete and the verification fails.

[0153] When the integrity check fails, the existing application running information that was not entered can be checked, and the missing running information can be added to the log interface code file to obtain the application log after the integrity check passes, so as to save it as the final application log of the current event.

[0154] The embodiment of the present application can ensure the integrity of the log content after running by performing integrity check on the application log of the generated target application.

[0155] The application log generation method provided in the embodiment of the present application can achieve the purpose of enabling applications on different operating systems to generate structured and consistent application logs by defining a set of universal log recording standards, determining the content of the log through a descriptive language, and calling a pre-developed parsing and code generation tool to convert the log description information into a log interface code file for applications on different operating systems. At the same time, when the log specification changes, it is only necessary to run the parsing and code generation tool to complete the modification of all systems without changing the code. It can ensure that the format and content are completely consistent, and there will be no differences caused by human factors. There will also be no lag caused by the lack of a unified format or the use of documents for log unification, and differences caused by human editing of the code.

[0156] Reference Figure 6 , shows a schematic diagram of the structure of a log interface code file generation device provided by an embodiment of the present application, and the log interface code file generation device can be applied to a management platform. Figure 6 As shown, the log interface code file generating device 600 may include the following modules:

[0157] The application service division module 610 is used to divide the application service corresponding to the application program into several service modules;

[0158] The log description information writing module 620 is used to obtain log description information corresponding to the preset fields of the business modules and each business module, and the real-time application running information in the event field of the preset field is occupied by a preset placeholder;

[0159] The interface code file acquisition module 630 is used to call the pre-developed parsing and code generation tool to convert the log description information into the log interface code file of the application of different operating systems, so that the terminals of different operating systems can generate the application log of the application according to the application and the log interface code files corresponding to the different operating systems.

[0160] Optionally, the interface code file acquisition module includes:

[0161] A file parsing information acquisition unit, used for calling the parsing and code generation tool to parse the log description information and obtain description file parsing information;

[0162] The interface code file generating unit is used to convert the description file parsing information according to the code requirements of different operating systems and in accordance with a preset log format to generate log interface code files of different operating systems.

[0163] Optionally, the device further comprises:

[0164] A changed service acquisition module, used to acquire the changed application service of the application program;

[0165] A first interface code acquisition module, used to acquire the first interface code corresponding to the changed application service of different operating systems;

[0166] The first log file generating module is used to update the log interface code file of the corresponding operating system based on the first interface code of the different operating systems, and generate the first log interface code file of the application program of the different operating systems.

[0167] Optionally, the first log file generating module includes:

[0168] A first log file acquisition unit is used to delete the first interface code of the different operating systems from the log interface code files of the different operating systems when the changed application service is a reduced application service, so as to obtain the first log interface code files of the application programs of the different operating systems;

[0169] The second log file acquisition unit is used to merge the log interface code files of different operating systems and the first log interface code files to obtain the first log interface code files of the application programs of different operating systems when the changed application service is an added application service.

[0170] Optionally, the device further comprises:

[0171] A change module acquisition module, used to acquire a change business module of an application business of the application program;

[0172] A second interface code acquisition module, used to acquire the second interface code corresponding to the change service module of different operating systems;

[0173] The second log file generating module is used to update the log interface code file of the corresponding operating system based on the second interface code of the different operating system, and generate the second log interface code file of the application program of the different operating system.

[0174] Optionally, the second log file generating module includes:

[0175] A third log file acquisition unit is used to delete the second interface code of the different operating systems from the log interface code files of the different operating systems when the changed business module is a reduced business module, so as to obtain the second log interface code files of the application programs of the different operating systems;

[0176] The fourth log file acquisition unit is used to merge the log interface code files and the second log interface code files of different operating systems when the changed business module is an added business module, so as to obtain the second log interface code files of the application programs of different operating systems.

[0177] Optionally, the device further comprises:

[0178] A target log description writing module, used for obtaining target log description information of a number of business modules and a changed field under each of the business modules when there is a changed field under the target business module of the application business of the application program;

[0179] A third log file generation module, used for calling the parsing and code generation tool to convert the target log description information into a third log interface code file of a different operating system;

[0180] A log interface code file update module, used to update the log interface code files of different operating systems based on the third log interface code files of different operating systems;

[0181] The changed field is at least one of a newly added field and / or a reduced field.

[0182] The log interface code file generation device provided in the embodiment of the present application can achieve the purpose of enabling applications of different operating systems to generate structured and content-consistent application logs by defining a set of universal log recording standards, determining the content of the log through a description language, and calling a pre-developed parsing and code generation tool to convert the log description information into a log interface code file of an application program of different operating systems. At the same time, when the log specification changes, it is only necessary to run the parsing and code generation tool to complete the modification of all systems without changing the code. It can ensure that the format and content are completely consistent, and there will be no differences caused by human factors. There will also be no lag caused by the lack of a unified format or the use of documents for log unification, and differences caused by human editing of the code.

[0183] Reference Figure 7 , shows a schematic diagram of the structure of an application log generating device provided by an embodiment of the present application, and the application log generating device can be applied to a terminal on which a target operating system is installed. Figure 7 As shown, the application log generating device 700 may include the following modules:

[0184] The log file acquisition module 710 is used to acquire a log interface code file matching the target application and the target operating system from the management platform when generating an application log of the target application;

[0185] The application running information acquisition module 720 is used to acquire the application running information of the target application when it is running;

[0186] The application log generation module 730 is used to replace the corresponding placeholder in the log interface code file with the application characters corresponding to the application running information according to the input function provided in the log interface code file, so as to generate the application log of the target application.

[0187] Optionally, the device further comprises:

[0188] A quantity acquisition module, used to acquire the number of placeholders in the log interface code file and the input parameter quantity of the log interface code file;

[0189] A log verification module is used to perform integrity verification on the application log according to the number of placeholders and the input parameter quantity.

[0190] The application log generation device provided in the embodiment of the present application can achieve the purpose of enabling applications of different operating systems to generate structured and content-consistent application logs by defining a set of universal log recording standards, determining the content of the log through a descriptive language, and calling a pre-developed parsing and code generation tool to convert the log description information into a log interface code file of applications of different operating systems. At the same time, when the log specification changes, it is only necessary to run the parsing and code generation tool to complete the modification of all systems without changing the code. It can ensure that the format and content are completely consistent, and there will be no differences caused by human factors. There will also be no lag caused by the lack of a unified format or the use of documents for log unification, and differences caused by human editing of the code.

[0191] An embodiment of the present application also provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the above-mentioned log interface code file generation method or the above-mentioned application log generation method.

[0192] Figure 8 FIG. 8 is a schematic diagram showing the structure of an electronic device 800 according to an embodiment of the present invention. Figure 8 As shown, the electronic device 800 includes a central processing unit (CPU) 801, which can perform various appropriate actions and processes according to computer program instructions stored in a read-only memory (ROM) 802 or computer program instructions loaded from a storage unit 808 into a random access memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 can also be stored. The CPU 801, the ROM 802, and the RAM 803 are connected to each other via a bus 804. An input / output (I / O) interface 805 is also connected to the bus 804.

[0193] Multiple components in the electronic device 800 are connected to the I / O interface 805, including: an input unit 806, such as a keyboard, a mouse, a microphone, etc.; an output unit 807, such as various types of displays, speakers, etc.; a storage unit 808, such as a disk, an optical disk, etc.; and a communication unit 809, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 809 allows the electronic device 800 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.

[0194] The various processes and processing described above may be performed by the processing unit 801. For example, the method of any of the above embodiments may be implemented as a computer software program, which is tangibly contained in a computer-readable medium, such as the storage unit 808. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 800 via the ROM 802 and / or the communication unit 809. When the computer program is loaded into the RAM 803 and executed by the CPU 801, one or more actions in the method described above may be performed.

[0195] In addition, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned log interface code file generation method or the above-mentioned application log generation method is implemented.

[0196] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0197] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, devices, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0198] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, terminals (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing terminal generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0199] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing terminal to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0200] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal so that a series of operating steps are executed on the computer or other programmable terminal to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable terminal. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0201] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present application.

[0202] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal. In the absence of further restrictions, the elements defined by the statement "comprise a ..." do not exclude the presence of other identical elements in the process, method, article or terminal including the elements.

[0203] The above is a detailed introduction to a log interface code file generation method, an application log generation method, a device, an electronic device and a computer-readable storage medium provided by the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for generating a log interface code file, characterized in that: Applied to a management platform, the method includes: Divide the application business corresponding to the application into several business modules; Acquire log description information corresponding to a plurality of the business modules and a preset field under each of the business modules, wherein the real-time application running information in the event field in the preset field is occupied by a preset placeholder; The pre-developed parsing and code generation tool is called to convert the log description information into the log interface code file of the application of different operating systems, so that the terminals of different operating systems can generate the application log of the application according to the application and the log interface code files corresponding to the different operating systems.

2. The method according to claim 1, characterized in that The calling of the pre-developed parsing and code generation tool to convert the log description information into a log interface code file of the application program of different operating systems includes: Calling the parsing and code generation tool to parse the log description information to obtain description file parsing information; According to the code requirements of different operating systems, the description file parsing information is converted and processed according to a preset log format to generate log interface code files of different operating systems.

3. The method according to claim 1, characterized in that After calling the pre-developed parsing and code generation tool to convert the log description information into a log interface code file of the application program of different operating systems, the method further includes: Obtaining a change application service of the application; Obtaining first interface codes corresponding to the changed application services of different operating systems; The log interface code file of the corresponding operating system is updated based on the first interface code of the different operating systems to generate the first log interface code file of the application program of the different operating systems.

4. The method according to claim 3, characterized in that The updating of the log interface code file of the corresponding operating system based on the first interface code of the different operating systems to generate the first log interface code file of the application program of the different operating systems includes: When the changed application service is a reduced application service, deleting the first interface code of the different operating systems from the log interface code files of the different operating systems to obtain the first log interface code files of the application programs of the different operating systems; or When the changed application service is an added application service, the log interface code files and the first log interface code files of different operating systems are merged to obtain the first log interface code files of the application programs of different operating systems.

5. The method according to claim 1, characterized in that After calling the pre-developed parsing and code generation tool to convert the log description information into a log interface code file of the application program of different operating systems, the method further includes: Obtaining a change service module of an application service of the application program; Obtaining second interface codes corresponding to the change service modules of different operating systems; The log interface code file of the corresponding operating system is updated based on the second interface code of the different operating system to generate the second log interface code file of the application program of the different operating system.

6. The method according to claim 5, characterized in that The updating of the log interface code file of the corresponding operating system based on the second interface code of the different operating systems to generate the second log interface code file of the application program of the different operating systems includes: When the changed business module is a reduced business module, deleting the second interface code of the different operating system from the log interface code file of the different operating system to obtain the second log interface code file of the application of the different operating system; or When the changed business module is an added business module, the log interface code files and the second log interface code files of different operating systems are merged to obtain the second log interface code files of the application programs of different operating systems.

7. The method according to claim 1, characterized in that After calling the pre-developed parsing and code generation tool to convert the log description information into a log interface code file of the application program of different operating systems, the method further includes: When there is a changed field under the target business module of the application business of the application program, obtaining target log description information of the changed field under several business modules and each business module; Calling the parsing and code generation tool to convert the target log description information into a third log interface code file of a different operating system; Updating the log interface code files of different operating systems based on the third log interface code files of different operating systems; The changed field is at least one of a newly added field and / or a reduced field.

8. A method for generating an application log, characterized in that: Applied to a terminal for installing a target operating system, the method comprises: When generating an application log of a target application, obtaining a log interface code file matching the target application and the target operating system from a management platform; Obtaining application running information of the target application when it is running; According to the input parameter function provided in the log interface code file, the application characters corresponding to the application running information replace the corresponding placeholders in the log interface code file to generate the application log of the target application.

9. The method according to claim 8, characterized in that After replacing the corresponding placeholder in the log interface code file with the application character corresponding to the application running information according to the input parameter function provided in the log interface code file to generate the application log of the target application, the method further includes: Obtain the number of placeholders in the log interface code file and the number of input parameters of the log interface code file; An integrity check is performed on the application log according to the number of placeholders and the input parameter quantity.

10. A log interface code file generating device, characterized in that: Applied to a management platform, the device comprises: An application business division module is used to divide the application business corresponding to the application program into several business modules; A log description information writing module is used to obtain log description information corresponding to a plurality of the business modules and a preset field under each of the business modules, and the real-time application running information in the event field in the preset field is occupied by a preset placeholder; The interface code file acquisition module is used to call the pre-developed parsing and code generation tool to convert the log description information into the log interface code file of the application of different operating systems, so that the terminals of different operating systems can generate the application log of the application according to the application and the log interface code files corresponding to the different operating systems.

11. An application log generating device, characterized in that: A terminal for installing a target operating system, the device comprising: A log file acquisition module, used to acquire a log interface code file matching the target application and the target operating system from a management platform when generating an application log of the target application; An application running information acquisition module, used to acquire application running information of the target application when it is running; The application log generation module is used to replace the corresponding placeholder in the log interface code file with the application characters corresponding to the application running information according to the input function provided in the log interface code file, so as to generate the application log of the target application.

12. An electronic device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the method for generating a log interface code file according to any one of claims 1 to 7 or the method for generating an application log according to any one of claims 8 to 9 is implemented.

13. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the log interface code file generation method described in any one of claims 1 to 7, or the application log generation method described in any one of claims 8 to 9.