Test log generation method and device, electronic equipment and storage medium

CN115729730BActive Publication Date: 2026-09-04DOUYIN VISION CO LTD
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202111011426.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-31
Publication Date
2026-09-04
Estimated Expiration
2041-08-31

AI Technical Summary

Technical Problem

然而,非结构化的用户日志内容比较繁杂,例如,用户日志以单行文本的形式展示,导致在解析日志信息时,会增大系统开销,以使解析日志的时间增加,进而降低系统的执行效率

Benefits of technology

[0079] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the above-described test log generation method.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115729730B_ABST
    Figure CN115729730B_ABST
Patent Text Reader

Abstract

The present disclosure provides a test log generation method and device, electronic equipment and storage medium, the method comprising: in the case of listening to a target event, obtaining task stack information corresponding to a current display interface; the target event includes an event of switching of a display interface of an electronic device; based on a preset log information structure, determining target log information from the task stack information; the target log information includes switching information of the display interface of the electronic device; the target log information is sent to a server, so that the server analyzes and displays the target log information. The present embodiment can improve the efficiency of the system by simplifying the task stack information.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and more specifically, to a test log generation method, apparatus, electronic device, and computer-readable storage medium. Background Technology

[0002] Electronic devices typically have various applications installed. When testing these applications, it is common to test how users switch between different applications or different pages within the same application while using the electronic device. However, problems may occur during these interface switching processes, such as unsmooth transitions or lag. In such cases, it is necessary to troubleshoot these issues.

[0003] In existing technologies, the aforementioned problems are typically investigated by reviewing large amounts of unstructured user logs to pinpoint the issues arising during interface switching. However, unstructured user logs are often complex, displaying information as single-line text, which increases system overhead during log parsing, leading to longer parsing times and reduced system efficiency. Summary of the Invention

[0004] This disclosure provides at least one method, apparatus, electronic device, and storage medium for generating test logs, which can solve at least one of the above problems.

[0005] This disclosure provides a method for generating test logs, including:

[0006] Upon detecting a target event, obtain the task stack information corresponding to the currently displayed interface; the target event includes an event in which the display interface of the electronic device is switched.

[0007] Based on a preset log information structure, target log information is determined from the task stack information; the target log information includes the switching information of the display interface of the electronic device.

[0008] The target log information is sent to the server so that the server can parse and display the target log information.

[0009] In this embodiment, upon detecting a change in the display interface, the task stack information corresponding to the current display interface can be obtained promptly. Secondly, based on a preset log information structure, target log information is determined from the task stack information, effectively simplifying the log information for easier parsing and thus improving system execution efficiency. Finally, the target log information is sent to the server, enabling the server to parse and display it, thereby accurately and efficiently identifying the problem area during the interface switch.

[0010] In one optional implementation, the target event is monitored in the following manner:

[0011] By modifying the startup file of the display interface, the target event can be listened for; or,

[0012] The target event is monitored by listening for the presence of the target keyword in the system log information; the system log information includes all log information under the operating environment of the electronic device.

[0013] In this embodiment of the disclosure, in order to listen to the interface switching event in a timely manner, the above two methods can be used to listen, which can ensure the real-time performance of the system and thus improve the execution efficiency of the system.

[0014] In one optional implementation, obtaining the task stack information corresponding to the currently displayed interface includes:

[0015] The task stack information is obtained from the system log information by calling the system application interface.

[0016] In one optional implementation, determining the target log information from the task stack information based on a preset log information structure includes:

[0017] Based on the preset log information structure, the target log information corresponding to the log information structure is determined from the task stack information;

[0018] The target log information is serialized to obtain serialized target log information;

[0019] Sending the target log information to the server includes:

[0020] The serialized target log information is sent to the server.

[0021] In this embodiment of the disclosure, the target log information is serialized to facilitate its access and manipulation, thereby improving the system's execution efficiency.

[0022] In one optional implementation, determining the target log information corresponding to the preset log information structure from the task stack information includes:

[0023] Based on a preset log information structure, a target class is determined from the task stack information; the target class refers to the relevant class that manages the task stack corresponding to the display interface.

[0024] The target field is determined from the target class, and the target log information corresponding to the log information structure is determined based on the target field.

[0025] In this embodiment of the disclosure, since the task stack information contains a lot of content, the relevant class of the task stack corresponding to the management display interface can be determined based on the preset log information structure, and the relevant fields of the task stack corresponding to the display interface can be determined from the class. This can achieve the purpose of simplifying the task stack information from different levels, and thus quickly determine the target log information.

[0026] In an optional implementation, after serializing the log information content to obtain the serialized target log information, the method further includes:

[0027] The serialized target log information is encrypted to obtain encrypted target log information;

[0028] Sending the target log information to the server includes:

[0029] The encrypted target log information is sent to the server.

[0030] In this embodiment of the disclosure, the serialized target log information is encrypted to obtain encrypted target log information, which can not only effectively protect user privacy, but also improve system security.

[0031] This disclosure provides a method for generating test logs, including:

[0032] Receive target log information, the target log information including switching information of the display interface of the electronic device, and the target log information is determined from the task stack information based on a preset log information structure;

[0033] The target log information is parsed and displayed.

[0034] In this embodiment of the disclosure, by parsing and displaying the target log information by the server, the historical record of interface switching of the electronic device can be displayed intuitively and clearly, thereby accurately and efficiently identifying the problem points of interface switching.

[0035] In one optional implementation, the target log information is serialized target log information, and the step of parsing and displaying the target log information includes:

[0036] The serialized target log information is deserialized, and the deserialized target log information is parsed and displayed.

[0037] In this embodiment of the disclosure, since the serialized target log information is in binary format, deserialization is required to facilitate the parsing of the target log information, thereby facilitating the display of the deserialized target log information.

[0038] In one optional implementation, the serialized target log information is serialized and encrypted target log information; the step of deserializing the target log information and displaying the deserialized target log information includes:

[0039] The encrypted target log information is decrypted to obtain the decrypted target log information;

[0040] The decrypted target log information is deserialized, and the deserialized target log information is parsed and displayed.

[0041] In this embodiment of the disclosure, since the target log information is in an encrypted format, the encrypted target log information is decrypted in order to parse and display the target log information.

[0042] In one optional implementation, displaying the deserialized target log information includes:

[0043] Based on the content of the deserialized target log information, a log view model is constructed; the log view model is used to reflect the changes of the target log information within a target time period.

[0044] In response to a request to view the target log information, the log view model is rendered based on the data in the log view model to display the target log information.

[0045] In this embodiment of the disclosure, by constructing a log view model and rendering the log view model based on the data in the log view model to display the target log information, the historical record of interface switching of the electronic device can be displayed intuitively, clearly and efficiently, thereby improving the execution efficiency of the system.

[0046] This disclosure also provides a test log generation apparatus, the apparatus comprising:

[0047] The acquisition module is used to acquire the task stack information corresponding to the currently displayed interface when a target event is detected; the target event includes an event in which the display interface of the electronic device is switched.

[0048] The determination module is used to determine target log information from the task stack information based on a preset log information structure; the target log information includes the switching information of the display interface of the electronic device;

[0049] The sending module is used to send the target log information to the server so that the server can parse and display the target log information.

[0050] In one optional implementation, the device further includes a monitoring module, the monitoring module being used for:

[0051] By modifying the startup file of the display interface, the target event can be listened for; or,

[0052] The target event is monitored by listening for the presence of the target keyword in the system log information; the system log information includes all log information under the operating environment of the electronic device.

[0053] In one optional implementation, the acquisition module is specifically used for:

[0054] The task stack information is obtained from the system log information by calling the system application interface.

[0055] In one optional implementation, the determining module is specifically used for:

[0056] Based on the preset log information structure, the target log information corresponding to the log information structure is determined from the task stack information;

[0057] The target log information is serialized to obtain serialized target log information;

[0058] The sending module is specifically used for:

[0059] The serialized target log information is sent to the server.

[0060] In one optional implementation, the determining module is specifically used for:

[0061] Based on a preset log information structure, a target class is determined from the task stack information; the target class refers to the relevant class that manages the task stack corresponding to the display interface.

[0062] The target field is determined from the target class, and the target log information corresponding to the log information structure is determined based on the target field.

[0063] In one optional implementation, the determining module is further configured to:

[0064] The serialized target log information is encrypted to obtain encrypted target log information;

[0065] The sending module is specifically used for:

[0066] The encrypted target log information is sent to the server.

[0067] In one optional implementation, this disclosure provides a test log generation apparatus, the apparatus comprising: a receiving module and a display module, wherein,

[0068] A receiving module is used to receive target log information, which includes switching information of the display interface of the electronic device, and the target log information is determined from the task stack information based on a preset log information structure.

[0069] The display module is used to parse and display the target log information.

[0070] In one optional implementation, the display module is specifically used for:

[0071] The serialized target log information is deserialized, and the deserialized target log information is parsed and displayed.

[0072] In one optional implementation, the display module is further configured to:

[0073] The encrypted target log information is decrypted to obtain the decrypted target log information;

[0074] The decrypted target log information is deserialized, and the deserialized target log information is parsed and displayed.

[0075] In one optional implementation, the display module is specifically used for:

[0076] Based on the content of the deserialized target log information, a log view model is constructed; the log view model is used to reflect the changes of the target log information within a target time period.

[0077] In response to a request to view the target log information, the log view model is rendered based on the data in the log view model to display the target log information.

[0078] This disclosure also provides an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the above-described test log generation method are performed.

[0079] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the above-described test log generation method.

[0080] For a description of the effects of the aforementioned test log generation device, electronic device, and computer-readable storage medium, please refer to the description of the test log generation method above; it will not be repeated here.

[0081] To make the above-mentioned objects, features and advantages of this disclosure more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description

[0082] To more clearly illustrate the technical solutions of the embodiments of this disclosure, the accompanying drawings used in the embodiments will be briefly described below. These drawings are incorporated in and constitute a part of this specification. They illustrate embodiments conforming to this disclosure and, together with the specification, serve to explain the technical solutions of this disclosure. It should be understood that the following drawings only show some embodiments of this disclosure and should not be considered as limiting the scope. Those skilled in the art can obtain other related drawings based on these drawings without creative effort.

[0083] Figure 1 A flowchart illustrating a client-side test log generation method provided in this embodiment of the disclosure;

[0084] Figure 2 This is a schematic diagram of an interface switching method provided in an embodiment of the present disclosure;

[0085] Figure 3 A flowchart illustrating another method for generating test logs for a client provided in this embodiment of the disclosure;

[0086] Figure 4 A flowchart illustrating a method for determining target log information provided in an embodiment of this disclosure;

[0087] Figure 5 A flowchart illustrating a server-side test log generation method provided in this embodiment of the disclosure;

[0088] Figure 6A flowchart illustrating a method for parsing and displaying deserialized target log information provided in this embodiment of the disclosure;

[0089] Figure 7 A schematic diagram of the structure of a client-side test log generation device provided in an embodiment of this disclosure;

[0090] Figure 8 A schematic diagram of the structure of another client-side test log generation device provided in an embodiment of this disclosure;

[0091] Figure 9 This is a schematic diagram of the structure of a server-side test log generation device provided in an embodiment of this disclosure;

[0092] Figure 10 This is a schematic diagram of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0093] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this disclosure, and not all of them. The components of the embodiments of this disclosure described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this disclosure provided in the accompanying drawings is not intended to limit the scope of the claimed disclosure, but merely represents selected embodiments of this disclosure. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0094] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0095] In this document, the term "and / or" merely describes a relationship, indicating that three relationships can exist. For example, A and / or B can represent three cases: A alone, A and B simultaneously, and B alone. Furthermore, the term "at least one" in this document means any combination of at least two of any one or more elements. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.

[0096] Electronic devices typically have various applications installed. When testing these applications, it is common to test how users switch between different applications or different pages within the same application while using the electronic device. However, problems may occur during these interface switching processes, such as unsmooth transitions or lag. In such cases, it is necessary to troubleshoot these issues.

[0097] In existing technologies, the aforementioned problems are typically investigated by reviewing large amounts of unstructured user logs to pinpoint the issues arising during interface switching. However, unstructured user logs are often complex, displaying information as single-line text, which increases system overhead during log parsing, leading to longer parsing times and reduced system efficiency.

[0098] The user interface (also known as an Activity) displayed on an Android electronic device is one of the four main components of Android. These four components are: Activity, Service, OntentProvider, and Broadcast Receiver. When an Activity is switched (i.e., when the current Activity is in the foreground), the task stack information corresponding to that Activity also changes accordingly. Therefore, based on the contents of the task stack, the Activity switching record can be obtained. The Activity task stack is the fundamental data structure for Android system process scheduling and interface switching.

[0099] Based on the above research, this disclosure provides a test log generation method. Upon detecting a target event, the method acquires task stack information at the current moment. The task stack information includes user operation records for at least one application on an electronic device. Based on a preset log information structure, target log information is determined from the task stack information. The target log information includes display interface switching records from the operation records. The target log information is sent to a server so that the server can parse and display the target log information.

[0100] In this embodiment, by using a preset log information structure, the target log information is determined from the task stack information, which effectively simplifies the log information, facilitates its parsing, and thus improves the system's execution efficiency. Furthermore, for user convenience, the target log information is sent to a server for parsing and display.

[0101] To facilitate understanding of this embodiment, a test log generation method disclosed in this disclosure will first be described in detail. The execution subject of the test log generation method provided in this disclosure is generally an electronic device with a certain computing power. This electronic device includes, for example, a terminal device, a server, or other processing devices. The terminal device may include mobile phones, tablets, in-vehicle devices, and wearable devices. The server may be an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud storage, big data, and artificial intelligence platforms. Other processing devices may include devices including processors and memory, and are not limited here.

[0102] Please see Figure 1 , Figure 1 This is a flowchart illustrating a client-side test log generation method provided in an embodiment of this disclosure. Figure 1 As shown, the client test log generation method provided in this embodiment includes the following steps S101 to S103:

[0103] S101, upon detecting a target event, obtain the task stack information corresponding to the currently displayed interface; the target event includes an event in which the display interface of the electronic device is switched.

[0104] The electronic device may include any electronic device with an Android system, such as a mobile phone, tablet, or in-vehicle device with an Android system, and is not limited thereto.

[0105] The Android task stack, also known as a Task, is a stack structure, meaning the system can manage at least one Activity through the stack structure.

[0106] It is important to note that an application can correspond to at least one task stack. Activities in a task stack can come from different applications, and activities from the same application can also be in different task stacks.

[0107] For example, please see Figure 2 , Figure 2 This is a schematic diagram illustrating an interface switching method provided in an embodiment of this disclosure. Figure 2As shown, when using electronic devices, users frequently switch between display interfaces. Activities belonging to the same application can be combined and switched randomly. For example, the activities of application A on an electronic device include display interface Activity-A1 and display interface Activity-A2. When switching from Activity-A1 to Activity-A2, the Activity task stack corresponding to application A will contain both Activity-A2 and Activity-A1.

[0108] Additionally, Activities belonging to different applications can be combined and switched without rules; please refer again to [link / reference needed]. Figure 2 When an electronic device switches from the display interface Activity-A2 of application A to the current display interface Activity-B1 of application B, Activity-B1 will correspond to a task stack. The foreground Activity task stack in this task stack includes Activity-B1, and the background Activity task stack in this task stack includes Activity-A2.

[0109] S102, based on a preset log information structure, determine the target log information from the task stack information; the target log information includes the switching information of the display interface of the electronic device.

[0110] The preset log information structure can be set according to the needs of the user side and / or the development side. For example, the preset log information structure may include some information related to the switching of the display interface.

[0111] Since the task stack information contains a lot of content and is often displayed in an unstructured form, such as single-line text, this type of log information is not conducive to reading and analysis. In order to make the target log information more concise, organized and clear, when obtaining log information related to interface switching, the target log information can be determined from the task stack information based on a preset log information structure.

[0112] S103, the target log information is sent to the server so that the server can parse and display the target log information.

[0113] Since the server is responsible for data processing or information processing tasks, such as calculation, parsing, and display, it needs to send the target log information to the server for parsing after obtaining it.

[0114] In this embodiment, upon detecting a change in the display interface, the task stack information corresponding to the current display interface can be obtained promptly. Secondly, based on a preset log information structure, the target log information is determined from the task stack information, effectively simplifying the log information for easier parsing and thus improving system execution efficiency. Finally, parsing and displaying the target log information provides a clear and intuitive view of the electronic device's interface switching history, enabling accurate and efficient identification of issues related to interface switching.

[0115] The above step S101 will be described in detail below with reference to specific embodiments.

[0116] When the display interface changes, that is, when a new Activity is switched to the foreground task stack, the system will send a notification event. In order to listen for display interface switching events in a timely manner, different methods can be used to listen for display interface switching events.

[0117] In some implementations, for step S101 above, the target event can be monitored by modifying the startup file of the display interface in the system code.

[0118] For example, where the system code can be directly modified, such as for some Android devices, the target event can be listened to when the Activity switches by modifying the frameworks / base / services / core / java / com / android / server / wm / ActivityStarter.java file in the system code.

[0119] In other embodiments, for step S101 above, the target event can also be monitored by listening to whether the target keyword exists in the system log information; the system log information includes all log information in the operating environment of the electronic device.

[0120] For example, when the system code cannot be modified, log information can be obtained using the logcat tool. When a UI switch occurs, this log information will include the target keyword, which is am_set_resumed_activity. Logcat is a command-line tool in the Android system used to obtain log information during program execution.

[0121] In some implementations, for step S101 above, obtaining the task stack information corresponding to the currently displayed interface includes:

[0122] The task stack information is obtained from the system log information by calling the system application interface.

[0123] For example, if a target event is detected, system log information can be obtained through the logcat tool, and then the task stack information can be obtained from the system log information by calling the system application programming interface (system API).

[0124] Please see Figure 3 , Figure 3 A flowchart illustrating another client-side test log generation method provided in this disclosure embodiment. Figure 3 As shown, another client test log generation method provided in this embodiment includes the following steps S201 to S204:

[0125] S201, upon detecting a target event, obtain the task stack information corresponding to the currently displayed interface; the target event includes an event in which the display interface of the electronic device is switched.

[0126] This step is the same as step S101 in the previous embodiment, and will not be repeated here.

[0127] S202, based on a preset log information structure, determine the target log information corresponding to the log information structure from the task stack information; the target log information includes the switching information of the display interface of the electronic device.

[0128] This step is the same as step S102 in the previous embodiment, and will not be repeated here.

[0129] S203, the target log information is serialized to obtain serialized target log information.

[0130] The serialization is the process of converting the state information of an object (in this embodiment, the object is the target log information) into a form that can be stored or transmitted, so that the target log information can be accessed and manipulated. The serialized target log information is displayed in binary form.

[0131] For example, the target log information can be serialized using the protobuf protocol provided by Android. The serialized file generated by this protocol has the characteristics of fast parsing speed and small file size.

[0132] S204, the serialized target log information is sent to the server.

[0133] This step is similar to step S103 in the previous embodiment, and will not be described again here.

[0134] In some implementations, regarding step S202 above, when determining the target log information corresponding to the log information structure from the task stack information based on a preset log information structure, such as... Figure 4 As shown, it may include the following S2021 to S2022:

[0135] S2021, Based on the preset log information structure, determine the target class from the task stack information; the target class refers to the relevant class that manages the task stack corresponding to the display interface;

[0136] S2022, determine the target field from the target class, and determine the target log information corresponding to the log information structure based on the target field.

[0137] The target classes include: ActivityStackSupervisor, ActivityDisplay, ActivityStack, TaskRecord, and ActivityRecord.

[0138] The target fields refer to the fields related to the task stack. Since each of the above target classes involves a large number of fields, it is only necessary to determine the target fields related to the task stack from the target classes.

[0139] For example, please refer to Table 1, which shows one type of target log information. This table includes the task stack timestamp, the task stack data, and multiple target classes.

[0140] Table 1

[0141]

[0142] The timestamp of the task stack is the time information when the currently displayed interface (i.e., Activity) switches to the foreground.

[0143] Additionally, the target class ActivityDisplay has two states: focused and unfocused; the target class ActivityStack has two states: the task stack in the foreground and the task stack in the background; the target class TaskRecord has two states: the task in the foreground (FOREGROUND) and the task in the background (BACKGROUND); and the target class ActivityRecord has two states: the currently visible screen (RESUMED) and the currently invisible screen (PAUSED).

[0144] In some implementations, to improve system security and protect user privacy, after serializing the log information content to obtain serialized target log information, the serialized target log information can be encrypted to obtain encrypted target log information. This encrypted target log information is then sent to the server for parsing and display. The encryption of the serialized target log information can be performed on the user's side.

[0145] For example, the encryption algorithm may employ a symmetric key algorithm or an asymmetric key algorithm, and there is no limitation herein.

[0146] For example, symmetric key algorithms may include: Data Encryption Standard (DES), Triple Data Encryption Algorithm (TDEA), Rivest Code (RC), and BlowFish algorithm, etc., without limitation.

[0147] Asymmetric key algorithms can include: RSA encryption algorithm, ElGamal encryption algorithm, digital signature algorithm (DSA), elliptic curve digital signature algorithm (ECDSA), etc., without limitation.

[0148] Please see Figure 5 , Figure 5 This is a flowchart illustrating a server-side test log generation method provided in an embodiment of this disclosure. Figure 5 As shown, the server-side test log generation method provided in this embodiment includes the following steps S501 to S502:

[0149] S501, Receive target log information, the target log information includes switching information of the display interface of the electronic device, and the target log information is determined from the task stack information based on a preset log information structure.

[0150] In order to parse and display the target log information, the server receives the target log information.

[0151] S502, parse and display the target log information.

[0152] To analyze the target log information more intuitively and clearly, it can be displayed. For example, the display method can include any one of the following: table format, image format, or video format, without limitation.

[0153] Specifically, the parsed content may include: the time of acquiring the target log information, the state of the current display interface, and the content of the parsed target log information. The state of the current display interface includes one of the following: running state, paused state, stopped state, or destroyed state. It should be noted that in this embodiment, the process of acquiring log information and the process of parsing and displaying the log information are both used during application testing. Therefore, user privacy can be guaranteed not to be leaked.

[0154] Specifically, regarding step S502 above, in some embodiments, when the target log information is serialized target log information, since the serialized target log information is displayed in binary form, when parsing and displaying the target log information, the server can first deserialize the serialized target log information, and then parse and display the deserialized target log information.

[0155] Furthermore, in some embodiments, when the serialized target log information is serialized and encrypted, during the deserialization, parsing, and display of the deserialized target log information, since the server cannot directly process the encrypted target log information, the server can first decrypt the encrypted target log information to obtain the decrypted target log information. Then, the encrypted target log information is deserialized, and the deserialized target log information is parsed and displayed.

[0156] It should be noted that the encrypted target log information can be decrypted on the server side. It is understood that if the client-side functionality is powerful enough, the encrypted target log information can also be decrypted on the client side; this is not a limitation here.

[0157] In some implementations, when deserializing the serialized target log information, parsing and displaying the deserialized target log information, such as... Figure 6 As shown, it may include the following S601 to S602:

[0158] S601, Based on the content of the deserialized target log information, construct a log view model; the log view model is used to reflect the changes of the target log information within the target time period.

[0159] To enable a more intuitive and clear analysis of the target log information, a log view model can be constructed based on the content of the deserialized target log information.

[0160] S602, in response to the request to view the target log information, render the log view model based on the data of the log view model to display the target log information.

[0161] The technical implementation disclosed herein is based on a Browser / Server architecture, which has the capability of distributed deployment (i.e., business functions can be split into several independent subsystems) to enhance the scalability and reusability of the system. To facilitate real-time viewing of interface switching log information by both the user and development sides, a request can be initiated from any browser to access the data in the log view model and respond to the request to view the target log information. The log view model is rendered through the browser page or application of the terminal and supplemented with a timeline to display the target log information within a limited time.

[0162] For example, the task stack number, status, and creation time corresponding to the current display interface can be displayed. For instance, the creation time of task stack STACK#66 is 2021-02-15, 14:26:12.

[0163] It can also display the state of Activities in the task stack. The Activity state includes any one of the following: Running, Paused, Stopped, and Destroyed.

[0164] Running refers to the state in which an Activity has gained focus in the system, that is, the Activity is in the foreground of the task stack, that is, the Activity is located at the top of the current task stack.

[0165] Paused refers to the state in which an Activity does not have focus in the system. In this state, the Activity cannot interact directly with the user.

[0166] Stopped means that the Activity is completely covered by another Activity, but because the Activity becomes invisible, the system often forcibly terminates the Activity due to insufficient memory.

[0167] The Destroyed state refers to the state in which the Activity has been destroyed by the system. When an Activity is in a paused or stopped state, it may enter the Destroyed state at any time, for example, if the Activity is forcibly terminated due to insufficient system memory.

[0168] Specifically, it can be shown that Activity-A1 with thread number 100 in Task#26 is in the Running state, and Activity-A2 with thread number 100 in Task#26 is in the Stopped state.

[0169] It should be noted that, for users, some privacy leaks and security attacks targeting Activities may also be exposed during Activity switching. Therefore, some probe designs can be used to alert users to potential security risks.

[0170] Furthermore, for developers, this disclosure allows for the effective analysis of large amounts of logs, especially issues related to Activity task stack scheduling. For example, specific scenarios where this disclosure can be used include: when using Hook frameworks (Xposed), plugins, hotfix solutions, etc., the complexity of Activity lifecycle and scheduling increases, which can easily lead to scheduling chaos. This disclosure can efficiently reconstruct the entire Activity scheduling process and accurately trace the source of the problem.

[0171] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.

[0172] Based on the same inventive concept, this disclosure also provides a test log generation device corresponding to the test log generation method. Since the principle of the device in this disclosure is similar to the test log generation method described above, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.

[0173] Please see Figure 7 This is a schematic diagram of a client-side test log generation device provided in an embodiment of the present disclosure. The device includes: an acquisition module 710, a determination module 720, and a sending module 730; wherein,

[0174] The acquisition module 710 is used to acquire the task stack information corresponding to the currently displayed interface when a target event is detected; the target event includes an event in which the display interface of the electronic device is switched.

[0175] The determination module 720 is used to determine target log information from the task stack information based on a preset log information structure; the target log information includes the switching information of the display interface of the electronic device;

[0176] The sending module 730 is used to parse and display the target log information.

[0177] Please see Figure 8 This is a schematic diagram of another client-side test log generation device provided in this embodiment of the present disclosure. The device further includes a listening module 740, which is used for:

[0178] By modifying the startup file of the display interface, the target event can be listened for; or,

[0179] The target event is monitored by listening for the presence of the target keyword in the system log information; the system log information includes all log information under the operating environment of the electronic device.

[0180] In one optional implementation, the acquisition module 710 is specifically used for:

[0181] The task stack information is obtained from the system log information by calling the system application interface.

[0182] In one optional implementation, the determining module 720 is specifically used for:

[0183] Based on the preset log information structure, the target log information corresponding to the log information structure is determined from the task stack information;

[0184] The target log information is serialized to obtain serialized target log information;

[0185] The sending module 730 is specifically used for:

[0186] The serialized target log information is sent to the server.

[0187] In one optional implementation, the determining module 720 is specifically used for:

[0188] Based on a preset log information structure, a target class is determined from the task stack information; the target class refers to the relevant class that manages the task stack corresponding to the display interface.

[0189] The target field is determined from the target class, and the target log information corresponding to the log information structure is determined based on the target field.

[0190] In one optional implementation, the determining module 720 is further configured to:

[0191] The serialized target log information is encrypted to obtain encrypted target log information;

[0192] The sending module 730 is specifically used for:

[0193] The encrypted target log information is sent to the server.

[0194] Please see Figure 9 This is a schematic diagram of a server-side test log generation device provided in an embodiment of this disclosure. The device includes: a receiving module 910 and a display module 920; wherein,

[0195] The receiving module 910 is used to receive target log information, which includes switching information of the display interface of the electronic device, and the target log information is determined from the task stack information based on a preset log information structure.

[0196] The display module 920 is used to parse and display the target log information.

[0197] In one optional implementation, the display module 920 is specifically used for:

[0198] The serialized target log information is deserialized, and the deserialized target log information is parsed and displayed.

[0199] In one optional implementation, the display module 920 is further configured to:

[0200] The encrypted target log information is decrypted to obtain the decrypted target log information;

[0201] The decrypted target log information is deserialized, and the deserialized target log information is parsed and displayed.

[0202] In one optional implementation, the display module 920 is specifically used for:

[0203] Based on the content of the deserialized target log information, a log view model is constructed; the log view model is used to reflect the changes of the target log information within a target time period.

[0204] In response to a request to view the target log information, the log view model is rendered based on the data in the log view model to display the target log information.

[0205] The processing flow of each module in the device and the interaction flow between each module can be referred to the relevant descriptions in the above method embodiments, and will not be detailed here.

[0206] Based on the same technical concept, this disclosure also provides an electronic device. (See also...) Figure 10 The diagram shown is a structural schematic of an electronic device 800 provided in an embodiment of this disclosure, including a processor 801, a memory 802, and a bus 803. The memory 802 is used to store execution instructions and includes a main memory 8021 and an external memory 8022. The main memory 8021, also called internal memory, is used to temporarily store computational data in the processor 801, as well as data exchanged with external memory 8022 such as a hard disk. The processor 801 exchanges data with the external memory 8022 through the main memory 8021.

[0207] In this embodiment, the memory 802 is specifically used to store application code that executes the solution of this application, and its execution is controlled by the processor 801. That is, when the electronic device 800 is running, the processor 801 communicates with the memory 802 through the bus 803, so that the processor 801 executes the application code stored in the memory 802, thereby executing the method in any of the foregoing embodiments.

[0208] Processor 801 may be an integrated circuit chip with signal processing capabilities. The aforementioned processor can be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it can also be a Digital Signal Processor (DSP), an Application-Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this disclosure. The general-purpose processor can be a microprocessor or any conventional processor.

[0209] The memory 802 may be, but is not limited to, random access memory (RAM), read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), etc.

[0210] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 800. In other embodiments of this application, the electronic device 800 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0211] This disclosure also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, performs the steps of the test log generation method described in the above method embodiments. The storage medium can be a volatile or non-volatile computer-readable storage medium.

[0212] This disclosure also provides a computer program product carrying program code. The program code includes instructions that can be used to execute the steps of the test log generation method described in the above method embodiments. For details, please refer to the above method embodiments, which will not be repeated here.

[0213] The aforementioned computer program product can be implemented through hardware, software, or a combination thereof. In one optional embodiment, the computer program product is specifically embodied in a computer storage medium; in another optional embodiment, the computer program product is specifically embodied in a software product, such as a software development kit (SDK), etc.

[0214] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems and terminals described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here. In the several embodiments provided in this disclosure, it should be understood that the disclosed systems, terminals, and methods can be implemented in other ways. The terminal embodiments described above are merely illustrative. For example, the division of units is only a logical functional division; in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Another point is that the displayed or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces, or indirect coupling or communication connection between units, and may be electrical, mechanical, or other forms.

[0215] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0216] In addition, the functional units in the various embodiments of this disclosure can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0217] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this disclosure, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause an electronic device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this disclosure. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0218] Finally, it should be noted that the above-described embodiments are merely specific implementations of this disclosure, used to illustrate the technical solutions of this disclosure, and not to limit it. The protection scope of this disclosure is not limited thereto. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this disclosure. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be covered within the protection scope of this disclosure. Therefore, the protection scope of this disclosure should be determined by the protection scope of the claims.

Claims

1. A method for generating test logs, characterized in that, include: Upon detecting a target event, obtain the task stack information corresponding to the currently displayed interface; The target event includes an event in which the display interface of the electronic device is switched. The switching of the display interface of the electronic device includes switching between the display interfaces of different applications and switching between different display interfaces of the same application. The task stack manages the display interface of the electronic device in a stack structure. Based on the preset log information structure, the target log information is determined from the task stack information; The target log information includes the switching information of the display interface of the electronic device; The target log information is sent to the server so that the server can parse and display the target log information. The step of determining target log information from the task stack information based on a preset log information structure includes: determining a target class from the task stack information based on the preset log information structure; the target class refers to the relevant class that manages the task stack corresponding to the display interface; determining a target field from the target class, and determining the target log information corresponding to the log information structure based on the target field.

2. The method according to claim 1, characterized in that, Listen for the target event in the following way: By modifying the startup file of the display interface, the target event can be listened for; or, The target event is monitored by listening for the presence of the target keyword in the system log information; the system log information includes all log information under the operating environment of the electronic device.

3. The method according to claim 1 or 2, characterized in that, The step of obtaining the task stack information corresponding to the currently displayed interface includes: The task stack information is obtained from the system log information by calling the system application interface.

4. The method according to claim 1, characterized in that, The determination of target log information from the task stack information based on the preset log information structure includes: Based on the preset log information structure, the target log information corresponding to the log information structure is determined from the task stack information; The target log information is serialized to obtain serialized target log information; Sending the target log information to the server includes: The serialized target log information is sent to the server.

5. The method according to claim 4, characterized in that, After serializing the log information content to obtain the serialized target log information, the method further includes: The serialized target log information is encrypted to obtain encrypted target log information; Sending the target log information to the server includes: The encrypted target log information is sent to the server.

6. A method for generating test logs, characterized in that, include: Receive target log information, the target log information includes switching information of the display interface of the electronic device, and the target log information is determined from the task stack information corresponding to the current display interface based on a preset log information structure. The task stack manages the display interface of the electronic device in a stack structure. The task stack information is obtained when a target event is detected. The target event includes an event in which the display interface of the electronic device is switched. The switching of the display interface of the electronic device includes switching of the display interface of different applications and switching of different display interfaces of the same application. The target log information is parsed and displayed; The target log information is obtained in the following way: based on a preset log information structure, a target class is determined from the task stack information, a target field is determined from the target class, and the target log information corresponding to the log information structure is determined according to the target field. The target class refers to the relevant class that manages the task stack corresponding to the display interface.

7. The method according to claim 6, characterized in that, The target log information is serialized target log information, and the parsing and displaying of the target log information includes: The serialized target log information is deserialized, and the deserialized target log information is parsed and displayed.

8. The method according to claim 7, characterized in that, The serialized target log information is serialized and encrypted target log information; the deserialization of the target log information, and the parsing and display of the deserialized target log information, includes: The encrypted target log information is decrypted to obtain the decrypted target log information; The decrypted target log information is deserialized, and the deserialized target log information is parsed and displayed.

9. The method according to claim 7 or 8, characterized in that, The step of parsing and displaying the deserialized target log information includes: Based on the content of the deserialized target log information, a log view model is constructed; the log view model is used to reflect the changes of the target log information within a target time period. In response to a request to view the target log information, the log view model is rendered based on the data in the log view model to display the target log information.

10. A test log generation device, characterized in that, include: The acquisition module is used to obtain the task stack information corresponding to the currently displayed interface when a target event is detected. The target event includes an event in which the display interface of the electronic device is switched. The switching of the display interface of the electronic device includes switching between the display interfaces of different applications and switching between different display interfaces of the same application. The task stack manages the display interface of the electronic device in a stack structure. The determination module is used to determine the target log information from the task stack information based on a preset log information structure; The target log information includes the switching information of the display interface of the electronic device; The sending module is used to send the target log information to the server so that the server can parse and display the target log information; Specifically, the determining module is used to determine the target class from the task stack information based on a preset log information structure; the target class refers to the relevant class that manages the task stack corresponding to the display interface. The target field is determined from the target class, and the target log information corresponding to the log information structure is determined based on the target field.

11. A test log generation device, characterized in that, include: A receiving module is used to receive target log information, which includes switching information of the display interface of an electronic device. The target log information is determined from the task stack information corresponding to the current display interface based on a preset log information structure. The task stack manages the display interface of the electronic device in a stack structure. The task stack information is obtained when a target event is detected. The target event includes an event in which the display interface of the electronic device is switched. The switching of the display interface of the electronic device includes switching of the display interfaces of different applications and switching of different display interfaces of the same application. The display module is used to parse and display the target log information; The target log information is obtained in the following way: based on a preset log information structure, a target class is determined from the task stack information, a target field is determined from the target class, and the target log information corresponding to the log information structure is determined according to the target field. The target class refers to the relevant class that manages the task stack corresponding to the display interface.

12. An electronic device, characterized in that, include: The device includes a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the test log generation method as described in any one of claims 1 to 9 are performed.

13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the test log generation method as described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Access control method and system of mobile terminal application program

    CN102842007A

  • User interface inference method when Android application is running

    CN106951777A

  • Task switching method and device, terminal equipment and storage medium

    CN108076223A

  • Data acquisition method and device, terminal equipment and storage medium

    CN112953753A