CN110716908A - Log information writing method, system, storage medium and mobile terminal - Google Patents

Log information writing method, system, storage medium and mobile terminal Download PDF

Info

Publication number
CN110716908A
CN110716908A CN201910935405.7A CN201910935405A CN110716908A CN 110716908 A CN110716908 A CN 110716908A CN 201910935405 A CN201910935405 A CN 201910935405A CN 110716908 A CN110716908 A CN 110716908A
Authority
CN
China
Prior art keywords
information
storage file
writing
log information
log
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910935405.7A
Other languages
Chinese (zh)
Inventor
宋文强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
JRD Communication Shenzhen Ltd
Jiekai Communications Shenzhen Co Ltd
Original Assignee
Jiekai Communications Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jiekai Communications Shenzhen Co Ltd filed Critical Jiekai Communications Shenzhen Co Ltd
Priority to CN201910935405.7A priority Critical patent/CN110716908A/en
Publication of CN110716908A publication Critical patent/CN110716908A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1805Append-only file systems, e.g. using logs or journals to store data
    • G06F16/1815Journaling file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application discloses a log information writing method, a system, a storage medium and a mobile terminal, wherein the method comprises the following steps: receiving a starting instruction; responding to the starting instruction to establish an information transmission pipeline; triggering a first thread to call a log tool to obtain log information, and writing the log information into the information transmission pipeline; and acquiring the log information written into the information transmission pipeline, and writing the log information into a storage file of a second thread. The loss of log information can be avoided, and the integrity of the test information is improved.

Description

Log information writing method, system, storage medium and mobile terminal
Technical Field
The present application relates to the field of communications, and in particular, to a method, a system, a storage medium, and a mobile terminal for writing log information.
Background
Logcat, as a command line tool, may be used to obtain log information (log) of a program, however, when developing and developing a KaiOS system device, debug (test) information needs to be stored in a storage device of the KaiOS. However, devices using the KaiOS system are inexpensive, and thus the storage device space used by the devices is small, which results in the need to control the size and number of logs generated using the Logcat tool. The traditional logcator has a way to provide control over the log file size, but at the end of a log, there is a loss of log information in the middle of generating a new log.
Disclosure of Invention
The embodiment of the application provides a log information writing method, which can avoid loss of log information and improve integrity of test information.
The embodiment of the application provides a log information writing method, which comprises the following steps:
receiving a starting instruction;
responding to the starting instruction to establish an information transmission pipeline;
triggering a first thread to call a log tool to obtain log information, and writing the log information into the information transmission pipeline;
and acquiring the log information written into the information transmission pipeline, and writing the log information into a storage file of a second thread.
In some embodiments, the obtaining log information written to the information transmission pipeline and writing the log information into a storage file of a second thread includes:
triggering a second thread to create a storage file and acquiring a transmission rule of the information transmission pipeline;
acquiring first target information written into the information transmission pipeline;
and writing the first target information into the storage file according to the transmission rule.
In some embodiments, after the writing the first target information into the storage file according to the transmission rule, the method further includes:
detecting whether the first target information reaches a first preset capacity threshold of a storage file;
and if the first target information does not reach the first preset capacity threshold value, writing the second target information acquired from the information transmission pipeline into the storage file.
In some embodiments, after the writing the first target information into the storage file according to the transmission rule, the method further includes:
detecting whether the first target information reaches a first preset capacity threshold of a storage file;
if the first target information is detected to reach the first preset capacity threshold, detecting whether the file quantity of the storage files reaches a preset quantity threshold; and/or detecting whether the storage capacity of the storage file reaches a second preset capacity threshold value;
if the file quantity of the storage files does not reach a preset quantity threshold value; and/or if the storage capacity of the storage file does not reach a second preset capacity threshold value, continuing to create the storage file.
In some embodiments, the storing the log information in the storage file carries a timestamp for generating the storage file, and after the writing the log information in the storage file, the method further includes:
if the log information written into the storage file is detected to reach a first preset capacity threshold value, detecting whether the file number of the storage file reaches a preset number threshold value; and/or detecting whether the capacity of the storage file reaches a second preset capacity threshold value;
if the number of the files of the storage file reaches a preset number threshold value; and/or when the capacity of the storage file reaches a second preset capacity threshold, acquiring a timestamp of the storage file;
determining a target file with a previous timestamp;
and clearing the target file.
An embodiment of the present application further provides a log information writing system, including:
the receiving module is used for receiving a starting instruction;
the creating module is used for responding to the starting instruction to create an information transmission pipeline;
the trigger module is used for triggering a first thread to call a log tool to obtain log information and writing the log information into the information transmission pipeline;
and the writing module is used for acquiring the log information written into the information transmission pipeline and writing the log information into a storage file of a second thread.
In some embodiments, the write module includes:
the first obtaining submodule is used for triggering a second thread to create a storage file and obtaining a transmission rule of the information transmission pipeline;
the second acquisition submodule is used for acquiring the first target information written into the information transmission pipeline;
and the first writing sub-module is used for writing the first target information into the storage file according to the transmission rule.
In some embodiments, the write module further comprises:
the detection submodule is used for detecting whether the first target information reaches a first preset capacity threshold of a storage file;
and the second writing sub-module is used for writing the second target information acquired from the information transmission pipeline into the storage file if the first target information does not reach the first preset capacity threshold.
An embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program runs on a computer, the computer is caused to execute the log information writing method described above.
The embodiment of the present application further provides a mobile terminal, where the mobile terminal includes a processor and a memory, where the memory stores a computer program, and the processor is configured to execute the log information writing method by calling the computer program stored in the memory.
The log information writing method provided by the embodiment of the application comprises the following steps: receiving a starting instruction; responding to the starting instruction to establish an information transmission pipeline; triggering a first thread to call a log tool to obtain log information, and writing the log information into the information transmission pipeline; and acquiring the log information written into the information transmission pipeline, and writing the log information into a storage file of a second thread. The loss of log information can be avoided, and the integrity of the test information is improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a log information writing method according to an embodiment of the present application.
Fig. 2 is a schematic flowchart of a second method for writing log information according to an embodiment of the present disclosure.
Fig. 3 is a schematic structural diagram of a log information writing system according to an embodiment of the present application.
Fig. 4 is a specific structural block diagram of a mobile terminal according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application. It is to be understood that the embodiments described are only a few embodiments of the present application and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
Referring to fig. 1, fig. 1 is a first flowchart illustrating a log information writing method according to an embodiment of the present disclosure. The method comprises the following steps:
step 101, receiving a starting instruction.
Specifically, the starting instruction may be an instruction for starting the mobile terminal, or an instruction for triggering the start of an operating system in the mobile terminal after the mobile terminal is started, which is not described herein again. The mobile terminal may include a smart phone, a tablet computer, a palm computer, and other portable electronic devices.
And 102, responding to the starting instruction to establish an information transmission pipeline.
Specifically, after receiving the start instruction, an information transmission pipeline is created, and the information transmission pipeline is used for storing information and transmitting information, it should be noted that the information transmission pipeline is a virtual pipeline, the actual principle is to separate a plurality of commands by "|" (pipe symbols), and information output by a command on the left side of a pipe symbol is used as information required to be input by a command on the right side of the pipe symbol, so that the plurality of commands are associated through the pipeline.
And 103, triggering the first thread to call a log tool to obtain log information, and writing the log information into the information transmission pipeline.
The method comprises the steps that a log tool obtains log information, namely a command on the left side of a pipeline sign, the command is processed through a first thread in a processor, and after the log tool obtains the log information, the log information is written into an information transmission pipeline and used as input information of the command on the right side of the pipeline sign.
Specifically, the log information may include debug # system debug information; info # conventional information; warning # message; err # reports an error (low level, prevents a function from working normally); crit # error reporting (high level, organization of the whole software or the whole system can not work normally); alert # requires immediate modified information; emerg # kernel crash; none # does not collect any log information; normal files with most importance, and log information of multiple levels. This information is stored in the system memory or buffer during testing.
And 104, acquiring the log information written into the information transmission pipeline, and writing the log information into a storage file of a second thread.
Specifically, the writing of the log information acquired from the information transmission pipeline into the storage file of the second thread is a command on the right side of the pipeline identifier, and the command is processed by the second thread of the processor.
Of course, the storage file is also created by the second thread, that is, after the second thread creates a blank storage file, the second thread waits for the output information on the left side of the pipe character, and uses the output information of the left side command of the pipe character as the input information written into the storage file generated by the right side command of the pipe character, but the transmission of the information is determined by the transmission rule of the information transmission pipeline, so that when the information is transmitted, the transmission rule of the information transmission pipeline needs to be obtained in advance, that is, which command is on the left side of the pipe character and which command is on the right side of the pipe character, and the transmission rule of the application is to use the output in the first thread as the input in the second thread. Thus, the step may further comprise:
triggering a second thread to create a storage file and acquiring a transmission rule of an information transmission pipeline;
acquiring first target information written into an information transmission pipeline;
and writing the first target information into the storage file according to the transmission rule.
The general format of the storage file here is the text document format (TXT). It can be understood that, since the text document generally has a limited capacity, there may be a remaining capacity of the storage file after the first target information is written into the storage file, and therefore, the second target information may be obtained from the information transmission pipeline and continuously written into the storage file. Therefore, after writing the first target information into the storage file according to the transmission rule, the method further includes:
detecting whether the first target information reaches a first preset capacity threshold of a storage file or not;
and if the first target information does not reach the first preset capacity threshold value, writing the second target information acquired from the information transmission pipeline into a storage file.
In addition, in the process of writing the first target information into the storage file, the capacity of the storage file may not be capable of storing the first target information, so that the second thread may start to create a storage file again, and write the information which cannot be written in the first target information into the newly generated storage file. However, due to the capacity problem of the system memory or the cache, it is necessary to determine whether a new storage file can be continuously created in the memory or the cache. Therefore, two kinds of determination conditions can be set, the first being: detecting whether the number of the files of the stored files reaches a preset number threshold (namely judging whether the residual storage space in the memory or the cache can generate new stored files); the second judgment condition is as follows: whether the storage capacity of the storage file reaches a fixed capacity threshold value is detected (namely whether the residual storage space in the memory or the cache can also contain the log information acquired from the information transmission pipeline is judged). Therefore, after writing the first target information into the storage file according to the transmission rule, the method further includes:
detecting whether the first target information reaches a first preset capacity threshold of a storage file or not;
if the first target information is detected to reach a first preset capacity threshold value, detecting whether the file quantity of the stored files reaches a preset quantity threshold value; and/or detecting whether the storage capacity of the storage file reaches a second preset capacity threshold value;
if the file quantity of the storage files does not reach a preset quantity threshold value; and/or if the storage capacity of the storage file does not reach a second preset capacity threshold value, continuing to create the storage file.
Furthermore, in another case, that is, a new storage file cannot be generated continuously in the remaining storage space in the memory or the cache, and therefore the storage file generated when the time is earlier needs to be deleted, after the log information is written into the storage file, the method further includes:
if the log information written into the storage file is detected to reach a first preset capacity threshold value, detecting whether the file number of the storage file reaches a preset number threshold value; and/or detecting whether the capacity of the stored file reaches a second preset capacity threshold value;
if the number of the stored files reaches a preset number threshold value; and/or acquiring a timestamp of the storage file when the capacity of the storage file reaches a second preset capacity threshold;
determining a target file with a previous timestamp;
and clearing the target file. Therefore, when the second thread generates each storage file, the storage file needs to be time-stamped, so that each storage file carries a time stamp.
The log information writing method provided by the embodiment of the application comprises the following steps: receiving a starting instruction; responding to the starting instruction to establish an information transmission pipeline; triggering a first thread to call a log tool to obtain log information, and writing the log information into the information transmission pipeline; and acquiring the log information written into the information transmission pipeline, and writing the log information into a storage file of a second thread. The loss of log information can be avoided, and the integrity of the test information is improved.
Referring to fig. 2, fig. 2 is a second flowchart illustrating a log information writing method according to an embodiment of the present disclosure. The method comprises the following steps:
step 201, receiving a starting instruction.
Specifically, the starting instruction may be an instruction for starting the mobile terminal, or an instruction for triggering the start of an operating system in the mobile terminal after the mobile terminal is started, which is not described herein again. The mobile terminal may include a smart phone, a tablet computer, a palm computer, and other portable electronic devices.
Step 202, creating an information transmission pipeline in response to the starting instruction.
Specifically, after receiving the start instruction, an information transmission pipeline is created, and the information transmission pipeline is used for storing information and transmitting information, it should be noted that the information transmission pipeline is a virtual pipeline, the actual principle is to separate a plurality of commands by "|" (pipe symbols), and information output by a command on the left side of a pipe symbol is used as information required to be input by a command on the right side of the pipe symbol, so that the plurality of commands are associated through the pipeline.
Step 203, triggering the first thread to call the log tool to obtain the log information, and writing the log information into the information transmission pipeline.
The method comprises the steps that a log tool obtains log information, namely a command on the left side of a pipeline sign, the command is processed through a first thread in a processor, and after the log tool obtains the log information, the log information is written into an information transmission pipeline and used as input information of the command on the right side of the pipeline sign.
Specifically, the log information may include debug # system debug information; info # conventional information; warning # message; err # reports an error (low level, prevents a function from working normally); crit # error reporting (high level, organization of the whole software or the whole system can not work normally); alert # requires immediate modified information; emerg # kernel crash; none # does not collect any log information; normal files with most importance, and log information of multiple levels. This information is stored in the system memory or buffer during testing.
And step 204, triggering a second thread to create a storage file, and acquiring a transmission rule of the information transmission pipeline.
Specifically, the writing of the log information acquired from the information transmission pipeline into the storage file of the second thread is a command on the right side of the pipeline identifier, and the command is processed by the second thread of the processor.
Of course, the storage file is also created by the second thread, that is, after the second thread creates a blank storage file, the second thread waits for the output information on the left side of the pipe character, and uses the output information of the left command of the pipe character as the input information written into the storage file generated by the right command of the pipe character, but the information transmission is determined by the transmission rule of the information transmission pipeline, so that the transmission rule of the information transmission pipeline, that is, which command is on the left side of the pipe character and which command is on the right side of the pipe character, needs to be obtained in advance during information transmission.
Step 205, obtaining the first target information written into the information transmission pipeline.
And acquiring the output information on the left side of the pipeline character, namely the first target information from the information transmission pipeline.
And step 206, writing the first target information into the storage file according to the transmission rule.
Step 207, detecting whether the first target information reaches a first preset capacity threshold of the storage file.
Since the general format of the storage file is the text document format (TXT). It is understood that, since the text document generally has a limited capacity, there may be a remaining capacity of the storage file after the first target information is written into the storage file, and therefore, other information may also be written into the remaining storage space of the storage file.
And step 208, if the first target information does not reach the first preset capacity threshold, writing the second target information acquired from the information transmission pipeline into a storage file.
And if the first target information does not reach the first preset capacity threshold value, second target information can be obtained from the information transmission pipeline, and the second target information is continuously written into the storage file.
Step 209, detecting whether the number of files of the stored file reaches a preset number threshold value or not when detecting that the first target information reaches a first preset capacity threshold value; and/or detecting whether the storage capacity of the storage file reaches a second preset capacity threshold value.
Specifically, in the process of writing the first target information into the storage file, the capacity of the storage file may not be able to store the first target information, so that the second thread may start to create a storage file again, and write the information that cannot be written in the first target information into the newly generated storage file. However, due to the capacity problem of the system memory or the cache, it is necessary to determine whether a new storage file can be continuously created in the memory or the cache. Therefore, two kinds of determination conditions can be set, the first being: detecting whether the number of the files of the stored files reaches a preset number threshold (namely judging whether the residual storage space in the memory or the cache can generate new stored files); the second judgment condition is as follows: whether the storage capacity of the storage file reaches a fixed capacity threshold value is detected (namely whether the residual storage space in the memory or the cache can also contain the log information acquired from the information transmission pipeline is judged).
Step 210, if the number of the stored files does not reach a preset number threshold value; and/or if the storage capacity of the storage file does not reach the second preset capacity threshold value, continuing to create the storage file.
Step 211, if the number of the stored files reaches a preset number threshold; and/or acquiring the time stamp of the storage file when the capacity of the storage file reaches a second preset capacity threshold value.
Step 212, determining the target file with the previous timestamp.
And step 213, clearing the target file.
In another case, the remaining storage space in the memory or the cache cannot generate a new storage file continuously, so that the storage file generated at an earlier time needs to be deleted to ensure that the storage file in the storage space can be written with new log information.
The log information writing method provided by the embodiment of the application comprises the following steps: receiving a starting instruction; responding to the starting instruction to establish an information transmission pipeline; triggering a first thread to call a log tool to obtain log information, and writing the log information into the information transmission pipeline; and acquiring the log information written into the information transmission pipeline, and writing the log information into a storage file of a second thread. The loss of log information can be avoided, and the integrity of the test information is improved.
Referring to fig. 3, fig. 3 is a schematic structural diagram of a log information writing system according to an embodiment of the present application. The mobile terminal power supply includes: a receiving module 31, a creating module 32, a triggering module 33 and a writing module 34.
The receiving module 31 is configured to receive a start instruction.
Specifically, the starting instruction may be an instruction for starting the mobile terminal, or an instruction for triggering the start of an operating system in the mobile terminal after the mobile terminal is started, which is not described herein again. The mobile terminal may include a smart phone, a tablet computer, a palm computer, and other portable electronic devices.
And the creating module 32 is used for responding to the starting instruction to create an information transmission pipeline.
Specifically, after receiving the start instruction, an information transmission pipeline is created, and the information transmission pipeline is used for storing information and transmitting information, it should be noted that the information transmission pipeline is a virtual pipeline, the actual principle is to separate a plurality of commands by "|" (pipe symbols), and information output by a command on the left side of a pipe symbol is used as information required to be input by a command on the right side of the pipe symbol, so that the plurality of commands are associated through the pipeline.
And the triggering module 33 is configured to trigger the first thread to call the log tool to obtain the log information, and write the log information into the information transmission pipeline.
The method comprises the steps that a log tool obtains log information, namely a command on the left side of a pipeline sign, the command is processed through a first thread in a processor, and after the log tool obtains the log information, the log information is written into an information transmission pipeline and used as input information of the command on the right side of the pipeline sign.
Specifically, the log information may include debug # system debug information; info # conventional information; warning # message; err # reports an error (low level, prevents a function from working normally); crit # error reporting (high level, organization of the whole software or the whole system can not work normally); alert # requires immediate modified information; emerg # kernel crash; none # does not collect any log information; normal files with most importance, and log information of multiple levels. This information is stored in the system memory or buffer during testing.
And the writing module 34 is configured to acquire the log information written into the information transmission pipeline, and write the log information into a storage file of a second thread.
Specifically, the writing of the log information acquired from the information transmission pipeline into the storage file of the second thread is a command on the right side of the pipeline identifier, and the command is processed by the second thread of the processor.
In some embodiments, the write module 34 may further include:
the first obtaining submodule is used for triggering a second thread to create a storage file and obtaining a transmission rule of the information transmission pipeline;
the second acquisition submodule is used for acquiring the first target information written into the information transmission pipeline;
and the first writing sub-module is used for writing the first target information into the storage file according to the transmission rule.
In some embodiments, the write module 34 may further include:
the detection submodule is used for detecting whether the first target information reaches a first preset capacity threshold of a storage file;
and the second writing sub-module is used for writing the second target information acquired from the information transmission pipeline into the storage file if the first target information does not reach the first preset capacity threshold.
Based on the above method, the present invention further provides a storage medium having a plurality of instructions stored thereon, wherein the instructions are suitable for being loaded by a processor and executing the log information writing method as described above.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by associated hardware instructed by a program, which may be stored in a computer-readable storage medium, and the storage medium may include: read Only Memory (ROM), Random Access Memory (RAM), magnetic or optical disks, and the like.
Fig. 4 is a specific structural block diagram of a mobile terminal according to an embodiment of the present invention, where the mobile terminal may be used to implement the method, the apparatus, the storage medium, and the mobile terminal for controlling the screen-on duration provided in the foregoing embodiments. The mobile terminal 1200 may be a smart phone or a tablet computer.
As shown in fig. 4, the mobile terminal 1200 may include an RF (Radio Frequency) circuit 110, a memory 120 including one or more computer-readable storage media (only one shown), an input unit 130, a display unit 140, a sensor 150, an audio circuit 160, a transmission module 170, a processor 180 including one or more processing cores (only one shown), and a power supply 190. Those skilled in the art will appreciate that the mobile terminal 1200 configuration illustrated in fig. 4 is not intended to be limiting of the mobile terminal 1200 and may include more or less components than those illustrated, or some components in combination, or a different arrangement of components. Wherein:
the RF circuitry 110 may include various existing circuit elements for performing these functions, such as an antenna, a radio frequency transceiver, a digital signal processor, an encryption/decryption chip, a Subscriber Identity Module (SIM) card, memory, and so forth. The RF circuit 110 may communicate with various networks such as the internet, an intranet, a wireless network, or with a second device over a wireless network. The wireless network may comprise a cellular telephone network, a wireless local area network, or a metropolitan area network.
The memory 120 may be configured to store software programs and modules, such as the bright screen duration control method, apparatus, storage medium, and program instructions/modules corresponding to the mobile terminal in the foregoing embodiments, and the processor 180 executes various functional applications and data processing by operating the software programs and modules stored in the memory 120, so as to implement the function of mutual chip identification. Memory 120 may include high speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or a second non-volatile solid-state memory. In some examples, memory 120 may be a storage medium as described above.
The input unit 130 may be used to receive input numeric or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control. In particular, the input unit 130 may include a touch-sensitive surface 131 as well as other input devices 132. The touch-sensitive surface 131, also referred to as a touch display screen or a touch pad, may collect touch operations by a user on or near the touch-sensitive surface 131 (e.g., operations by a user on or near the touch-sensitive surface 131 using a finger, a stylus, or any other suitable object or attachment), and drive the corresponding connection device according to a predetermined program. Alternatively, the touch sensitive surface 131 may comprise two parts, a touch detection means and a touch controller.
The display unit 140 may be used to display information input by or provided to the user and various graphic user interfaces of the mobile terminal 1200, which may be configured by graphics, text, icons, video, and any combination thereof. The display unit 140 may include a display panel 141, and further, the touch-sensitive surface 131 may cover the display panel 141. The display interface of the mobile terminal in the above embodiment may be represented by the display unit 140, that is, the display content displayed by the display interface may be displayed by the display unit 140.
The mobile terminal 1200 may also include at least one sensor 150, such as a light sensor, a motion sensor, and a second sensor. Specifically, the light sensor may include an ambient light sensor that may adjust the brightness of the display panel 141 according to the brightness of ambient light, and a proximity sensor that may turn off the display panel 141 and/or the backlight when the mobile terminal 1200 is moved to the ear. As for the second sensor such as a gyroscope, a barometer, a hygrometer, a thermometer, and an infrared sensor, which may be further configured in the mobile terminal 1200, the detailed description is omitted here.
Audio circuitry 160, speaker 161, and microphone 162 may provide an audio interface between a user and mobile terminal 1200. The audio circuit 160 may transmit the electrical signal converted from the received audio data to the speaker 161, and convert the electrical signal into a sound signal for output by the speaker 161; on the other hand, the microphone 162 converts the collected sound signal into an electric signal, converts the electric signal into audio data after being received by the audio circuit 160, and then outputs the audio data to the processor 180 for processing, and then to the RF circuit 110 to be transmitted to, for example, another terminal, or outputs the audio data to the memory 120 for further processing. The audio circuitry 160 may also include an earbud jack to provide communication of peripheral headphones with the mobile terminal 1200.
The mobile terminal 1200, which can help a user send and receive e-mails, browse web pages, access streaming media, etc., provides the user with wireless broadband internet access through the transmission module 170.
The processor 180 is a control center of the mobile terminal 1200, connects various parts of the entire mobile phone using various interfaces and lines, and performs various functions of the mobile terminal 1200 and processes data by operating or executing software programs and/or modules stored in the memory 120 and calling data stored in the memory 120, thereby integrally monitoring the mobile phone. Optionally, processor 180 may include one or more processing cores; in some embodiments, the processor 180 may integrate an application processor, which primarily handles operating systems, user interfaces, applications, etc., and a modem processor, which primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 180.
Specifically, the processor 180 includes: an Arithmetic Logic Unit (ALU), an application processor, a Global Positioning System (GPS) and a control and status Bus (Bus) (not shown).
The mobile terminal 1200 also includes a power supply 190 (e.g., a battery) for powering the various components, which may be logically coupled to the processor 180 via a power management system in some embodiments to provide management of power, and power consumption via the power management system. The power supply 190 may also include any component including one or more of a dc or ac power source, a re-power system, a power failure detection circuit, a power converter or inverter, a power status indicator, and the like.
Although not shown, the mobile terminal 1200 may further include a camera (e.g., a front camera, a rear camera), a bluetooth module, and the like, which are not described in detail herein.
Specifically, in the present embodiment, the display unit 140 of the mobile terminal 1200 is a touch screen display, and the mobile terminal 1200 further includes a memory 120 and one or more programs, wherein the one or more programs are stored in the memory 120, and the one or more programs configured to be executed by the one or more processors 180 include instructions for:
receiving a starting instruction;
responding to the starting instruction to establish an information transmission pipeline;
triggering a first thread to call a log tool to obtain log information, and writing the log information into the information transmission pipeline;
and acquiring the log information written into the information transmission pipeline, and writing the log information into a storage file of a second thread.
In some embodiments, when the obtaining the log information written to the information transmission pipeline and writing the log information into the storage file of the second thread, the processor 180 may further execute the following instructions:
triggering a second thread to create a storage file and acquiring a transmission rule of the information transmission pipeline;
acquiring first target information written into the information transmission pipeline;
and writing the first target information into the storage file according to the transmission rule.
In some embodiments, after writing the first target information into the storage file according to the transmission rule, the processor 180 may further execute the following instructions:
detecting whether the first target information reaches a first preset capacity threshold of a storage file;
and if the first target information does not reach the first preset capacity threshold value, writing the second target information acquired from the information transmission pipeline into the storage file.
In some embodiments, after writing the first target information into the storage file according to the transmission rule, the processor 180 may further execute the following instructions:
detecting whether the first target information reaches a first preset capacity threshold of a storage file;
if the first target information is detected to reach the first preset capacity threshold, detecting whether the file quantity of the storage files reaches a preset quantity threshold; and/or detecting whether the storage capacity of the storage file reaches a second preset capacity threshold value;
if the file quantity of the storage files does not reach a preset quantity threshold value; and/or if the storage capacity of the storage file does not reach a second preset capacity threshold value, continuing to create the storage file.
In some embodiments, after writing the log information into the storage file, the processor 180 may further execute the instructions of:
if the log information written into the storage file is detected to reach a first preset capacity threshold value, detecting whether the file number of the storage file reaches a preset number threshold value; and/or detecting whether the capacity of the storage file reaches a second preset capacity threshold value;
if the number of the files of the storage file reaches a preset number threshold value; and/or when the capacity of the storage file reaches a second preset capacity threshold, acquiring a timestamp of the storage file;
determining a target file with a previous timestamp;
and clearing the target file.
In the foregoing embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
The log information writing method, the log information writing system, the log information writing storage medium and the mobile terminal provided by the embodiment of the application are described in detail, a specific example is applied in the description to explain the principle and the implementation of the application, and the description of the embodiment is only used for helping to understand the technical scheme and the core idea of the application; those of ordinary skill in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications or substitutions do not depart from the spirit and scope of the present disclosure as defined by the appended claims.

Claims (10)

1. A log information writing method, comprising:
receiving a starting instruction;
responding to the starting instruction to establish an information transmission pipeline;
triggering a first thread to call a log tool to obtain log information, and writing the log information into the information transmission pipeline;
and acquiring the log information written into the information transmission pipeline, and writing the log information into a storage file of a second thread.
2. The method according to claim 1, wherein the obtaining the log information written into the information transmission pipeline and writing the log information into a storage file of a second thread comprises:
triggering a second thread to create a storage file and acquiring a transmission rule of the information transmission pipeline;
acquiring first target information written into the information transmission pipeline;
and writing the first target information into the storage file according to the transmission rule.
3. The log information writing method according to claim 2, further comprising, after the writing of the first target information into the storage file according to the transmission rule:
detecting whether the first target information reaches a first preset capacity threshold of a storage file;
and if the first target information does not reach the first preset capacity threshold value, writing the second target information acquired from the information transmission pipeline into the storage file.
4. The log information writing method according to claim 2, further comprising, after the writing of the first target information into the storage file according to the transmission rule:
detecting whether the first target information reaches a first preset capacity threshold of a storage file;
if the first target information is detected to reach the first preset capacity threshold, detecting whether the file quantity of the storage files reaches a preset quantity threshold; and/or detecting whether the storage capacity of the storage file reaches a second preset capacity threshold value;
if the file quantity of the storage files does not reach a preset quantity threshold value; and/or if the storage capacity of the storage file does not reach a second preset capacity threshold value, continuing to create the storage file.
5. The log information writing method according to claim 3, wherein the storage file carries a timestamp for generating the storage file, and after the log information is written into the storage file, the method further comprises:
if the log information written into the storage file is detected to reach a first preset capacity threshold value, detecting whether the file number of the storage file reaches a preset number threshold value; and/or detecting whether the capacity of the storage file reaches a second preset capacity threshold value;
if the number of the files of the storage file reaches a preset number threshold value; and/or when the capacity of the storage file reaches a second preset capacity threshold, acquiring a timestamp of the storage file;
determining a target file with a previous timestamp;
and clearing the target file.
6. A log information writing system applied to a mobile terminal, comprising:
the receiving module is used for receiving a starting instruction;
the creating module is used for responding to the starting instruction to create an information transmission pipeline;
the trigger module is used for triggering a first thread to call a log tool to obtain log information and writing the log information into the information transmission pipeline;
and the writing module is used for acquiring the log information written into the information transmission pipeline and writing the log information into a storage file of a second thread.
7. The log information writing system of claim 6, the writing module, comprising:
the first obtaining submodule is used for triggering a second thread to create a storage file and obtaining a transmission rule of the information transmission pipeline;
the second acquisition submodule is used for acquiring the first target information written into the information transmission pipeline;
and the first writing sub-module is used for writing the first target information into the storage file according to the transmission rule.
8. The log information writing system of claim 7, the writing module further comprising:
the detection submodule is used for detecting whether the first target information reaches a first preset capacity threshold of a storage file;
and the second writing sub-module is used for writing the second target information acquired from the information transmission pipeline into the storage file if the first target information does not reach the first preset capacity threshold.
9. A storage medium having stored therein a computer program which, when run on a computer, causes the computer to execute the log information writing method according to any one of claims 1 to 5.
10. A mobile terminal characterized in that the mobile terminal comprises a processor and a memory, the memory having stored therein a computer program, the processor being configured to execute the log information writing method according to any one of claims 1 to 5 by calling the computer program stored in the memory.
CN201910935405.7A 2019-09-29 2019-09-29 Log information writing method, system, storage medium and mobile terminal Pending CN110716908A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910935405.7A CN110716908A (en) 2019-09-29 2019-09-29 Log information writing method, system, storage medium and mobile terminal

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910935405.7A CN110716908A (en) 2019-09-29 2019-09-29 Log information writing method, system, storage medium and mobile terminal

Publications (1)

Publication Number Publication Date
CN110716908A true CN110716908A (en) 2020-01-21

Family

ID=69211150

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910935405.7A Pending CN110716908A (en) 2019-09-29 2019-09-29 Log information writing method, system, storage medium and mobile terminal

Country Status (1)

Country Link
CN (1) CN110716908A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112732665A (en) * 2021-01-04 2021-04-30 歌尔股份有限公司 Log processing method, system and storage medium based on Linux platform

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103927338A (en) * 2014-03-26 2014-07-16 网神信息技术(北京)股份有限公司 Log information storage processing method and log information storage processing device
CN105224444A (en) * 2015-10-14 2016-01-06 深圳市金证科技股份有限公司 Daily record generation method and device
KR101619482B1 (en) * 2014-12-22 2016-05-10 (주)케이사인 Audit log storage system
CN105843852A (en) * 2016-03-16 2016-08-10 汉柏科技有限公司 Log storage management method and system
CN106202307A (en) * 2016-07-01 2016-12-07 百势软件(北京)有限公司 A kind of batch log preservation method and device
CN107590162A (en) * 2016-07-08 2018-01-16 中兴通讯股份有限公司 The storage method and device of journal file
CN107798099A (en) * 2017-10-27 2018-03-13 努比亚技术有限公司 A kind of log information grasping means, terminal and computer-readable recording medium
CN108052675A (en) * 2017-12-28 2018-05-18 惠州Tcl家电集团有限公司 Blog management method, system and computer readable storage medium
CN108132955A (en) * 2016-12-01 2018-06-08 中移(苏州)软件技术有限公司 A kind of log storing method and device
CN108287777A (en) * 2017-12-27 2018-07-17 山东浪潮通软信息科技有限公司 A kind of method and device of record log
CN108388478A (en) * 2018-02-07 2018-08-10 平安普惠企业管理有限公司 Daily record data processing method and system
CN109002547A (en) * 2018-07-30 2018-12-14 努比亚技术有限公司 Journal file storage method, mobile terminal and computer readable storage medium
CN109241180A (en) * 2018-08-01 2019-01-18 福建天泉教育科技有限公司 A kind of method and device that the data based on log are synchronous
CN109344137A (en) * 2018-10-09 2019-02-15 广东网安科技有限公司 A kind of log storing method and system
CN109446173A (en) * 2018-09-18 2019-03-08 平安科技(深圳)有限公司 Daily record data processing method, device, computer equipment and storage medium

Patent Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103927338A (en) * 2014-03-26 2014-07-16 网神信息技术(北京)股份有限公司 Log information storage processing method and log information storage processing device
KR101619482B1 (en) * 2014-12-22 2016-05-10 (주)케이사인 Audit log storage system
CN105224444A (en) * 2015-10-14 2016-01-06 深圳市金证科技股份有限公司 Daily record generation method and device
CN105843852A (en) * 2016-03-16 2016-08-10 汉柏科技有限公司 Log storage management method and system
CN106202307A (en) * 2016-07-01 2016-12-07 百势软件(北京)有限公司 A kind of batch log preservation method and device
CN107590162A (en) * 2016-07-08 2018-01-16 中兴通讯股份有限公司 The storage method and device of journal file
CN108132955A (en) * 2016-12-01 2018-06-08 中移(苏州)软件技术有限公司 A kind of log storing method and device
CN107798099A (en) * 2017-10-27 2018-03-13 努比亚技术有限公司 A kind of log information grasping means, terminal and computer-readable recording medium
CN108287777A (en) * 2017-12-27 2018-07-17 山东浪潮通软信息科技有限公司 A kind of method and device of record log
CN108052675A (en) * 2017-12-28 2018-05-18 惠州Tcl家电集团有限公司 Blog management method, system and computer readable storage medium
CN108388478A (en) * 2018-02-07 2018-08-10 平安普惠企业管理有限公司 Daily record data processing method and system
CN109002547A (en) * 2018-07-30 2018-12-14 努比亚技术有限公司 Journal file storage method, mobile terminal and computer readable storage medium
CN109241180A (en) * 2018-08-01 2019-01-18 福建天泉教育科技有限公司 A kind of method and device that the data based on log are synchronous
CN109446173A (en) * 2018-09-18 2019-03-08 平安科技(深圳)有限公司 Daily record data processing method, device, computer equipment and storage medium
CN109344137A (en) * 2018-10-09 2019-02-15 广东网安科技有限公司 A kind of log storing method and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112732665A (en) * 2021-01-04 2021-04-30 歌尔股份有限公司 Log processing method, system and storage medium based on Linux platform

Similar Documents

Publication Publication Date Title
CN106502906B (en) A kind of method and apparatus of test application program
CN106502703B (en) Function calling method and device
CN110765085A (en) Log information writing method, system, storage medium and mobile terminal
CN110837343B (en) Snapshot processing method and device and terminal
CN111723002A (en) Code debugging method and device, electronic equipment and storage medium
CN105847325A (en) Method and device for debugging application client side
CN111078523A (en) Log obtaining method and device, storage medium and electronic equipment
CN110413497B (en) Abnormality monitoring method, abnormality monitoring device, terminal device and computer-readable storage medium
CN111273955A (en) Thermal restoration plug-in optimization method and device, storage medium and electronic equipment
CN107832191B (en) Black screen detection method, mobile terminal and computer readable storage medium
CN106709330B (en) Method and device for recording file execution behaviors
CN110716908A (en) Log information writing method, system, storage medium and mobile terminal
CN111045737A (en) Equipment identifier acquisition method and device, terminal equipment and storage medium
CN111026457A (en) Hardware configuration method and device, storage medium and terminal equipment
CN110716158B (en) Detection method, system, storage medium and mobile terminal
CN111182153B (en) System language setting method and device, storage medium and mobile terminal
CN115348256A (en) Posting data downloading method and device, storage medium and electronic equipment
CN111045742A (en) Card changing method and device of terminal equipment, storage medium and terminal equipment
CN108280798B (en) Method and device for rendering and displaying browser kernel
CN111601036B (en) Camera focusing method and device, storage medium and mobile terminal
CN105988801B (en) Method and device for displaying annotation information
CN110708746B (en) Communication control method, communication control device, storage medium and mobile terminal
CN112416584B (en) Process communication method and device, storage medium and mobile terminal
CN111443938B (en) System updating method and device, storage medium and mobile terminal
CN112114988B (en) Client starting method, device, terminal and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200121