Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
The data acquisition method provided by the embodiment of the Application can be applied to terminal devices such as a mobile phone, a tablet personal computer, a wearable device, a vehicle-mounted device, an Augmented Reality (AR)/Virtual Reality (VR) device, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a Personal Digital Assistant (PDA) and the like, and is used for acquiring data information of an Application (Application) installed on the terminal device.
For example, the terminal device may be a Station (ST) in a WLAN, which may be a cellular phone, a cordless phone, a Session Initiation Protocol (SIP) phone, a Wireless Local Loop (WLL) station, a Personal Digital Assistant (PDA) device, a handheld device with Wireless communication capability, a computing device or other processing device connected to a Wireless modem, a vehicle-mounted device, a vehicle-mounted networking terminal, a computer, a laptop, a handheld communication device, a handheld computing device, a satellite Wireless device, a Wireless modem card, a television set-top box (STB), a Customer Premises Equipment (CPE), and/or other devices for communicating over a Wireless system and a next generation communication system, such as a Mobile terminal in a 5G Network or a Public Land Mobile Network (future evolved, PLMN) mobile terminals in the network, etc.
Take the terminal device as a mobile phone as an example. The application program installed on the mobile phone can be generally set to be in a network state and used, and the log file of the application program is monitored and acquired in real time and uploaded to the server in the network state. And if the user is in an area where a mobile network base station is not erected or signals are shielded, the mobile phone is in a network-free state, the application program cannot be used due to the fact that the application program is not connected with a network, and developers cannot normally collect user operation log information of the application program.
Therefore, the data acquisition method provided by the application can better optimize the collection of the abnormal logs of the application program, so that developers can conveniently troubleshoot and solve problems, and the use experience of the application program is improved.
The data acquisition method provided by the present application is exemplarily described below by specific embodiments.
Referring to fig. 1, a schematic flow chart of a data acquisition method provided in an embodiment of the present application is shown. The execution main body of the data acquisition method in the embodiment is terminal equipment. The method comprises the following steps:
s101: and monitoring and acquiring the switching operation information of the foreground and the background of the application.
In this embodiment, in the process of operating the application program on the terminal device, when a user wants to operate another terminal device, the user often places the application program in the background from the current foreground use interface to continue to run by operating a key of the terminal device, such as a "home" key of the terminal device. The foreground and background switching operation refers to switching the application program from a current use state to a non-use and non-closed state, for example, switching a first application program currently used to a second application program, and using the second application program, where the first application program is running in a background, or switching to a desktop of the terminal device through a control key on the terminal device. The foreground and background switching operation information may be one or more of response information of a switching key of the operation terminal device and operation information of selecting other application programs.
S102: and when the monitoring result shows that the application is subjected to foreground and background switching operation, checking whether the log file which is not uploaded exists in a local storage area.
In this embodiment, if the monitoring obtains that the application is switched to the background operation of the terminal device, whether a log file related to the application exists in the local storage area of the terminal device is checked, so that the log file is uploaded to the server, and developers can troubleshoot and solve the abnormal problem of the application according to the uploaded log file. The local storage area may be a local independent storage area or a local general storage area. The log files comprise abnormal log files and normal log files, wherein the abnormal log files are log files recorded when a user uses the application process to be abnormal, the abnormality can be the problems of application flash backing, application blocking and the like, and the log files can be log files recorded under a network environment or log files recorded under a network-free environment. The normal log file is a common operation log of the user in the application process, and can be a log file recorded in a network environment or a log file recorded in a non-network environment.
S103: and if the log file which is not uploaded exists in the local storage area, acquiring the log file of the local storage area and uploading the log file to a server.
In this embodiment, the log file in the local storage area may be a log file generated when the user uses the application, and may be a log file that was not successfully uploaded due to a network reason last time, for example, when the user is in a network-free environment, the user uses the application to generate a corresponding log file, but does not upload the log file to the server due to no network.
With reference to fig. 2, optionally, for step S102, the checking whether the local storage area has the non-uploaded log file includes checking whether the local storage area has the non-uploaded compressed log file and the non-uploaded log file, and if the local storage area has the non-uploaded compressed log file, that is, the number of the non-uploaded compressed log files is greater than 0, setting the upload level of the compressed file to be the first priority; and the uploading level of the uncompressed log file is set as a second priority. Preferably, the compressed log file may be in a compressed format of one or more of Zip, rar or 7 z.
If the uncompressed log files exist in the local storage area, compressing the log files into a plurality of compressed log files according to a preset file number threshold. The preset file number threshold may be freely set, for example, 10, that is, 10 uncompressed log files in the local storage area are obtained and compressed into 1 compressed log file.
Optionally, in step S103, when it is monitored that the application performs a foreground-background switching operation and the log file of the application that is not uploaded exists in the local storage area, it is checked whether the terminal device is connected to a network, and it is further determined whether the application is connected to the network, so as to determine whether the application can be connected to the server through the communication network. And if the application is connected to the network, acquiring the log file of the application which is not uploaded in the local storage area and uploading the log file to a server. Wherein the network may be a wireless network accessing a communication standard based, such as WiFi, 2G or 3G, 4G LTE, 5G NR, or a combination thereof.
Optionally, when it is monitored that the application performs a foreground-background switching operation, it is also monitored whether a log file uploading function of the application is disabled, and if the log file uploading function is not disabled, it is checked whether the terminal device is connected to a network, so as to determine whether the application is connected to the network.
In one embodiment, log files with the same uploading priority are uploaded according to the generation time sequence of each log file. For example, there are 3 compressed log files in the local storage area, that is, the compressed log files are respectively arranged as a first compressed log file, a second log file and a third log file according to the sequence of the generation time, and the previously generated log files are preferentially uploaded within the same priority level.
Optionally, if the log file recording the application exception exists in the log files of the same uploading priority, the log file recording the application exception is preferentially uploaded.
In an embodiment, when the log file in the local storage area is uploaded to the server, a Security verification identifier (Security Token) of the log file is further obtained, the log file is subjected to Security verification according to the Security verification identifier, and if the log file passes the Security verification, the log file is uploaded to the server, so that damage to the server due to the fact that an unauthorized log file is uploaded to the server is avoided, for example, a log file infected with a computer virus is uploaded to the server, and damage to the server is caused. And the uncompressed log file and the compressed log file are both provided with the safety verification identifier.
In an embodiment, after the log file operation in the local storage area is uploaded, the uploaded log file may not be successfully sent to the server due to a network reason, for example, the terminal device is suddenly disconnected from the network in the process of uploading the log file, or the server is disconnected from the network.
Therefore, an embodiment of the present application further provides a data acquisition method, which mainly relates to a processing process after the log file is uploaded. The method comprises the following steps:
and checking the uploading state of the log file, and deleting the corresponding log file in the local storage area if the log file is uploaded successfully.
If the log file is not uploaded, the corresponding log file is reserved in the local storage area. And the log file which fails to be uploaded is stored in the local storage area, and is uploaded to the server when uploading operation is triggered when the next foreground and background switching of the application is reserved.
In an embodiment, it may be that, in a use process of the application, the application is abnormal, and an abnormal log file is generated, and if the abnormal log file is uploaded to the server after waiting for the switching operation between the front and the back of the application, and a developer performs troubleshooting and resolution on a problem according to the log file, so that the application is always in an abnormal state or frequently in an abnormal state in the process, and a use experience of a user on the application is reduced.
Therefore, an embodiment of the application further provides a data acquisition method, which mainly relates to an uploading process of log files when the application is abnormal in the application process when a user uses the application. The method comprises the following steps:
when the application detects an abnormal event, acquiring an abnormal log of the application;
checking whether the application is connected to a network;
if the application is connected to the network, uploading the abnormal log to a server;
otherwise, storing the abnormal log in a local storage area.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Fig. 3 shows a block diagram of a data acquisition apparatus provided in an embodiment of the present application, which corresponds to the data acquisition method described in the above embodiment, and only shows portions related to the embodiment of the present application for convenience of description.
Referring to fig. 3, the apparatus includes: monitoring module 100, inspection module 200, upload module 300.
The monitoring module 100 is configured to monitor and acquire application foreground and background switching operation information.
The checking module 200 is configured to check whether an un-uploaded log file exists in a local storage area when the monitoring result indicates that the application performs a foreground-background switching operation.
The uploading module 300 is configured to, if the log file not uploaded exists in the local storage area, acquire the log file in the local storage area and upload the log file to the server.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
Fig. 4 is a schematic structural diagram of a terminal device according to an embodiment of the present application. As shown in fig. 4, the terminal device 4 of this embodiment includes: at least one processor 40 (only one processor is shown in fig. 4), a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40, the steps in any of the various data acquisition method embodiments described above being implemented when the computer program 42 is executed by the processor 40.
The terminal device 4 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device may include, but is not limited to, a processor 40, a memory 41. Those skilled in the art will appreciate that fig. 4 is merely an example of the terminal device 4, and does not constitute a limitation of the terminal device 4, and may include more or less components than those shown, or combine some components, or different components, such as an input-output device, a network access device, and the like.
The Processor 40 may be a Central Processing Unit (CPU), and the Processor 40 may also be other general purpose processors, Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field-Programmable Gate arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 41 may in some embodiments be an internal storage unit of the terminal device 4, such as a hard disk or a memory of the terminal device 4. In other embodiments, the memory 41 may also be an external storage device of the terminal device 4, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), or the like provided on the terminal device 4. Further, the memory 41 may also include both an internal storage unit and an external storage device of the terminal device 4. The memory 41 is used for storing an operating system, an application program, a BootLoader (BootLoader), data, and other programs, such as program codes of the computer program. The memory 41 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional modules are only used for distinguishing one functional module from another, and are not used for limiting the protection scope of the application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps in the above-mentioned method embodiments.
The embodiments of the present application provide a computer program product, which when running on a mobile terminal, enables the mobile terminal to implement the steps in the above method embodiments when executed.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing apparatus/terminal apparatus, a recording medium, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/network device and method may be implemented in other ways. For example, the above-described apparatus/network device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.