Log acquisition method, device and equipment

By using interceptors to record and display logs in the client's interface request, the problem that client developers need to frequently manually obtain interface logs is solved, and the log acquisition efficiency is improved.

CN113760692BActive Publication Date: 2025-02-25BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010578749.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-23
Publication Date
2025-02-25
Estimated Expiration
2040-06-23

AI Technical Summary

Technical Problem

During interface debugging, client developers need to frequently manually obtain interface logs through adb, resulting in large amount of tasks and low log acquisition efficiency.

Method used

After the client sends an interface request, the interceptor is used to intercept the interface request and record the log, and determine whether the log pop-up function is turned on, and when it is opened, the corresponding log of the interface is displayed through the log pop-up window.

Benefits of technology

It improves the efficiency of accessing interface-related logs, reduces the need for client developers to manually operate through adb, and simplifies the log acquisition process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113760692B_ABST
    Figure CN113760692B_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a log acquisition method, apparatus and device. After a client sends an interface request, the interface request can be intercepted by an interceptor, and the log corresponding to the interface can be recorded; after the log corresponding to the interface is obtained, it is determined whether the log pop-up window function of the client is turned on; when it is determined that the log pop-up window function is turned on, the log corresponding to the interface is displayed through a log pop-up window, so that the client developer can directly obtain the log corresponding to the interface through the log pop-up window, without the need for the client developer to manually operate through adb to obtain the relevant log as in the prior art, thereby improving the efficiency of obtaining the interface related logs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of computer technology, and in particular to a log acquisition method, device and equipment. Background Art

[0002] Logging is a common method for program debugging and problem location. During interface debugging, especially when an interface error occurs, obtaining relevant interface logs is crucial for program debugging and problem location.

[0003] In the prior art, during the interface debugging process, if an interface error occurs, the client developer is usually required to manually obtain the relevant log through adb, output the log to the workbench, and then copy and paste it to the gateway or backend developer for interface confirmation; after the gateway or backend developer completes the development, the client developer also needs to reconfirm in order to obtain the relevant log.

[0004] Since each time an error occurs in the interface, the above operations need to be repeated to obtain relevant logs; especially when network management or backend developers frequently need to obtain logs, client developers need to constantly manually obtain relevant logs through adb, which is a large task and leads to low efficiency in obtaining logs. Summary of the invention

[0005] The embodiments of the present application provide a log acquisition method, apparatus and device, which improve the efficiency of acquiring interface-related logs during interface debugging.

[0006] In a first aspect, an embodiment of the present application provides a log acquisition method, which may include:

[0007] After the client sends an interface request, the interface request is intercepted and a log corresponding to the interface is recorded.

[0008] Determine whether the log pop-up function of the client is turned on.

[0009] When it is determined that the log pop-up window function is turned on, the log corresponding to the interface is displayed through the log pop-up window.

[0010] In a possible implementation, before determining whether the log pop-up function of the client is turned on, the method may further include:

[0011] Determine whether the interface request fails.

[0012] If it is determined that the interface request fails, a log corresponding to the interface is reported.

[0013] In a possible implementation, the interface request is an interface request in a test environment, and the method may further include:

[0014] Determine whether the environment switching function is turned on.

[0015] When the environment switching function is turned on, the test environment is determined; wherein the test environment includes any one of an online environment, a grayscale environment, and a pre-release environment.

[0016] In a possible implementation, determining the test environment may include:

[0017] It is determined whether a first operation of switching the online environment is detected.

[0018] If the first operation is not detected, the pre-release environment is determined to be the test environment.

[0019] If the first operation is detected, it is determined whether a second operation of switching the grayscale environment is detected.

[0020] The test environment is determined according to the detection result.

[0021] In a possible implementation, determining the test environment according to the detection result may include:

[0022] If the second operation is not detected, the online environment is determined to be the test environment.

[0023] If the second operation is detected, the grayscale environment is determined to be the test environment.

[0024] In a possible implementation, displaying the log corresponding to the interface through the log pop-up window may include:

[0025] Determine whether the function of displaying correct logs is enabled.

[0026] If it is determined that the function of the correct log is turned on, the log corresponding to the interface is displayed through the log pop-up window; wherein the log includes a correct log and an error log.

[0027] If it is determined that the function of the correct log is not turned on, the error log corresponding to the interface is displayed through the log pop-up window.

[0028] In a second aspect, an embodiment of the present application further provides a log acquisition device, which may include:

[0029] The processing module is used to intercept the interface request after the client sends the interface request and record the log corresponding to the interface.

[0030] The processing module is also used to determine whether the log pop-up function of the client is turned on.

[0031] The display module is further used to display the log corresponding to the interface through the log pop-up window when it is determined that the log pop-up window function is turned on.

[0032] In a possible implementation manner, the device further includes a sending module.

[0033] The processing module is further used to determine whether the interface request fails.

[0034] The sending module is used to report a log corresponding to the interface if it is determined that the interface request fails.

[0035] In a possible implementation manner, the interface request is an interface request in a test environment.

[0036] The processing module is also used to determine whether the environment switching function is turned on; and when the environment switching function is turned on, determine the test environment; wherein the test environment includes any one of an online environment, a grayscale environment, and a pre-release environment.

[0037] In one possible implementation, the processing module is specifically used to determine whether a first operation of switching an online environment is detected; if the first operation is not detected, determining that the pre-release environment is the test environment; if the first operation is detected, determining whether a second operation of switching a grayscale environment is detected; and determining the test environment based on the detection result.

[0038] In a possible implementation, the processing module is specifically configured to determine that the online environment is the test environment if the second operation is not detected; and to determine that the grayscale environment is the test environment if the second operation is detected.

[0039] In a possible implementation, the processing module is further used to determine whether a function of displaying a correct log is turned on.

[0040] The display module is specifically used to display the log corresponding to the interface through the log pop-up window if it is determined that the function of the correct log is turned on; wherein the log includes a correct log and an error log; if it is determined that the function of the correct log is not turned on, the error log corresponding to the interface is displayed through the log pop-up window.

[0041] In a third aspect, an embodiment of the present application further provides an electronic device, which may include a memory and a processor; wherein:

[0042] The memory is used to store computer programs.

[0043] The processor is used to read the computer program stored in the memory, and execute the log acquisition method described in any possible implementation manner of the first aspect according to the computer program in the memory.

[0044] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions. When a processor executes the computer-executable instructions, the log acquisition method described in any possible implementation of the first aspect above is implemented.

[0045] The log acquisition method, apparatus and device provided in the embodiments of the present application can intercept the interface request through an interceptor after the client sends an interface request, and record the log corresponding to the interface; after obtaining the log corresponding to the interface, determine whether the log pop-up window function of the client is turned on; when it is determined that the log pop-up window function is turned on, display the log corresponding to the interface through the log pop-up window, so that the client developer can directly obtain the log corresponding to the interface through the log pop-up window, without the need for the client developer to manually operate through adb to obtain the relevant log as in the prior art, thereby improving the efficiency of obtaining the interface related logs. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0047] Figure 1 A flow chart of a log acquisition method provided in an embodiment of the present application;

[0048] Figure 2 A schematic diagram of obtaining a log provided in an embodiment of the present application;

[0049] Figure 3 A schematic diagram of a setting interface provided in an embodiment of the present application;

[0050] Figure 4 A schematic diagram of determining a test environment provided in an embodiment of the present application;

[0051] Figure 5 A schematic diagram of the structure of a log acquisition device provided in an embodiment of the present application;

[0052] Figure 6 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention.

[0053] The above drawings have shown clear embodiments of the present disclosure, which will be described in more detail below. These drawings and text descriptions are not intended to limit the scope of the present disclosure in any way, but to illustrate the concepts of the present disclosure to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0054] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.

[0055] In the embodiments of the present application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of the associated objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. In the text description of the present application, the character " / " generally indicates that the associated objects before and after are in an "or" relationship.

[0056] The log acquisition method provided in the embodiment of the present application can be applied to the scenario of interface debugging. In the prior art, during the interface debugging process, if an interface error occurs, the client developer is usually required to manually obtain the relevant logs through adb, and copy and paste them to send to the gateway or backend developer for interface confirmation. Especially when the network manager or backend developer frequently needs to obtain logs, the client developer needs to constantly manually obtain the relevant logs through adb, which has a large workload and will result in low efficiency in obtaining logs.

[0057] During the interface debugging process, in order to avoid the need for client developers to manually operate through adb to obtain relevant logs, thereby improving the efficiency of obtaining interface-related logs, you can try to combine the network framework okttp and the Interceptor interceptor in the framework, and add interception control logic to the interface request. The interceptor will intercept the process in the interface request and execute some desired logic, thereby unifying the request parameters and request interface of the interface request.

[0058] Based on this concept, an embodiment of the present application provides a log acquisition method. After the client sends an interface request, the interface request can be intercepted by an interceptor, and the log corresponding to the interface can be recorded; after obtaining the log corresponding to the interface, it is determined whether the log pop-up function of the client is turned on; when it is determined that the log pop-up function is turned on, the log corresponding to the interface is displayed through a log pop-up window, so that the client developer can directly obtain the log corresponding to the interface through the log pop-up window, without the need for the client developer to manually operate through adb to obtain the relevant log as in the prior art, thereby improving the efficiency of obtaining interface-related logs.

[0059] The following specific embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0060] Figure 1 The present invention provides a flow chart of a log acquisition method provided in an embodiment of the present invention. The log acquisition method can be executed by software and / or hardware devices. For example, the hardware device can be a log acquisition device, and the log acquisition device can be set in an electronic device. For example, the electronic device can be a terminal. Figure 1 As shown, the log acquisition method may include:

[0061] S101. After the client sends an interface request, the interface request is intercepted and a log corresponding to the interface is recorded.

[0062] When debugging the interface, the client can first construct an interface request and send the interface request. It is worth noting that in the embodiment of the present application, in order to avoid the client developer manually obtaining relevant logs, after sending the interface request, an interceptor can be added after the interface request for interception. For an example, see Figure 2 As shown, Figure 2 A schematic diagram for obtaining logs is provided for an embodiment of the present application. After sending an interface request, the interface request is intercepted by setting an interceptor, and it is determined whether the request is successful or not, and whether the interface request fails. If the interface request is successful, the log corresponding to the interface can be recorded, and the following S102 can be executed to determine whether the log pop-up function of the client is turned on. If the interface request fails, the log corresponding to the interface can also be recorded, and the following S102 can be executed to determine whether the log pop-up function of the client is turned on.

[0063] It should be noted that in an embodiment of the present application, when it is determined that the interface request has failed, the error log reporting interface can also be called to report the log corresponding to the interface to the network management or background server, thereby improving the efficiency of locating problems and solving online problems.

[0064] S102: Determine whether the log pop-up function of the client is turned on.

[0065] For example, you can set a log pop-up function button on the settings interface to facilitate developers and testers. In the initialization logic judgment, if the application to which the interface belongs is installed for the first time, only the relevant fields will be initialized and the entry to the settings interface will be displayed in the debug version. The online release version will not have the entry to the settings interface, and the relevant variables will not be saved, so as to prevent the impact on online users. See Figure 3 As shown, Figure 3 A schematic diagram of a setting interface provided for an embodiment of the present application, the setting interface includes not only a log pop-up function button, but also a grayscale environment switching function button and a display correct log function button. It is understandable that the embodiment of the present application is only described by taking the setting interface including a log pop-up function button, a grayscale environment switching function button and a display correct log function button as an example, but it does not mean that the embodiment of the present application is limited to this.

[0066] It is understandable that for the log pop-up function, if the log pop-up function is turned on, it means that the interface-related logs need to be displayed to the client developer through the log pop-up; if the log pop-up function is not turned on, it means that there is no need to display the interface-related logs to the client developer through the log pop-up. For the grayscale environment switching function, if the grayscale environment switching function is turned on, it means that it is necessary to switch to the grayscale environment and perform interface debugging in the grayscale environment; if the grayscale environment switching function is not turned on, it means that there is no need to switch to the grayscale environment, but to directly perform interface debugging in the online environment. For the display correct log function, if the display correct log function is turned on, it means that not only the wrong log information but also the correct log information needs to be displayed to the client developer; if the display correct log function is not turned on, it means that there is no need to display the correct log information to the client developer, and only the wrong log information needs to be displayed to the client developer.

[0067] Before debugging the interface, the client developer can first enter the setting interface and click the log pop-up function button to determine whether to turn on the log pop-up function. In this way, in the subsequent interface debugging process, the log acquisition device needs to first determine whether the log pop-up function is turned on; if it is determined that the log pop-up function is not turned on, the log corresponding to the interface will not be displayed through the log pop-up window, but the interface request data will be directly displayed; if it is determined that the log pop-up function is turned on, the log corresponding to the interface will be displayed through the log pop-up window, that is, the following S103 is executed:

[0068] S103: When it is determined that the log pop-up window function is turned on, the log corresponding to the interface is displayed through the log pop-up window.

[0069] In the embodiment of the present application, since relevant logic development is done when the log pop-up window pops up, and the log corresponding to the interface is displayed through the log pop-up window, the UI thread is required. Therefore, the logic of calling the log pop-up window in the interceptor cannot open the log pop-up window normally. In this case, the interface request parameters and interface error information need to be saved in the memory first, and the log pop-up window is opened by reading the information in the Observer, so as to display the log corresponding to the interface through the log pop-up window.

[0070] It should be noted that in the embodiment of the present application, since a display correct log function button is pre-set in the setting interface, the above Figure 2 As shown, therefore, before displaying the log corresponding to the interface through the log pop-up window, you can first determine whether the function of displaying the correct log is turned on; if it is determined that the function of displaying the correct log is turned on, then not only the wrong log information but also the correct log information needs to be displayed to the client developer through the log pop-up window; if it is determined that the function of displaying the correct log is not turned on, there is no need to display the correct log information to the client developer, and you only need to display the wrong log information to the client developer through the log pop-up window.

[0071] It is understandable that when the log corresponding to the interface is displayed through the log pop-up window, the input and output parameters of the interface are included in the log, that is, the log pop-up window mainly displays the input and output parameters of the interface. If the interface reports an error, an error pop-up box will be displayed on the display interface. A copy button is set in the error pop-up box. The client developer can copy the input and output parameters of the interface and send them to the corresponding gateway or backend developer. In this way, the gateway or backend developer can quickly find the log corresponding to the interface through the funcationId and uuid in the input parameters to locate the problem, effectively shortening the interface joint debugging time and interface testing time, thereby improving the interface joint debugging and interface testing efficiency.

[0072] It can be seen that the log acquisition method provided in the embodiment of the present application can intercept the interface request through an interceptor after the client sends an interface request, and record the log corresponding to the interface; after obtaining the log corresponding to the interface, determine whether the log pop-up function of the client is turned on; when it is determined that the log pop-up function is turned on, display the log corresponding to the interface through a log pop-up, so that the client developer can directly obtain the log corresponding to the interface through the log pop-up, without the need for the client developer to manually operate through adb to obtain the relevant log as in the prior art, thereby improving the efficiency of obtaining interface related logs.

[0073] Based on the above Figure 1In the embodiment shown, when debugging an interface, it is necessary to first deploy different test environments, and send interface requests under different test environments to complete debugging of the interface. In the prior art, since the test environment cannot be switched in the same Android application package (apk), when switching the test environment, it is necessary to modify the gradle configuration, and repackage the modified gradle configuration before the environment switching can be performed, which will result in a large workload for client developers and reduce the efficiency of environment switching.

[0074] In order to improve the efficiency of environment switching, a control layer can be added between gradle and interface access, and the switch of test environment can be realized through the control layer. This can solve the problem of repeated gradle configuration and repeated packaging, reduce the workload of client developers, and improve the efficiency of environment switching. For an example, see Figure 4 As shown, Figure 4 A schematic diagram of determining a test environment provided in an embodiment of the present application, wherein a method for determining the test environment may include:

[0075] S401: Determine whether the environment switching function is turned on.

[0076] Before performing interface debugging, you can first determine whether the environment switching function is turned on. If the environment switching function is not turned on, it means that there is no need to consider the test environment problem and the interface request can be sent directly; on the contrary, if the environment switching function is turned on, it means that the test environment problem needs to be considered, that is, execute the following S402-S403.

[0077] It is understandable that, generally, the test environment includes any one of an online environment, a grayscale environment, and a pre-release environment.

[0078] S402: When the environment switching function is turned on, determine whether a first operation of switching the online environment is detected.

[0079] S403: If the first operation is not detected, determine that the pre-release environment is a test environment.

[0080] In this scenario, if the first operation of switching to the online environment is not detected, the pre-release environment is determined as the test environment, and the interface will switch to the pre-release domain name corresponding to the pre-release environment, that is, the interface request is sent in the pre-release environment, and the interface can access the data corresponding to the pre-release environment.

[0081] In another scenario, if a first operation of switching to an online environment is detected, the following S404 is executed:

[0082] S404: If the first operation is detected, determine whether a second operation of switching the grayscale environment is detected.

[0083] S405: If the second operation is not detected, determine that the online environment is a test environment.

[0084] In this scenario, if the second operation of switching the grayscale environment is not detected, the online environment is determined as the test environment, and the interface will switch to the pre-issued domain name corresponding to the online environment, that is, the interface request is sent in the online environment, and the interface can access the data corresponding to the online environment.

[0085] In another scenario, if a second operation of switching the grayscale environment is detected, the following S406 is executed:

[0086] S406: If the second operation is detected, determine that the grayscale environment is a test environment.

[0087] In this scenario, if a second operation of switching the grayscale environment is detected, the grayscale environment is determined as a test environment, and the interface will switch to the pre-issued domain name corresponding to the grayscale environment, that is, an interface request is sent in the grayscale environment, and the interface can access the data corresponding to the grayscale environment.

[0088] After the test environment is switched, the relevant variables are saved locally to ensure that the interface displays relevant data according to the last configured test environment after the application is started next time, and the domain name and funcationId switching method in the relevant configuration file is called to switch the test environment. In addition, the settings interface can be refreshed to make the interface pull data according to the switched domain name and funcationId, so that the refreshed data on the page can be switched to the data in the corresponding test environment.

[0089] It can be seen that in the embodiment of the present application, a control layer can be added between gradle and interface access, and the switching of the test environment can be realized through the control layer. This can solve the problem of repeated gradle configuration and repeated packaging, reduce the workload of client developers, and improve the efficiency of environment switching.

[0090] Figure 5 A structural diagram of a log acquisition device 50 provided in an embodiment of the present application is provided. For example, see Figure 5 As shown, the log acquisition device 50 may include:

[0091] The processing module 501 is used to intercept the interface request after the client sends the interface request and record the log corresponding to the interface.

[0092] The processing module 501 is also used to determine whether the log pop-up function of the client is turned on.

[0093] The display module 502 is further configured to display the log corresponding to the interface through a log pop-up window when it is determined that the log pop-up window function is turned on.

[0094] Optionally, the log acquisition device 50 further includes a sending module 503 .

[0095] The processing module 501 is also used to determine whether the interface request fails.

[0096] The sending module 503 is used to report the log corresponding to the interface if it is determined that the interface request fails.

[0097] Optionally, the interface request is an interface request in a test environment.

[0098] The processing module 501 is also used to determine whether the environment switching function is turned on; and when the environment switching function is turned on, determine the test environment; wherein the test environment includes any one of an online environment, a grayscale environment, and a pre-release environment.

[0099] Optionally, processing module 501 is specifically used to determine whether a first operation of switching an online environment is detected; if the first operation is not detected, determining that the pre-release environment is a test environment; if the first operation is detected, determining whether a second operation of switching a grayscale environment is detected; and determining the test environment based on the detection result.

[0100] Optionally, the processing module 501 is specifically configured to determine that the online environment is a test environment if the second operation is not detected; and determine that the grayscale environment is a test environment if the second operation is detected.

[0101] Optionally, the processing module 501 is further used to determine whether a function of displaying a correct log is turned on.

[0102] Display module 502 is specifically used to display the log corresponding to the interface through a log pop-up window if the function of determining the correct log is turned on; wherein the log includes a correct log and an error log; if the function of determining the correct log is not turned on, then the error log corresponding to the interface is displayed through a log pop-up window.

[0103] The log acquisition device 50 provided in the embodiment of the present application can execute the technical solution of the log acquisition method in any of the above embodiments, and its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the log acquisition method. Please refer to the implementation principle and beneficial effects of the log acquisition method, and no further details will be given here.

[0104] Figure 6 A schematic diagram of the structure of an electronic device 60 provided in an embodiment of the present invention is provided. Figure 6 As shown, the electronic device 60 may include a processor 601 and a memory 602; wherein,

[0105] The memory 602 is used to store computer programs.

[0106] The processor 601 is used to read the computer program stored in the memory 602 and execute the technical solution of the log acquisition method in any of the above embodiments according to the computer program in the memory 602.

[0107] Optionally, the memory 602 may be independent or integrated with the processor 601. When the memory 602 is a device independent of the processor 601, the electronic device may further include a bus for connecting the memory 602 and the processor 601.

[0108] Optionally, this embodiment further includes: a communication interface, which can be connected to the processor 601 through a bus. The processor 601 can control the communication interface to implement the receiving and sending functions of the above electronic device.

[0109] The electronic device 60 shown in the embodiment of the present invention can execute the technical solution of the log acquisition method in any of the above embodiments, and its implementation principle and beneficial effects are similar to the implementation principle and beneficial effects of the log acquisition method. Please refer to the implementation principle and beneficial effects of the log acquisition method, and no further details will be given here.

[0110] An embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions. When a processor executes the computer-executable instructions, the technical solution of the log acquisition method in any of the above embodiments is implemented. Its implementation principle and beneficial effects are similar to those of the log acquisition method. Please refer to the implementation principle and beneficial effects of the log acquisition method, which will not be repeated here.

[0111] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0112] The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. In addition, the functional units in the various embodiments of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware or in the form of hardware plus software functional units.

[0113] The above-mentioned integrated module implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (English: processor) to perform some steps of the methods of various embodiments of the present invention.

[0114] It should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0115] The memory may include a high-speed RAM memory, and may also include a non-volatile storage NVM, such as at least one disk memory, and may also be a USB flash drive, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0116] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present invention is not limited to only one bus or one type of bus.

[0117] The computer-readable storage medium may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The storage medium may be any available medium that can be accessed by a general or special purpose computer.

[0118] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A log acquisition method, characterized in that: include: After the client sends an interface request, intercept the interface request and record the log corresponding to the interface; Determine whether the log pop-up function of the client is turned on; When it is determined that the log pop-up function is turned on, determine whether the function of displaying the correct log is turned on; if it is determined that the function of displaying the correct log is turned on, the log corresponding to the interface is displayed through the log pop-up window; wherein the log includes a correct log and an error log; if it is determined that the function of displaying the correct log is not turned on, the error log corresponding to the interface is displayed through the log pop-up window.

2. The method according to claim 1, characterized in that Before determining whether the log pop-up function of the client is turned on, the method further includes: Determine whether the interface request fails; If it is determined that the interface request fails, a log corresponding to the interface is reported.

3. The method according to claim 1, characterized in that: The interface request is an interface request in a test environment, and the method further includes: Determine whether the environment switching function is turned on; When the environment switching function is turned on, the test environment is determined; wherein the test environment includes any one of an online environment, a grayscale environment, and a pre-release environment.

4. The method according to claim 3, characterized in that The determining the test environment comprises: Determining whether a first operation of switching the online environment is detected; If the first operation is not detected, determining that the pre-launch environment is the test environment; If the first operation is detected, determining whether a second operation of switching the grayscale environment is detected; The test environment is determined according to the detection result.

5. The method according to claim 4, characterized in that Determining the test environment according to the detection result includes: If the second operation is not detected, determining that the online environment is the test environment; If the second operation is detected, the grayscale environment is determined to be the test environment.

6. A log acquisition device, characterized in that: include: A processing module, used to intercept the interface request after the client sends the interface request, and record the log corresponding to the interface; The processing module is further used to determine whether the log pop-up function of the client is turned on; The display module is also used to determine whether the function of displaying the correct log is turned on when it is determined that the log pop-up window function is turned on; if it is determined that the function of displaying the correct log is turned on, the log corresponding to the interface is displayed through the log pop-up window; wherein the log includes a correct log and an error log; if it is determined that the function of displaying the correct log is not turned on, the error log corresponding to the interface is displayed through the log pop-up window.

7. The device according to claim 6, characterized in that The device also includes a sending module; The processing module is further used to determine whether the interface request fails; The sending module is used to report a log corresponding to the interface if it is determined that the interface request fails.

8. An electronic device, characterized in that: comprising a memory and a processor; wherein, The memory is used to store computer programs; The processor is used to read the computer program stored in the memory and execute the log acquisition method according to any one of claims 1 to 5 according to the computer program in the memory.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the processor executes the computer-executable instructions, the log acquisition method described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Log management system and log management method

    CN104156300A