Log data output method and device, electronic equipment and storage medium

By differentiating between strongly correlated and weakly correlated thread groups and adopting differentiated log management strategies, the problem of insufficient log data output from smart terminals was solved, enabling timely collection of key log data and rapid analysis of problems, thereby improving system responsiveness and saving power.

CN115629871BActive Publication Date: 2026-03-17GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-26
Publication Date
2026-03-17

AI Technical Summary

Technical Problem

In existing technologies, the logging function of smart terminals is controlled based on a global dimension, which may result in the restriction of output of critical system log data, making it impossible to analyze and diagnose user operation-related problems in a timely manner.

Method used

In response to user interaction, the system distinguishes between strongly related and weakly related thread groups and adopts different control strategies to output log data. The log data of strongly related thread groups is subject to lower restrictions than that of weakly related thread groups, ensuring the collection and analysis of critical log data.

Benefits of technology

It enables timely location and resolution of problems when user operations encounter issues, while reducing performance and power consumption problems caused by excessive log data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115629871B_ABST
    Figure CN115629871B_ABST
Patent Text Reader

Abstract

The application discloses a log data output method and device, electronic equipment and storage medium, and relates to the technical field of computers. The method comprises the following steps: in response to a first user interaction operation, acquiring a thread associated with the first user interaction operation as a thread in a first thread group; based on a first control strategy corresponding to the first thread group, outputting log data of the threads in the first thread group in a running process, and the restriction degree of outputting log data under the first control strategy is lower than the restriction degree of outputting log data under a second control strategy corresponding to a second thread group, and the second thread group comprises other threads in a running process except the threads in the first thread group. In this way, the collection of required key log data is solved, and the problems of poor performance and power consumption caused by too much output log data are also solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, electronic device, and storage medium for outputting log data. Background Technology

[0002] Smartphones, tablets, smartwatches, smart bracelets, and other smart devices are playing an increasingly important role in people's lives and work. To meet the diverse needs of different user groups, the applications running on these devices and the functions they can perform are becoming increasingly rich. However, with the enrichment of functions and the increase in the frequency of use, smart devices inevitably encounter various problems. Therefore, smart devices provide logging functions to provide a basis for problem analysis, diagnosis, and system improvement.

[0003] In related technologies, the logging function of smart terminals is generally based on a global perspective. It uses log management strategies to control and restrict the output of all system logs in the terminal. This may result in some critical system log data being restricted, which in turn leads to the inability to analyze, diagnose and improve problems in related applications in a timely manner due to the lack of key logs. Summary of the Invention

[0004] This application proposes a method, apparatus, electronic device, and storage medium for outputting log data to avoid restricting the output of log data related to user operations.

[0005] In a first aspect, embodiments of this application provide a method for outputting log data. The method includes: responding to a first user interaction operation, acquiring a thread associated with the first user interaction operation as a thread in a first thread group; and outputting log data of the thread in the first thread group during its operation based on a first control policy corresponding to the first thread group, wherein the restriction on outputting log data under the first control policy is lower than the restriction on outputting log data under a second control policy corresponding to a second thread group, and the second thread group includes other threads in a running process besides the threads in the first thread group.

[0006] Secondly, embodiments of this application provide a log data output device, the device comprising: a thread acquisition module and a log output module. The thread acquisition module is configured to, in response to a first user interaction operation, acquire the thread associated with the first user interaction operation as a thread in a first thread group; the log output module is configured to, based on a first control policy corresponding to the first thread group, output log data of the threads in the first thread group during their execution, wherein the restriction on outputting log data under the first control policy is lower than the restriction on outputting log data under a second control policy corresponding to a second thread group, and the second thread group includes other threads in a running process besides the threads in the first thread group.

[0007] Thirdly, embodiments of this application provide an electronic device, including: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to perform the methods described above.

[0008] Fourthly, embodiments of this application provide a computer-readable storage medium storing program code that can be invoked by a processor to execute the methods described above.

[0009] In the solution provided in this application, in response to a first user interaction operation, the thread associated with the first user interaction operation is acquired as a thread in a first thread group. Based on a first control policy corresponding to the first thread group, log data of the threads in the first thread group during their execution is output. The restriction on outputting log data under the first control policy is lower than the restriction on outputting log data under a second control policy corresponding to a second thread group. The second thread group includes other threads in the running process besides those in the first thread group. This allows for as much comprehensive log data as possible for threads related to the user's current operation, enabling timely location, analysis, and resolution of problems based on the acquired log data when issues arise during user operation. For log data from other threads, only a portion of the key log data can be selectively output. Therefore, this solution not only solves the problem of collecting the required key log data but also effectively addresses issues such as performance and power consumption degradation caused by excessive log data output. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 A flowchart illustrating a log data output method provided in an embodiment of this application is shown.

[0012] Figure 2 A flowchart illustrating a log data output method provided in another embodiment of this application is shown.

[0013] Figure 3 A flowchart illustrating a method for outputting log data according to another embodiment of this application is shown.

[0014] Figure 4 It shows Figure 3 A flowchart illustrating a sub-step of step S350 in one embodiment.

[0015] Figure 5 This is a block diagram of a log data output device according to an embodiment of this application.

[0016] Figure 6 This is a block diagram of an electronic device for performing a log data output method according to an embodiment of this application.

[0017] Figure 7 This is a storage unit in this application embodiment for storing or carrying program code that implements the log data output method according to this application embodiment. Detailed Implementation

[0018] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. In some processes described in the specification, claims, and accompanying drawings of this application, multiple operations appearing in a specific order are included. These operations may not be executed in the order they appear herein, or they may be executed in parallel. Operation numbers such as S110, S120, etc., are merely used to distinguish different operations and do not represent any execution order. Furthermore, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. Moreover, the following embodiments are only some embodiments of this application, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0019] In related technologies, the logging function of smart terminals is generally based on a global perspective. It uses log management strategies to control and restrict the output of all system logs in the terminal. This may restrict logs related to user operations, resulting in the loss of logs related to user operations. Consequently, when problems occur when users operate the terminal, it is impossible to analyze, diagnose, and improve the relevant programs in a timely manner.

[0020] The inventors propose a method, apparatus, electronic device, and storage medium for outputting log data. In response to a first user interaction operation, the method acquires the thread associated with the first user interaction operation as a thread in a first thread group. Based on a first control policy with lower restrictions corresponding to the first thread group, the method outputs the log data of the thread currently running in the first thread group. The log data output method provided in the embodiments of this application is described in detail below.

[0021] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a method for outputting log data according to an embodiment of this application. The following will be combined with... Figure 1 The log data output method provided in the embodiments of this application is described in detail. This log data output method may include the following steps:

[0022] Step S110: In response to the first user interaction operation, obtain the thread associated with the first user interaction operation and use it as a thread in the first thread group.

[0023] In this embodiment, the first user interaction operation includes, but is not limited to: swiping operation, clicking operation, long press operation, voice input operation, gesture input operation, etc. Any operation performed by the user that can interact with the electronic device can be regarded as the above-mentioned first user interaction operation, which will not be described in detail here.

[0024] The area responding to the aforementioned sliding operation can be a control, or a designated area on the screen or its edge. The sliding direction can be from left to right, right to left, top to bottom, bottom to top, 45 degrees, or 30 degrees, etc. A control can refer to a component that provides or implements user interface functionality. A component encapsulates data and methods and can have its own attributes and methods. In practical applications, the control can be displayed at the bottom edge, top edge, left edge, or right edge of the interface. Of course, the control can also be displayed at any location, such as the middle area of ​​the interface. This embodiment does not limit the specific location of the control on the interface. A click operation can be a single click or a double click, etc. The area responding to a single click operation can be a control, a designated area on the screen or its edge, or a physical button. A long press operation can refer to an operation on the screen for a duration exceeding a preset duration, such as 2 seconds. The area responding to a long press operation can be a control, a designated area on the screen or its edge, or a physical button. This embodiment does not limit this. Voice input can be a user speaking a pre-set wake-up voice for the device or a voice command to control an application on the electronic device. Gesture input can be a user making a preset gesture within a target distance from the screen of the electronic device, i.e., air input of preset gestures, such as screen unlock gestures or control gestures for a specific application.

[0025] In other words, when a user inputs a first user interaction operation onto an electronic device, the electronic device responds to this operation and retrieves the thread associated with the first user interaction operation as a thread in the first thread group. The thread associated with the first user interaction operation can include foreground threads and background threads; the first thread group can be understood as a collection of threads strongly related to the user. That is, if a thread in the first thread group has a runtime problem, it will affect the user's current experience using the electronic device.

[0026] For example, taking the swipe-to-refresh-screen operation of an electronic device as the first user interaction operation, the process of refreshing the screen content in response to this operation mainly involves the foreground application, the background rendering service, and the background system service. Therefore, the threads corresponding to the foreground application, the rendering threads corresponding to the background rendering service, and the system threads of the background system service can be obtained as threads in the first thread group.

[0027] In some implementations, the running threads associated with a specified application in the background applications, as well as the running threads of the application associated with the first user interaction operation, are obtained and used as threads in the first thread group. The specified application may be pre-set, such as a recording application, a music application, a screen recording application, and a video application.

[0028] For example, if the background applications of the current electronic device include a music application playing music in the background, and the user refreshes the chat dialog box of a chat application on the display screen of the electronic device, then the application associated with the refresh operation is the chat application, and thus the running thread of the chat application is obtained as a thread in the first thread group. At the same time, since the electronic device is playing music in the background, if the music playback malfunctions, it will affect the user's listening experience. Alternatively, the user may switch the music playing in the background, and if the switching has problems, it will also affect the user's application experience. Therefore, the running thread associated with the music application can also be obtained as a thread in the first thread group.

[0029] Optionally, before obtaining the running thread associated with the specified application in the background application as a thread in the first thread group, it can be detected whether the specified application is in a specified running state. If the specified application is in the specified running state, then the running thread associated with the specified application is obtained as a thread in the first thread group. Optionally, the specified running state of a recording application can be a recording state; the specified running state of a music application can be a music playback state; the specified running state of a video application can be a video playback state; and the specified running state of a screen recording application can be a screen recording state.

[0030] Step S120: Based on the first control policy corresponding to the first thread group, output the log data of the thread in the first thread group during its operation. The restriction level of the log data output under the first control policy is lower than the restriction level of the log data output under the second control policy corresponding to the second thread group. The second thread group includes other threads that are running, excluding the threads in the first thread group.

[0031] Furthermore, after obtaining the first thread group that is strongly relevant to the user, the remaining threads from the currently running threads (excluding those in the first thread group) are obtained and designated as the threads in the second thread group. The second thread group can be understood as a collection of threads that are weakly relevant to the user; that is, even if a thread in the second thread group has a runtime problem, it will have little impact on the user's current electronic device experience. For example, if a user switches a shopping app running in the foreground to the background and a chat app running in the background to the foreground, even if the threads of the shopping app that were switched to the background experience a runtime problem, causing the shopping app to shut down and run in the background, the impact on the chat app currently being used by the user will be minimal.

[0032] Therefore, by acquiring as much and comprehensive log data as possible from the threads in the first thread group that are strongly relevant to the user during their execution, problems can be promptly identified, analyzed, and addressed based on the acquired log data when issues arise in these threads. For the second thread group, which is less relevant to the user, only the more important threads in this group's log data need to be acquired. This solves the problem of outputting critical logs while also effectively mitigating performance and power consumption degradation caused by excessive log data output from electronic devices.

[0033] Based on this, different logging control strategies can be used to control the output of log data during thread execution in the first and second thread groups. Specifically, a pre-set control strategy for the first thread group can be obtained as the first control strategy, and a pre-set control strategy for the second thread group can be obtained as the second control strategy. Further, based on the first control strategy corresponding to the first thread group, the log data of the threads in the current first thread group during execution is output, and based on the second control strategy corresponding to the second thread group, the log data of the threads in the current second thread group during execution is output. The first control strategy imposes less restriction on the output log data than the second control strategy. A lower level of restriction results in more and more comprehensive output log data; in other words, less un-output log data is filtered out. That is, a less restrictive logging control strategy can output as much log data generated by the threads as possible.

[0034] Optionally, the first control policy can be pre-set for the first thread group, and the second control policy can be pre-set for the second thread group. The second control policy can be a log control policy that controls and restricts the output of all system logs in related technologies. The first control policy can be the second control policy with reduced restriction level, or it can be a log control policy with a lower restriction level than the second control policy. This embodiment does not limit this.

[0035] In this embodiment, in response to a first user interaction operation, the thread associated with the first user interaction operation is acquired as a thread in a first thread group, and other currently running threads besides those in the first thread group are acquired as threads in a second thread group. For threads in the second thread group, a second control strategy is used to output log data, while for threads in the first thread group, a first control strategy with a lower level of restriction is used to output log data. This allows for the collection of as much comprehensive log data as possible for threads strongly related to the user's current operation, enabling timely problem location, analysis, and resolution based on the acquired log data when issues arise during user operation. For log data from threads less related to the user's current operation, only a portion of the key log data can be selectively output. Therefore, this approach not only solves the problem of collecting the required key log data but also effectively addresses the performance and power consumption degradation caused by excessive log data output.

[0036] Please refer to Figure 2 , Figure 2 This is a flowchart illustrating a method for outputting log data according to another embodiment of this application. The following will be combined with... Figure 2 The log data output method provided in the embodiments of this application is described in detail. This log data output method may include the following steps:

[0037] Step S210: In response to the first user interaction operation, obtain the thread associated with the first user interaction operation and use it as a thread in the first thread group.

[0038] In this embodiment, the specific implementation of step S210 can be found in the content of the foregoing embodiments, and will not be repeated here.

[0039] Step S220: Based on the first restriction rule in the first control strategy and the first restriction parameter corresponding to the first restriction rule, output the log data of the thread in the first thread group during the running process.

[0040] Step S230: Based on the first restriction rule in the second control strategy and the second restriction parameter corresponding to the first restriction rule, output the log data of the thread in the current second thread group during the running process. The restriction degree of the first restriction parameter is lower than that of the second restriction parameter.

[0041] In this embodiment, the first control strategy may include a first restriction rule and a first restriction parameter corresponding to the first restriction rule. The first restriction rule may include one or a combination of several rules, such as restricting repetitive log data, restricting log data of different application types, restricting the number of log data outputs per unit time, and restricting log data output based on log level. When the first restriction rule contains only one rule, the first restriction parameter and the second restriction parameter also contain only the restriction parameter corresponding to that rule. If the first restriction rule contains a combination of the aforementioned rules, the first restriction parameter and the second restriction parameter contain the restriction parameter corresponding to each of the aforementioned rules. The application type includes system application types and third-party application types. The electronic device does not restrict the output of log data for threads of system application types, but restricts the output of log data for threads of third-party application types, i.e., it does not output log data for threads of third-party application types. Of course, it may also output only the log data of some threads of third-party application types that are associated with system threads; this embodiment does not impose such restrictions. It is understood that each restriction rule has its corresponding restriction parameter. When using the same restriction rule, different restriction parameters will result in different degrees of restriction.

[0042] Based on this, for threads in the second thread group, log data can be output based on the first restriction rule and the corresponding second restriction parameter. For threads in the first thread group that are strongly related to user operations, log data can be output based on the first restriction rule and the corresponding first restriction parameter. The restriction level of the first restriction parameter is lower than that of the second restriction parameter. It can be understood that the second and first restriction parameters can be pre-set according to actual application requirements, i.e., the first restriction parameter is set to a level lower than that of the second restriction parameter. Alternatively, the second restriction parameter can be a restriction parameter in a log management strategy that controls and restricts the output of all system logs in related technologies. Based on this, the first restriction parameter can be a modified version of the second restriction parameter, i.e., the modified restriction parameter has a lower restriction level than the original second restriction parameter.

[0043] In some implementations, the first restriction rule may include a rule for restricting repetitive log data, and the first restriction parameter corresponding to the first restriction rule may include a first repetition parameter value. Based on this, log data of the threads in the first thread group during operation can be output based on the first restriction rule and the first repetition parameter value, wherein the number of repetitive log data in the output log data of the threads in the first thread group is less than the first repetition parameter value. Repetitive log data can be understood as identical or similar log data, and the number of repetitive log data can be the number of identical or similar log data output within a specified time period, which can be preset, for example, 1 millisecond. That is, during the output of log data of the threads in the first thread group during operation, if the number of repetitive log data output within the specified time period reaches the first repetition parameter value, the output of identical repetitive log data is restricted, ensuring that the number of repetitive log data output by the threads in the first thread group during operation is less than the first repetition parameter value. This avoids problems such as excessive output of repetitive log data, which could consume the CPU and storage space of the electronic device, thereby affecting the normal operation of other functions of the electronic device.

[0044] In this approach, the second restriction parameter corresponding to the first restriction rule may include a second repetition parameter value. Based on the first restriction rule and the second repetition parameter value, the log data of the threads in the current second thread group during operation is output. The number of repetitive log data in the output log data of the threads in the second thread group is less than the second repetition parameter value, and the second repetition parameter value is less than the first repetition parameter value. Therefore, the electronic device's restriction on the number of repetitive log data output for threads in the second thread group is greater than the restriction on the number of repetitive log data output for threads in the first thread group. In practical applications, if a thread has a serious operational problem, the same or similar log data will be repeatedly output to indicate the severity of the problem, allowing for timely location, analysis, and resolution of the serious operational problem based on the repetitive log data. Since the thread in the second thread group has a minor operational issue that doesn't significantly impact the user's current electronic device experience, a larger second repetition parameter value can be used to limit the output of duplicate log data. Only a portion of the duplicate log data, such as one or two entries, will be output. Even without quickly locating, analyzing, and resolving the problematic thread in the second thread group, the impact on the user's current operation will be minimal. In other words, for the first thread group, which is strongly correlated with the user's current operation, all duplicate log data generated should be retained as much as possible. This allows for timely assessment of the severity of the operational issue based on the amount of duplicate log data, facilitating timely analysis and resolution. Simultaneously, for the second thread group, which is less correlated with the user's current operation, the output of its duplicate log data should be limited. This approach achieves the output of necessary critical log data while effectively mitigating the performance and power consumption degradation caused by excessive duplicate log data.

[0045] In other embodiments, the first limiting rule may include limiting the amount of log data output per unit time. The first limiting parameter corresponding to the first limiting rule may include a first log output threshold. Based on the first limiting rule and the first log output threshold, log data of the threads in the current first thread group during operation is output. The number of log data entries output within a preset time period for the threads in the first thread group is less than or equal to the first log output threshold. The first log output threshold can be a pre-set value. Since the first thread group is strongly correlated with user operations, this value can be set relatively large, for example, 1000 or 5000 entries, to output as much and comprehensive a range of log data generated by the threads in the first thread group during operation. This facilitates timely problem location, analysis, and resolution using log data when user operation issues arise.

[0046] In this approach, the second limiting parameter includes a second log output threshold. Based on the first limiting rule and the second log output threshold, log data of the threads in the current second thread group during operation is output. The number of log entries for the threads in the second thread group output within the preset time period is less than or equal to the second log output threshold, and the second log output threshold is less than the first log output threshold. The second log output threshold can also be a pre-set value. Since the second thread group is weakly correlated with user operations, this value can be set relatively small, for example, 10 or 30 entries, to reduce the output of log data irrelevant to resolving issues arising from current user operations, thereby saving CPU utilization and storage space usage of the electronic device.

[0047] In some embodiments, the first restriction rule may include restricting the output of log data based on log levels, such as debug level, warning level, and error level. The first restriction parameter corresponding to the first restriction rule may include at least one log level, and the second restriction parameter corresponding to the first restriction rule may include multiple log levels. Based on this, log data of the threads in the first thread group during operation is output based on the log levels included in the first restriction rule and the first restriction parameter; log data of the threads in the second thread group during operation is output based on the log levels included in the first restriction rule and the second restriction parameter. The number of log levels included in the second restriction parameter is greater than the number of log levels included in the first restriction parameter. That is, for threads in the first thread group that are strongly related to user operations, log data of different log levels is output as comprehensively and extensively as possible, thereby enabling more comprehensive and accurate technical identification and resolution of problems in user operations. Meanwhile, for threads in the second thread group that are less related to user operations, only log data of the more important log levels is obtained, i.e., key log data is retained, and unnecessary log data output is reduced, thereby ensuring the processing speed and storage space of the electronic device.

[0048] In some implementations, the first control strategy includes a second restriction rule and a second restriction parameter corresponding to the second restriction rule, and the second control strategy includes a third restriction rule and a third restriction parameter corresponding to the third restriction rule. Based on this, log data of the threads in the first thread group during operation can be output based on the second restriction rule and the second restriction parameter; log data of the threads in the second thread group during operation can be output based on the third restriction rule and the third restriction parameter. The third restriction rule includes the second restriction rule and other restriction rules, and includes the second restriction parameter and other restriction parameters corresponding to the other restriction rules. That is, in this approach, although both the first and second control strategies contain second restriction rules with the same degree of restriction, only the second restriction rule and the second restriction parameter are used to control the log data output for the first thread group, which is strongly related to user operations, while more restriction rules are used to control the log data output for the second thread group, which is less related to user operations. This is equivalent to using a control strategy with a higher degree of restriction for the log output of the second thread group. The specific other restriction rules used to further restrict the log data output of the second thread group can be pre-set according to actual needs and will not be elaborated here. In this way, more targeted and comprehensive log data of threads that are strongly related to the user's current operation can be output.

[0049] Therefore, the same restriction rules can be used for the output of log data of the first thread group and the second thread group, but the corresponding restriction parameters are different. That is, the restriction degree of the restriction parameters used for the first thread group is lower than that of the restriction parameters used for the second thread group. Of course, different restriction rules and different restriction parameters can also be used. In this case, the restriction degree brought about by the restriction rules and restriction parameters used for the first thread group also needs to be lower than that brought about by the restriction rules and restriction parameters used for the second thread group.

[0050] In this embodiment, log management strategies with varying degrees of restriction are used to control and restrict the output of log data for the first thread group, which is strongly correlated with user operations, and the second thread group, which is weakly correlated with user operations. This effectively balances the amount of log data output with the possibility of missing critical logs, saving power, improving the system responsiveness of electronic devices, and ensuring efficient problem-solving when issues arise.

[0051] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating a method for outputting log data according to another embodiment of this application. The following will be combined with... Figure 3The log data output method provided in the embodiments of this application is described in detail. This log data output method may include the following steps:

[0052] Step S310: In response to the first user interaction operation, obtain the thread associated with the first user interaction operation and use it as a thread in the first thread group.

[0053] Step S320: Based on the first control policy corresponding to the first thread group, output the log data of the thread in the first thread group during its operation. The restriction level of outputting log data under the first control policy is lower than the restriction level of outputting log data under the second control policy corresponding to the second thread group. The second thread group includes other threads in the running process besides the threads in the first thread group.

[0054] In this embodiment, the specific implementation of steps S310 to S320 can be found in the content of the foregoing embodiments, and will not be repeated here.

[0055] Step S330: In response to the second user interaction operation, obtain the thread associated with the second user interaction operation as the target thread.

[0056] In this embodiment, the second user interaction operation can be triggered by changes in the user's actions. The electronic device can respond to these changes, i.e., respond to the second user interaction operation, and acquire the thread associated with the second user interaction operation as the target thread. The second user interaction operation is similar to the aforementioned first user interaction operation and will not be described in detail here. For example, the second user interaction operation could be a user-inputted application switching swipe operation, or a stop music playback click operation, etc. This embodiment does not impose any limitations on these aspects.

[0057] Step S340: Based on the target thread, update the threads contained in the first thread group to obtain the updated first thread group.

[0058] Based on this, the target thread can be added to the first thread group, and / or the thread corresponding to the application whose second user interaction operation has ended can be removed from the first thread group. For example, if a user switches a chat application running in the foreground to running in the background, and simultaneously switches a music application running in the background to running in the foreground, the relevant thread of the chat application that has ended its foreground operation can be removed from the first thread group; at the same time, the target thread related to the music application can be added to the first thread group, resulting in an updated first thread group.

[0059] In other words, when a user's actions change, the electronic device can automatically update the threads in the first thread group that are strongly related to the user's actions, and at the same time, update the threads in the second thread group that are weakly related to the user's actions.

[0060] Step S350: Based on the first control policy, output the updated log data of the first thread group during its operation.

[0061] In some implementations, a pre-set first control policy for the first thread group can be used to output the updated log data of the first thread group during its operation. This achieves real-time updating of the log data of the first thread group during its operation.

[0062] In some implementations, please refer to Figure 4 Step S350 may include the contents of steps S351 to S352:

[0063] Step S351: If the target thread is a preset thread, update the first control strategy based on the target control strategy corresponding to the preset thread, wherein the restriction level of the output log data under the target control strategy is lower than the restriction level of the output log data under the first control strategy.

[0064] In this embodiment, different preset log management policies can be pre-set for different types of preset threads. Based on this, after determining the target thread, if the target thread is a preset thread, the preset log management policy corresponding to the preset thread is obtained and used as the aforementioned target management policy. The first management policy is then updated based on the target management policy. The information contained in the target management policy can be found in the content of the previous embodiments and will not be repeated here.

[0065] Step S352: Based on the updated first control policy, output the log data of the updated first thread group during its operation.

[0066] Furthermore, after updating the first control policy, the log data of the first thread group during its operation can be output based on the updated first control policy. In this way, the threads in the first thread group are updated in real time according to changes in user operations. At the same time, the first control policy that is more suitable for the updated first thread group is updated accordingly based on the thread updates. Thus, the log data in the first thread group can be output with a more suitable degree of restriction for the updated first thread group.

[0067] In this embodiment, if the user's operation changes, the electronic device can update the threads in the first thread group in real time, and simultaneously update the first control policy used to manage the log data output of the updated first thread group. This ensures that log data is output only for threads strongly related to the user's current operation at any given time, solving both the problem of collecting critical log data and effectively mitigating performance and power consumption degradation caused by excessive log data output.

[0068] Please refer to Figure 5 The diagram illustrates a structural block diagram of a log data output device 400 according to an embodiment of this application. The device 400 may include a thread acquisition module 410 and a log output module 420.

[0069] The thread acquisition module 410 is used to acquire the thread associated with the first user interaction operation in response to the first user interaction operation, and to include it as a thread in the first thread group.

[0070] The log output module 420 is used to output log data of the threads in the first thread group during their operation based on the first control policy corresponding to the first thread group. The restriction on the output of log data under the first control policy is lower than the restriction on the output of log data under the second control policy corresponding to the second thread group. The second thread group includes other threads that are running, excluding the threads in the first thread group.

[0071] In some implementations, the first control strategy includes a first restriction rule and a first restriction parameter corresponding to the first restriction rule. The log output module 420 can be specifically used to output log data of the threads in the current first thread group during their operation based on the first restriction rule and the first restriction parameter.

[0072] In this manner, the second control strategy includes the first restriction rule and the second restriction parameter corresponding to the first restriction rule. The log output module 420 can also be specifically used to output the log data of the thread in the current second thread group during the running process based on the first restriction rule and the second restriction parameter after the thread associated with the first user interaction operation is obtained as a thread in the first thread group in response to the first user interaction operation. The restriction degree of the first restriction parameter is lower than that of the second restriction parameter.

[0073] In some implementations, the first restriction parameter includes a first repetition parameter value. The log output module 420 can be specifically used to output the log data of the threads in the first thread group during their operation based on the first restriction rule and the first repetition parameter value, wherein the number of repetition log data in the output log data of the threads in the first thread group is less than the first repetition parameter value.

[0074] In this mode, the second restriction parameter includes the second repetition parameter value. The log output module 420 can also be specifically used to output the log data of the thread in the current second thread group during the running process based on the first restriction rule and the second repetition parameter value. The number of repetition log data in the output log data of the thread in the second thread group is less than the second repetition parameter value, and the second repetition parameter value is less than the first repetition parameter value.

[0075] In other embodiments, the first limiting parameter includes a first log output threshold. The log output module 420 can be specifically used to output log data of the threads in the first thread group during their operation based on the first limiting rule and the first log output threshold. The number of log data of the threads in the first thread group output within a preset time period is less than or equal to the first log output threshold.

[0076] In this mode, the second limiting parameter includes a second log output threshold. The log output module 420 can also be specifically used to output the log data of the thread in the current second thread group during its operation based on the first limiting rule and the second log output threshold. The number of log data of the thread in the second thread group output within the preset time period is less than or equal to the second log output threshold, and the second log output threshold is less than the first log output threshold.

[0077] In some implementations, the thread acquisition module 410 may be specifically used to acquire running threads associated with a specified application in the background application, as well as running threads of the application associated with the first user interaction operation, as threads in the first thread group.

[0078] In some embodiments, the log data output device 400 may further include an update module. Specifically, the thread acquisition module 410 may, after outputting the log data of the threads in the first thread group during operation based on the first control policy corresponding to the first thread group, respond to a second user interaction operation and acquire the thread associated with the second user interaction operation as the target thread. The update module may be used to update the threads included in the first thread group based on the target thread to obtain an updated first thread group. The log output module 420 may be used to output the log data of the updated first thread group during operation based on the first control policy.

[0079] In this approach, the log output module 420 may include a policy update unit and a log output unit. The policy update unit can be used to update the first control policy based on the target control policy corresponding to the preset thread if the target thread is a preset thread, wherein the restriction level of the output log data under the target control policy is lower than the restriction level of the output log data under the first control policy. The log output unit can be used to output the updated log data of the first thread group during its operation based on the updated first control policy.

[0080] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0081] In the several embodiments provided in this application, the coupling between modules can be electrical, mechanical, or other forms of coupling.

[0082] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0083] In summary, in response to the first user interaction operation, the thread associated with the first user interaction operation is acquired as a thread in the first thread group, and other currently running threads besides those in the first thread group are acquired as threads in the second thread group. For threads in the second thread group, a second control strategy is used to output log data, while for threads in the first thread group, a first control strategy with a lower level of restriction is used to output log data. This allows for the collection of as much comprehensive log data as possible for threads strongly related to the user's current operation, enabling timely problem location, analysis, and resolution based on the acquired log data when issues arise during user operation. For log data from threads less related to the user's current operation, only a portion of the key log data can be selectively output. Therefore, this approach not only solves the problem of collecting the required key log data but also effectively addresses the performance and power consumption degradation caused by excessive log data output.

[0084] The following will combine Figure 6 This application describes an electronic device.

[0085] Reference Figure 6 , Figure 6 The diagram shows a structural block diagram of an electronic device 500 provided in an embodiment of this application. The above-described method provided in this embodiment of the application can be executed by the electronic device 500.

[0086] The electronic device 500 in this application embodiment may include one or more of the following components: processor 501, memory 502, and one or more application programs, wherein the one or more application programs may be stored in memory 502 and configured to be executed by one or more processors 501, and the one or more programs are configured to perform the methods as described in the foregoing method embodiments.

[0087] Processor 501 may include one or more processing cores. Processor 501 connects to various parts within the electronic device 500 using various interfaces and lines, and performs various functions and processes data of the electronic device 500 by running or executing instructions, programs, code sets, or instruction sets stored in memory 502, and by calling data stored in memory 502. Optionally, processor 501 may be implemented using at least one hardware form of Digital Signal Processing (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). Processor 501 may integrate one or more of the following: Central Processing Unit (CPU), Graphics Processing Unit (GPU), and modem. The CPU primarily handles the operating system, user interface, and applications; the GPU is responsible for rendering and drawing the displayed content; and the modem handles wireless communication. It is understood that the aforementioned modem can also be integrated into processor 501 and implemented as a separate communication chip.

[0088] The memory 502 may include random access memory (RAM) or read-only memory (ROM). The memory 502 can be used to store instructions, programs, code, code sets, or instruction sets. The memory 502 may include a program storage area and a data storage area. The program storage area may store instructions for implementing an operating system, instructions for implementing at least one function (such as touch functionality, sound playback functionality, image playback functionality, etc.), and instructions for implementing the various method embodiments described below. The data storage area may also store data created by the electronic device 500 during use (such as the various correspondences described above).

[0089] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working process of the above-described device and module can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0090] In the several embodiments provided in this application, the coupling or direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication connection through some interface, device or module, and may be electrical, mechanical or other forms.

[0091] Furthermore, the functional modules in the various embodiments of this application can be integrated into one processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The integrated modules described above can be implemented in hardware or as software functional modules.

[0092] Please refer to Figure 7 This diagram illustrates a structural block diagram of a computer-readable storage medium provided in an embodiment of this application. The computer-readable medium 600 stores program code that can be called by a processor to execute the methods described in the above method embodiments.

[0093] The computer-readable storage medium 600 may be an electronic memory such as flash memory, EEPROM (Electrically Erasable Programmable Read-Only Memory), EPROM, hard disk, or ROM. Optionally, the computer-readable storage medium 600 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 600 has storage space for program code 610 that performs any of the method steps described above. This program code can be read from or written to one or more computer program products. The program code 610 may be compressed, for example, in a suitable form.

[0094] In some embodiments, a computer program product or computer program is provided, which includes computer instructions stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the electronic device to perform the steps in the above-described method embodiments.

[0095] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications 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 application.

Claims

1. A method of outputting log data, characterized by, The method comprises: in response to a first user interaction operation, obtaining running threads associated with a specified application in a background application and a running thread of an application associated with the first user interaction operation as threads in a first thread group; based on a first restriction rule included in a first control policy corresponding to the first thread group and a first restriction parameter corresponding to the first restriction rule, output log data of the threads in the first thread group in a running process, the restriction degree of outputting log data under the first control policy being lower than the restriction degree of outputting log data under a second control policy corresponding to a second thread group, the second thread group including other threads in the running threads except the threads in the first thread group, and the second control policy including the first restriction rule and a second restriction parameter corresponding to the first restriction rule; based on the first restriction rule and the second restriction parameter, output log data of the threads in the second thread group in a running process, the restriction degree of the first restriction parameter being lower than the restriction degree of the second restriction parameter.

2. The method of claim 1, wherein, The first restriction parameter includes a first repetition parameter value, and the output of the log data of the threads in the first thread group in the running process based on the first restriction rule included in the first control policy corresponding to the first thread group and the first restriction parameter corresponding to the first restriction rule comprises: based on the first restriction rule and the first repetition parameter value, output log data of the threads in the first thread group in a running process, wherein the number of repeated log data in the output log data of the threads in the first thread group is less than the first repetition parameter value; The second restriction parameter includes a second repetition parameter value, and the output of the log data of the threads in the second thread group in the running process based on the first restriction rule and the second restriction parameter comprises: based on the first restriction rule and the second repetition parameter value, output log data of the threads in the second thread group in a running process, wherein the number of repeated log data in the output log data of the threads in the second thread group is less than the second repetition parameter value, and the second repetition parameter value is less than the first repetition parameter value.

3. The method of claim 1, wherein, The first restriction parameter includes a first log output threshold, and the output of the log data of the threads in the first thread group in the running process based on the first restriction rule included in the first control policy corresponding to the first thread group and the first restriction parameter corresponding to the first restriction rule comprises: based on the first restriction rule and the first log output threshold, output log data of the threads in the first thread group in a running process, wherein the number of log data of the threads in the first thread group output within a preset time period is less than or equal to the first log output threshold; The second limiting parameter comprises a second log output threshold, and outputting log data of threads in the second thread group currently in a running process based on the first limiting rule and the second limiting parameter comprises: outputting log data of threads in the second thread group currently in a running process based on the first limiting rule and the second log output threshold, wherein the number of logs of the log data of the threads in the second thread group output in the preset time period is less than or equal to the second log output threshold, and the second log output threshold is less than the first log output threshold.

4. The method according to any one of claims 1 to 3, characterized in that, After outputting log data of threads in the first thread group currently in a running process based on the first limiting rule included in the first thread group corresponding first control policy and the first limiting parameter corresponding to the first limiting rule, the method further comprises: in response to a second user interaction operation, obtaining a thread associated with the second user interaction operation as a target thread; updating the threads contained in the first thread group based on the target thread to obtain an updated first thread group; outputting log data of the updated first thread group currently in a running process based on the first control policy.

5. The method of claim 4, wherein, The outputting of the log data of the updated first thread group in a running process based on the first control policy comprises: if the target thread is a preset thread, updating the first control policy based on a target control policy corresponding to the preset thread, wherein the limiting degree of outputting log data under the target control policy is lower than the limiting degree of outputting log data under the first control policy; outputting log data of the updated first thread group currently in a running process based on the updated first control policy.

6. An output device of log data, characterized by, The apparatus comprises: a thread obtaining module configured to, in response to a first user interaction operation, obtain running threads associated with a specified application in a background application and running threads of an application associated with the first user interaction operation as threads in a first thread group; a log output module configured to output log data of threads in the first thread group currently in a running process based on a first limiting rule included in a first control policy corresponding to the first thread group and a first limiting parameter corresponding to the first limiting rule, wherein the limiting degree of outputting log data under the first control policy is lower than the limiting degree of outputting log data under a second control policy corresponding to a second thread group, the second thread group comprises other threads in a running process except the threads in the first thread group, and the second control policy comprises the first limiting rule and a second limiting parameter corresponding to the first limiting rule; and output log data of threads in the second thread group currently in a running process based on the first limiting rule and the second limiting parameter, wherein the limiting degree of the first limiting parameter is lower than the limiting degree of the second limiting parameter.

7. An electronic device, comprising: comprises: one or more processors; a memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to perform the method of any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores program codes, and the program codes can be invoked by the processor to execute the method of any one of claims 1-5.

Citation Information

Patent Citations

  • Log processing method and device, equipment and storage medium

    CN114116811A