CN109002547B - Log file storage method, mobile terminal and computer readable storage medium - Google Patents

Log file storage method, mobile terminal and computer readable storage medium Download PDF

Info

Publication number
CN109002547B
CN109002547B CN201810852673.8A CN201810852673A CN109002547B CN 109002547 B CN109002547 B CN 109002547B CN 201810852673 A CN201810852673 A CN 201810852673A CN 109002547 B CN109002547 B CN 109002547B
Authority
CN
China
Prior art keywords
partition
log
storage
file
mounting
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.)
Active
Application number
CN201810852673.8A
Other languages
Chinese (zh)
Other versions
CN109002547A (en
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.)
Nubia Technology Co Ltd
Original Assignee
Nubia Technology 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 Nubia Technology Co Ltd filed Critical Nubia Technology Co Ltd
Priority to CN201810852673.8A priority Critical patent/CN109002547B/en
Publication of CN109002547A publication Critical patent/CN109002547A/en
Application granted granted Critical
Publication of CN109002547B publication Critical patent/CN109002547B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention discloses a log file storage method, a mobile terminal and a computer readable storage medium, wherein the method comprises the following steps: sequentially downloading the corresponding compiled partition images to the storage space according to the initial configuration partition table file to form each partition, and generating a partition mounting script, wherein each formed partition comprises a log storage partition; when the system is started, analyzing the partition mounting script, obtaining partition information of a log storage partition, and mounting the log storage partition according to the partition information; and after the system is started, reading the log files at each preset node in real time, and storing the read log files into the log storage partition. The invention can effectively save the log file in the test process, reduce the problem analysis difficulty and improve the test efficiency.

Description

Log file storage method, mobile terminal and computer readable storage medium
Technical Field
The present invention relates to the field of mobile terminals, and in particular, to a log file storage method, a mobile terminal, and a computer readable storage medium.
Background
In the development process of the mobile terminal, a developer is required to perform various tests on the mobile terminal, and the mobile terminal is only sold to a user after passing through the various tests. The testing of the mobile terminal comprises a Monkey test, a switching-on and switching-off test, a factory setting pressure recovery test, a stability test and the like, and when a developer finds problems in the process of performing the Monkey test, the switching-on and switching-off test, the factory setting pressure recovery test and the stability test on the mobile terminal, the developer needs to check the problems when the mobile terminal cannot enter a desktop.
However, in the process of performing a Monkey test, a startup and shutdown test, a factory setting pressure test and a stability test on the mobile terminal, the mobile terminal cannot effectively save log files, a developer needs to perform a large number of tests, and a large amount of time is consumed to analyze and obtain reasons for problems, so that the problem analysis difficulty is high and the test efficiency is low.
Therefore, how to effectively save the log file in the test process, reduce the problem analysis difficulty and improve the test efficiency is a problem to be solved at present.
Disclosure of Invention
The invention mainly aims to provide a log file storage method, a mobile terminal and a computer readable storage medium, which aim to effectively save log files in a test process, reduce problem analysis difficulty and improve test efficiency.
In order to achieve the above object, the present invention provides a log file storage method, comprising the steps of:
sequentially downloading the corresponding compiled partition images to the storage space according to the initial configuration partition table file to form each partition, and generating a partition mounting script, wherein each formed partition comprises a log storage partition;
when the system is started, analyzing the partition mounting script, obtaining partition information of a log storage partition, and mounting the log storage partition according to the partition information;
and after the system is started, reading the log files at each preset node in real time, and storing the read log files into the log storage partition.
Optionally, the step of generating the partition mounted script includes:
after forming each partition, obtaining partition information of each partition, and generating a partition mounting script according to the partition information of each partition.
Optionally, after the step of analyzing the partition mounting script to obtain partition information of the log storage partition and mounting the log storage partition according to the partition information, the method further includes:
continuing to analyze the partition mounting script, determining the mounting sequence of each partition except the log storage partition, and acquiring partition information of each partition except the log storage partition;
And sequentially mounting all the partitions except the log storage partition according to the mounting sequence and partition information of all the partitions except the log storage partition.
Optionally, after the step of storing the read log file in the log storage partition, the method further includes:
monitoring whether the available storage capacity of the log storage partition is lower than a preset storage capacity or not at intervals of preset time;
and if the available storage capacity of the log storage partition is monitored to be lower than the preset storage capacity, performing redundancy elimination operation on the log files in the log storage partition.
Optionally, the log file storage method further includes:
receiving an input configuration partition table file of a log storage partition, and reading a first mounting directory of the log storage partition from the configuration partition table file;
reading a second mount directory of a log storage partition from the initial configuration partition table file, and determining whether the first mount directory is identical to the second mount directory;
and if the first mounting catalog is the same as the second mounting catalog, deleting the log storage partition, and downloading the corresponding compiled partition mirror image to a storage space according to the configuration partition table file so as to reform a log storage partition.
Optionally, after the step of determining whether the first mount directory is the same as the second mount directory, the method further includes:
and if the first mounting catalog is different from the second mounting catalog, downloading the corresponding compiled partition mirror image to a storage space according to the configuration partition table file so as to form a new log storage partition.
Optionally, the log file storage method further includes:
when the log files at each preset node are read, determining whether the available storage capacity of the log storage partition is lower than a preset threshold value;
and if the available storage capacity of the log storage partition is lower than a preset threshold value, storing the read log files at each preset node to the new log storage partition.
Optionally, after the step of storing the read log file at each preset node in the new log storage partition, the method further includes:
monitoring whether the available storage capacity of the new log storage partition is lower than a preset threshold;
and if the available storage capacity of the new log storage partition is monitored to be lower than a preset threshold value, performing redundancy elimination operation on the log files in the log storage partition and the new log storage partition.
In addition, to achieve the above object, the present invention also provides a mobile terminal including: the system comprises a memory, a processor and a log file storage program stored on the memory and capable of running on the processor, wherein the log file storage program realizes the steps of the log file storage method when being executed by the processor.
The present invention also provides a computer-readable storage medium, wherein a log file storage program is stored on the computer-readable storage medium, the log file storage program implementing the steps of the log file storage method described above when executed by a processor.
The invention provides a log file storage method, a mobile terminal and a computer readable storage medium, which sequentially downloads corresponding compiled partition images to a storage space according to an initial configuration partition table file to form each partition, wherein each formed partition comprises a log storage partition, a partition mounting script is generated, then the partition mounting script is analyzed when a system is started, partition information of the log storage partition is obtained, the log storage partition is mounted according to the partition information, finally after the system is started, log files at preset nodes are read in real time, and the read log files are stored in the log storage partition.
Drawings
Fig. 1 is a schematic diagram of a hardware structure of a mobile terminal implementing various embodiments of the present invention;
fig. 2 is a schematic diagram of a communication network system according to an embodiment of the present invention;
FIG. 3 is a flowchart illustrating a log file storing method according to a first embodiment of the present invention;
FIG. 4 is a flowchart of a log file storing method according to a second embodiment of the present invention;
fig. 5 is a flowchart of a third embodiment of the log file storing method according to the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
In the following description, suffixes such as "module", "component", or "unit" for representing elements are used only for facilitating the description of the present invention, and have no specific meaning per se. Thus, "module," "component," or "unit" may be used in combination.
The terminal may be implemented in various forms. For example, the terminals described in the present invention may include mobile terminals such as cell phones, tablet computers, notebook computers, palm computers, personal digital assistants (Personal Digital Assistant, PDA), portable media players (Portable Media Player, PMP), navigation devices, wearable devices, smart bracelets, pedometers, and fixed terminals such as digital TVs, desktop computers, and the like.
The following description will be given taking a mobile terminal as an example, and those skilled in the art will understand that the configuration according to the embodiment of the present invention can be applied to a fixed type terminal in addition to elements particularly used for a moving purpose.
Referring to fig. 1, which is a schematic diagram of a hardware structure of a mobile terminal implementing various embodiments of the present invention, the mobile terminal 100 may include: an RF (Radio Frequency) unit 101, a WiFi module 102, an audio output unit 103, an a/V (audio/video) input unit 104, a sensor 105, a display unit 106, a user input unit 107, an interface unit 108, a memory 109, a processor 110, and a power supply 111. Those skilled in the art will appreciate that the mobile terminal structure shown in fig. 1 is not limiting of the mobile terminal and that the mobile terminal may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
The following describes the components of the mobile terminal in detail with reference to fig. 1:
the radio frequency unit 101 may be used for receiving and transmitting signals during the information receiving or communication process, specifically, after receiving downlink information of the base station, processing the downlink information by the processor 110; and, the uplink data is transmitted to the base station. Typically, the radio frequency unit 101 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. In addition, the radio frequency unit 101 may also communicate with networks and other devices via wireless communications. The wireless communication may use any communication standard or protocol, including but not limited to GSM (Global System of Mobile communication, global System for Mobile communications), GPRS (General Packet Radio Service ), CDMA2000 (Code Division Multiple Access, CDMA 2000), WCDMA (Wideband Code Division Multiple Access ), TD-SCDMA (Time Division-Synchronous Code Division Multiple Access, time Division synchronous code Division multiple Access), FDD-LTE (Frequency Division Duplexing-Long Term Evolution, frequency Division Duplex Long term evolution), and TDD-LTE (Time Division Duplexing-Long Term Evolution, time Division Duplex Long term evolution), etc.
WiFi belongs to a short-distance wireless transmission technology, and a mobile terminal can help a user to send and receive e-mails, browse web pages, access streaming media and the like through the WiFi module 102, so that wireless broadband Internet access is provided for the user. Although fig. 1 shows a WiFi module 102, it is understood that it does not belong to the necessary constitution of a mobile terminal, and can be omitted entirely as required within a range that does not change the essence of the invention.
The audio output unit 103 may convert audio data received by the radio frequency unit 101 or the WiFi module 102 or stored in the memory 109 into an audio signal and output as sound when the mobile terminal 100 is in a call signal reception mode, a talk mode, a recording mode, a voice recognition mode, a broadcast reception mode, or the like. Also, the audio output unit 103 may also provide audio output (e.g., a call signal reception sound, a message reception sound, etc.) related to a specific function performed by the mobile terminal 100. The audio output unit 103 may include a speaker, a buzzer, and the like.
The a/V input unit 104 is used to receive an audio or video signal. The a/V input unit 104 may include a graphics processor (Graphics Processing Unit, GPU) 1041 and a microphone 1042, the graphics processor 1041 processing image data of still pictures or video obtained by an image capturing device (e.g., a camera) in a video capturing mode or an image capturing mode. The processed image frames may be displayed on the display unit 106. The image frames processed by the graphics processor 1041 may be stored in the memory 109 (or other storage medium) or transmitted via the radio frequency unit 101 or the WiFi module 102. The microphone 1042 can receive sound (audio data) via the microphone 1042 in a phone call mode, a recording mode, a voice recognition mode, and the like, and can process such sound into audio data. The processed audio (voice) data may be converted into a format output that can be transmitted to the mobile communication base station via the radio frequency unit 101 in the case of a telephone call mode. The microphone 1042 may implement various types of noise cancellation (or suppression) algorithms to cancel (or suppress) noise or interference generated in the course of receiving and transmitting the audio signal.
The mobile terminal 100 also includes at least one sensor 105, such as a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel 1061 according to the brightness of ambient light, and the proximity sensor can turn off the display panel 1061 and/or the backlight when the mobile terminal 100 moves to the ear. As one of the motion sensors, the accelerometer sensor can detect the acceleration in all directions (generally three axes), and can detect the gravity and direction when stationary, and can be used for applications of recognizing the gesture of a mobile phone (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and knocking), and the like; as for other sensors such as fingerprint sensors, pressure sensors, iris sensors, molecular sensors, gyroscopes, barometers, hygrometers, thermometers, infrared sensors, etc. that may also be configured in the mobile phone, the detailed description thereof will be omitted.
The display unit 106 is used to display information input by a user or information provided to the user. The display unit 106 may include a display panel 1061, and the display panel 1061 may be configured in the form of a liquid crystal display (Liquid Crystal Display, LCD), an Organic Light-Emitting Diode (OLED), or the like.
The user input unit 107 may be used to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the mobile terminal. In particular, the user input unit 107 may include a touch panel 1071 and other input devices 1072. The touch panel 1071, also referred to as a touch screen, may collect touch operations thereon or thereabout by a user (e.g., operations of the user on the touch panel 1071 or thereabout by using any suitable object or accessory such as a finger, a stylus, etc.) and drive the corresponding connection device according to a predetermined program. The touch panel 1071 may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch azimuth of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch detection device, converts it into touch point coordinates, and sends the touch point coordinates to the processor 110, and can receive and execute commands sent from the processor 110. Further, the touch panel 1071 may be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. The user input unit 107 may include other input devices 1072 in addition to the touch panel 1071. In particular, other input devices 1072 may include, but are not limited to, one or more of a physical keyboard, function keys (e.g., volume control keys, switch keys, etc.), a trackball, mouse, joystick, etc., as specifically not limited herein.
Further, the touch panel 1071 may overlay the display panel 1061, and when the touch panel 1071 detects a touch operation thereon or thereabout, the touch panel 1071 is transferred to the processor 110 to determine the type of touch event, and then the processor 110 provides a corresponding visual output on the display panel 1061 according to the type of touch event. Although in fig. 1, the touch panel 1071 and the display panel 1061 are two independent components for implementing the input and output functions of the mobile terminal, in some embodiments, the touch panel 1071 may be integrated with the display panel 1061 to implement the input and output functions of the mobile terminal, which is not limited herein.
The interface unit 108 serves as an interface through which at least one external device can be connected with the mobile terminal 100. For example, the external devices may include a wired or wireless headset port, an external power (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 108 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the mobile terminal 100 or may be used to transmit data between the mobile terminal 100 and an external device.
Memory 109 may be used to store software programs as well as various data. The memory 109 may mainly include a storage program area that may store an operating system, application programs required for at least one function (such as a sound playing function, an image playing function, etc.), and a storage data area; the storage data area may store data (such as audio data, phonebook, etc.) created according to the use of the handset, etc. In addition, memory 109 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage device.
The processor 110 is a control center of the mobile terminal, connects various parts of the entire mobile terminal using various interfaces and lines, and performs various functions of the mobile terminal and processes data by running or executing software programs and/or modules stored in the memory 109 and calling data stored in the memory 109, thereby performing overall monitoring of the mobile terminal. Processor 110 may include one or more processing units; preferably, the processor 110 may integrate an application processor that primarily handles operating systems, user interfaces, applications, etc., with a modem processor that primarily handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 110.
The mobile terminal 100 may further include a power source 111 (e.g., a battery) for supplying power to the respective components, and preferably, the power source 111 may be logically connected to the processor 110 through a power management system, so as to perform functions of managing charging, discharging, and power consumption management through the power management system.
Although not shown in fig. 1, the mobile terminal 100 may further include a bluetooth module or the like, which is not described herein.
As shown in fig. 1, the memory 109, which is a computer storage medium, may include an operating system, a network communication module, a user interface module, and a log file storage program, and the processor 110 may be configured to call the log file storage program stored in the memory 109 and perform the steps of:
sequentially downloading the corresponding compiled partition images to the storage space according to the initial configuration partition table file to form each partition, and generating a partition mounting script, wherein each formed partition comprises a log storage partition;
when the system is started, analyzing the partition mounting script, obtaining partition information of a log storage partition, and mounting the log storage partition according to the partition information;
and after the system is started, reading the log files at each preset node in real time, and storing the read log files into the log storage partition.
Further, the processor 110 may be configured to call a log file storage program stored in the memory 109, and further perform the following steps:
after forming each partition, obtaining partition information of each partition, and generating a partition mounting script according to the partition information of each partition.
Further, the processor 110 may be configured to call a log file storage program stored in the memory 109, and further perform the following steps:
continuing to analyze the partition mounting script, determining the mounting sequence of each partition except the log storage partition, and acquiring partition information of each partition except the log storage partition;
and sequentially mounting all the partitions except the log storage partition according to the mounting sequence and partition information of all the partitions except the log storage partition.
Further, the processor 110 may be configured to call a log file storage program stored in the memory 109, and further perform the following steps:
monitoring whether the available storage capacity of the log storage partition is lower than a preset storage capacity or not at intervals of preset time;
and if the available storage capacity of the log storage partition is monitored to be lower than the preset storage capacity, performing redundancy elimination operation on the log files in the log storage partition.
Further, the processor 110 may be configured to call a log file storage program stored in the memory 109, and further perform the following steps:
receiving an input configuration partition table file of a log storage partition, and reading a first mounting directory of the log storage partition from the configuration partition table file;
reading a second mount directory of a log storage partition from the initial configuration partition table file, and determining whether the first mount directory is identical to the second mount directory;
and if the first mounting catalog is the same as the second mounting catalog, deleting the log storage partition, and downloading the corresponding compiled partition mirror image to a storage space according to the configuration partition table file so as to reform a log storage partition.
Further, the processor 110 may be configured to call a log file storage program stored in the memory 109, and further perform the following steps:
and if the first mounting catalog is different from the second mounting catalog, downloading the corresponding compiled partition mirror image to a storage space according to the configuration partition table file so as to form a new log storage partition.
Further, the processor 110 may be configured to call a log file storage program stored in the memory 109, and further perform the following steps:
When the log files at each preset node are read, determining whether the available storage capacity of the log storage partition is lower than a preset threshold value;
and if the available storage capacity of the log storage partition is lower than a preset threshold value, storing the read log files at each preset node to the new log storage partition.
Further, the processor 110 may be configured to call a log file storage program stored in the memory 109, and further perform the following steps:
monitoring whether the available storage capacity of the new log storage partition is lower than a preset threshold;
and if the available storage capacity of the new log storage partition is monitored to be lower than a preset threshold value, performing redundancy elimination operation on the log files in the log storage partition and the new log storage partition.
In order to facilitate understanding of the embodiments of the present invention, a communication network system on which the mobile terminal of the present invention is based will be described below.
Referring to fig. 2, fig. 2 is a schematic diagram of a communication network system according to an embodiment of the present invention, where the communication network system is an LTE system of a general mobile communication technology, and the LTE system includes a UE (User Equipment) 201, an e-UTRAN (Evolved UMTS Terrestrial Radio Access Network ) 202, an epc (Evolved Packet Core, evolved packet core) 203, and an IP service 204 of an operator that are sequentially connected in communication.
Specifically, the UE201 may be the terminal 100 described above, and will not be described herein.
The E-UTRAN202 includes eNodeB2021 and other eNodeB2022, etc. The eNodeB2021 may be connected with other eNodeB2022 by a backhaul (e.g., an X2 interface), the eNodeB2021 is connected to the EPC203, and the eNodeB2021 may provide access from the UE201 to the EPC 203.
EPC203 may include MME (Mobility Management Entity ) 2031, hss (Home Subscriber Server, home subscriber server) 2032, other MMEs 2033, SGW (Serving Gate Way) 2034, pgw (PDN Gate Way) 2035 and PCRF (Policy and Charging Rules Function, policy and tariff function entity) 2036, and so on. The MME2031 is a control node that handles signaling between the UE201 and EPC203, providing bearer and connection management. HSS2032 is used to provide registers to manage functions such as home location registers (not shown) and to hold user specific information about service characteristics, data rates, etc. All user data may be sent through SGW2034 and PGW2035 may provide IP address allocation and other functions for UE201, PCRF2036 is a policy and charging control policy decision point for traffic data flows and IP bearer resources, which selects and provides available policy and charging control decisions for a policy and charging enforcement function (not shown).
IP services 204 may include the internet, intranets, IMS (IP Multimedia Subsystem ), or other IP services, etc.
Although the LTE system is described above as an example, it should be understood by those skilled in the art that the present invention is not limited to LTE systems, but may be applied to other wireless communication systems, such as GSM, CDMA2000, WCDMA, TD-SCDMA, and future new network systems.
Based on the above-mentioned mobile terminal hardware structure and communication network system, various embodiments of the log file storage method of the present invention are proposed.
Referring to fig. 3, fig. 3 is a flowchart illustrating a first embodiment of a log file storing method according to the present invention;
in this embodiment, the log file storage method includes:
step S101, sequentially downloading corresponding compiled partition images to a storage space according to an initial configuration partition table file to form partitions and generating partition mounting scripts, wherein each formed partition comprises a log storage partition;
the log file storage method is applied to a mobile terminal, and can be selected as a mobile terminal shown in fig. 1, an operating system of the mobile terminal is an android system, mirror image files of corresponding partitions are required to be prefabricated aiming at the mobile terminal adopting the android operating system, and an initial configuration partition table file, namely a partition. The initial configuration partition table file is configured by a developer and is used for performing partition configuration on a memory of the mobile terminal. The partition.xml table contains a plurality of partition entries, especially contains log storage partition entries, each entry corresponds to a partition, and the partition entries include a file name, a file size and file attribute information corresponding to each partition. Wherein each partition includes, but is not limited to, ramdisk. Img (root file image), system. Img (system image), userdata. Img (user data image), bootloader partition, boot partition, system partition, userdata partition, and log storage partition. Wherein ramdisk.img is the root file system, system.img includes the main package, library, etc. files, userdata.img includes some user data. Taking the three image files as an example, after the android system loads the 3 image files, the system and userdata are respectively loaded under the system and data directory in the ramdisk file system.
Since the system. Img and userdata. Img are constructed in the form of Ext4 (fourth generation extended file system), according to standard specifications, the image constructed in the form of Ext4 needs to be specified in advance, so that in the image loading process, all data contained in the image of the partition is loaded into the mount directory of the partition according to the specified image size, in the prior art, the size of the image file determines the size of the partition, and meanwhile, the ordering of the partitions corresponds to the ordering sequence of the corresponding entries of each partition in the configuration partition table file.
In this embodiment, when the tool is used for full-erase downloading, the mobile terminal sequentially downloads the corresponding compiled partition images to the storage space according to the initial configuration partition table file to form each partition, that is, sequentially writes the compiled partition images corresponding to each partition entry into the memory from the head of the memory of the mobile terminal according to the initial configuration partition table, sequentially forms each partition, each formed partition includes a log storage partition, then generates a partition mounting script, specifically, acquires partition information of each partition, and generates the partition mounting script according to the partition information of each partition, so as to record partition information of each partition. Wherein the log storage partition is first mounted, the partition information including, but not limited to, mount directory, partition path, partition type, and partition size. It should be noted that, the size of the log storage partition may be adjusted by a developer based on actual situations.
Step S102, when the system is started, analyzing a partition mounting script, acquiring partition information of a log storage partition, and mounting the log storage partition according to the partition information;
in this embodiment, when the mobile terminal starts up the system, according to the starting sequence of the android system, the bootloader is started and then the Linux kernel is called, at this time, the android system starts to be started, the late_init service is executed, the trigger_fs is triggered, the mount_all fstab.qcom command is executed, the partition information of the log storage partition is firstly obtained, the log storage partition is mounted according to the partition information, namely, the mount directory and the partition path are read from the partition information, the corresponding mirror image file is obtained, and then the partition where the mirror image file is located is mounted on the corresponding directory according to the mount directory and the partition path, so that the user can access the log storage partition by accessing the directory.
Further, after step S102, the method further includes:
step a, continuing to analyze the partition mounting script, determining the mounting sequence of each partition except the log storage partition, and acquiring partition information of each partition except the log storage partition;
in this embodiment, after the log storage partition is mounted, the mobile terminal continues to analyze the partition mounting script, determines the mounting order of each partition except the log storage partition, that is, queries a mapping relation table between the partition names and the mounting order in the partition mounting script, obtains the corresponding mounting order of each partition except the log storage partition, and obtains partition information of each partition except the log storage partition. Note that, the mounting order is set by a developer based on actual conditions, and this embodiment is not particularly limited.
And b, sequentially mounting all the partitions except the log storage partition according to the mounting sequence and partition information of all the partitions except the log storage partition.
In this embodiment, the mobile terminal sequentially mounts each partition except the log storage partition according to the mounting order and partition information of each partition except the log storage partition, where the mounting order of each partition is not necessarily the same as the order in the memory, for example, the position of the partition a in the memory is before the partition B, but the actual mounting order may be after the partition B is mounted. The location of the memory and the start and stop addresses of each partition are already preset by the developer at the time of shipment. The partition mounting script records information of each partition, including path information of mounting points of each partition, partition type and partition size. The mounting sequence after starting up does not influence the partition position distribution. And each partition except the log storage partition is sequentially mounted according to a certain mounting sequence, so that the mounting speed of each partition can be effectively improved, and the waiting time of a system is reduced.
Step S103, after the system is started, the log files at all preset nodes are read in real time, and the read log files are stored in the log storage partition.
In this embodiment, after the system is started, that is, the boot_commanded attribute in the starting process is set to 1, a log grabbing service is triggered to be started, that is, a daemon is created, log files at each preset node are read in real time, and the read log files are stored in a log storage partition, wherein the preset nodes include, but are not limited to, logcat, kernel, ps, dmesg, kmsg, events and mount, and the log files include, but are not limited to, a location log, a kernel log, a ps log, a dmesg log, a kmsg log, events log and mount log.
In this embodiment, the method sequentially downloads the corresponding compiled partition images to the storage space according to the initial configuration partition table file to form each partition, each formed partition comprises a log storage partition, a partition mounting script is generated, then when the system is started, the partition mounting script is analyzed, partition information of the log storage partition is obtained, the log storage partition is mounted according to the partition information, finally, after the system is started, log files at each preset node are read in real time, and the read log files are stored in the log storage partition, and because the log storage partition is firstly mounted in the starting process and the log files are stored in the log storage partition in real time, the log files in the testing process can be effectively stored, so that when problems occur in the testing process, developers can quickly locate the reasons of the problems based on the log files in the log storage partition, the problem analysis difficulty is effectively reduced, and the testing efficiency is improved.
Further, referring to fig. 4, a second embodiment of the log file storing method according to the present invention is proposed based on the foregoing embodiment, and is different from the foregoing embodiment in that, after step S103, the method further includes:
step S104, monitoring whether the available storage capacity of the log storage partition is lower than the preset storage capacity or not at intervals of preset time;
in this embodiment, after the mobile terminal stores the read log file in the log storage partition, it monitors, at intervals of a preset time, whether the available storage capacity of the log storage partition is lower than the preset storage capacity, that is, whether the available storage capacity of the log storage partition is sufficient. It should be noted that the above-mentioned preset time may be set by those skilled in the art based on practical situations, and this embodiment is not limited in particular.
Step S105, if the available storage capacity of the log storage partition is lower than the preset storage capacity, performing redundancy elimination operation on the log files in the log storage partition.
In this embodiment, if it is monitored that the available storage capacity of the log storage partition is lower than the preset storage capacity, the mobile terminal performs redundancy removal operation on the log files in the log storage partition, that is, divides the log files in the log storage partition into a plurality of log file groups (the types of the log files in the same log file group are the same, the types of the log files in different log file groups are different) according to the types of the log files, reads the labels of the log files in each log file group, merges the log files with the same label in the same log file group into one log file, correspondingly records the number of the log files contained in the one log file, then deletes the merged other log files, and only retains one log file.
For example, 1000 log files in a log file group, wherein in the 1000 logs, the labels of 520 logs are A labels, the labels of 360 logs are B labels, the labels of 120 logs are C labels, one log of A labels is stored, the logs of the other 519 logs of A labels are deleted, and the number of the logs of A labels is recorded to be 520; storing a log of B labels, deleting the rest 359 logs of B labels, and recording the number of the logs of B labels as 360; one log of C-tags is stored, the remaining 119 logs of C-tags are deleted, and the number of logs of C-tags is recorded as 120.
In this embodiment, when the storage capacity of the log storage partition is lower than the preset storage capacity, redundancy removal operation is performed on the log files in the log storage partition, so that the utilization rate of the log storage partition is improved.
Further, referring to fig. 5, based on the first or second embodiment described above, a third embodiment of the log file storing method of the present invention is proposed, which is different from the previous embodiment in that the log file storing method further includes:
step S106, receiving an input configuration partition table file of the log storage partition, and reading a first mounting catalog of the log storage partition from the configuration partition table file;
In this embodiment, when a developer needs to adjust a log storage partition, a configuration partition table file of the log storage partition is input into a mobile terminal, the mobile terminal receives the input configuration partition table file of the log storage partition, and reads a first mount directory of the log storage partition from the configuration partition table file.
Step S107, reading the second mount catalog of the log storage partition from the initial configuration partition table file, and determining whether the first mount catalog is identical to the second mount catalog;
step S108, if the first mount catalog is the same as the second mount catalog, deleting the log storage partition, and downloading the corresponding compiled partition image to the storage space according to the configuration partition table file to reform a log storage partition.
In this embodiment, the mobile terminal reads the second mount directory of the log storage partition from the initial configuration partition table file, determines whether the first mount directory is the same as the second mount directory, if so, deletes the log storage partition, downloads the corresponding compiled partition image to the storage space according to the configuration partition table file to reform a log storage partition, and if not, downloads the corresponding compiled partition image to the storage space according to the configuration partition table file to form a new log storage partition, i.e., two log storage partitions are formed in the memory of the mobile terminal.
In the embodiment, the invention can realize the adjustment of the log storage partition by configuring the partition table file, thereby being convenient for the developer to use.
Further, based on the above third embodiment, a third embodiment of the log file storing method of the present invention is proposed, which is different from the foregoing embodiment in that the log file storing method further includes:
step c, when the log files at each preset node are read, determining whether the available storage capacity of the log storage partition is lower than a preset threshold value;
in this embodiment, when the log file at each preset node is read, the mobile terminal determines whether the available storage capacity of the log storage partition is lower than a preset threshold, and if the available storage capacity of the log storage partition is higher than or equal to the preset threshold, stores the read log file at each preset node to the log storage partition.
And d, if the available storage capacity of the log storage partition is lower than a preset threshold value, storing the read log files at each preset node into a new log storage partition.
In this embodiment, if the available storage capacity of the log storage partition is lower than the preset threshold, the read log file at each preset node is stored to the new log storage partition. Further, whether the available storage capacity of the new log storage partition is lower than a preset threshold value is monitored, and if the available storage capacity of the new log storage partition is monitored to be lower than the preset threshold value, redundancy removing operation is carried out on the log storage partition and the log files in the new log storage partition.
In this embodiment, the mobile terminal is provided with two log storage partitions, so as to improve the log storage capacity, and in addition, when the storage capacities of the two log storage partitions are both lower than a preset threshold, redundancy removing operation is performed on the log files of the two log storage partitions, so that the utilization rate of the log storage partitions is improved.
In addition, an embodiment of the present invention also proposes a computer-readable storage medium having a log file storage program stored thereon, the log file storage program realizing the following steps when executed by a processor:
sequentially downloading the corresponding compiled partition images to the storage space according to the initial configuration partition table file to form each partition, and generating a partition mounting script, wherein each formed partition comprises a log storage partition;
when the system is started, analyzing the partition mounting script, obtaining partition information of a log storage partition, and mounting the log storage partition according to the partition information;
and after the system is started, reading the log files at each preset node in real time, and storing the read log files into the log storage partition.
Further, the log file storage program when executed by the processor further performs the steps of:
After forming each partition, obtaining partition information of each partition, and generating a partition mounting script according to the partition information of each partition.
Further, the log file storage program when executed by the processor further performs the steps of:
continuing to analyze the partition mounting script, determining the mounting sequence of each partition except the log storage partition, and acquiring partition information of each partition except the log storage partition;
and sequentially mounting all the partitions except the log storage partition according to the mounting sequence and partition information of all the partitions except the log storage partition.
Further, the log file storage program when executed by the processor further performs the steps of:
monitoring whether the available storage capacity of the log storage partition is lower than a preset storage capacity or not at intervals of preset time;
and if the available storage capacity of the log storage partition is monitored to be lower than the preset storage capacity, performing redundancy elimination operation on the log files in the log storage partition.
Further, the log file storage program when executed by the processor further performs the steps of:
receiving an input configuration partition table file of a log storage partition, and reading a first mounting directory of the log storage partition from the configuration partition table file;
Reading a second mount directory of a log storage partition from the initial configuration partition table file, and determining whether the first mount directory is identical to the second mount directory;
and if the first mounting catalog is the same as the second mounting catalog, deleting the log storage partition, and downloading the corresponding compiled partition mirror image to a storage space according to the configuration partition table file so as to reform a log storage partition.
Further, the log file storage program when executed by the processor further performs the steps of:
and if the first mounting catalog is different from the second mounting catalog, downloading the corresponding compiled partition mirror image to a storage space according to the configuration partition table file so as to form a new log storage partition.
Further, the log file storage program when executed by the processor further performs the steps of:
when the log files at each preset node are read, determining whether the available storage capacity of the log storage partition is lower than a preset threshold value;
and if the available storage capacity of the log storage partition is lower than a preset threshold value, storing the read log files at each preset node to the new log storage partition.
Further, the log file storage program when executed by the processor further performs the steps of:
monitoring whether the available storage capacity of the new log storage partition is lower than a preset threshold;
and if the available storage capacity of the new log storage partition is monitored to be lower than a preset threshold value, performing redundancy elimination operation on the log files in the log storage partition and the new log storage partition.
The specific embodiments of the computer readable storage medium of the present invention are substantially the same as the embodiments of the log file storage method described above, and will not be described herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising instructions for causing a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (8)

1. The log file storage method is applied to the mobile terminal and is characterized by comprising the following steps of:
sequentially downloading the corresponding compiled partition images to the storage space according to the initial configuration partition table file to form each partition, and generating a partition mounting script, wherein each formed partition comprises a log storage partition;
when the system is started, analyzing the partition mounting script, obtaining partition information of a log storage partition, and mounting the log storage partition according to the partition information;
after the system is started, reading log files at each preset node in real time, and storing the read log files into the log storage partition;
the method comprises the steps of analyzing the partition mounting script, obtaining partition information of a log storage partition, and mounting the log storage partition according to the partition information, and further comprises the following steps:
inquiring a mapping relation table between partition names and mounting sequences in the partition mounting script, acquiring corresponding mounting sequences of all partitions except the log storage partition, and acquiring partition information of all partitions except the log storage partition;
Sequentially mounting all the partitions except the log storage partition according to the mounting sequence and partition information of all the partitions except the log storage partition;
after the step of storing the read log file in the log storage partition, the method further includes:
monitoring whether the available storage capacity of the log storage partition is lower than a preset storage capacity or not at intervals of preset time;
if the available storage capacity of the log storage partition is monitored to be lower than the preset storage capacity, dividing the log files into a plurality of log file groups according to the types of the log files;
reading the labels of the log files in the log file group, and merging the log files with the same labels to obtain a merged log file;
and recording the number of the log files contained in the combined log file, and deleting other log files except the combined log file.
2. The log file storage method as set forth in claim 1, wherein the step of generating the partition mounted script comprises:
after forming each partition, obtaining partition information of each partition, and generating a partition mounting script according to the partition information of each partition.
3. The log file storing method according to any one of claims 1 or 2, characterized in that the log file storing method further comprises:
receiving an input configuration partition table file of a log storage partition, and reading a first mounting directory of the log storage partition from the configuration partition table file;
reading a second mount directory of a log storage partition from the initial configuration partition table file, and determining whether the first mount directory is identical to the second mount directory;
and if the first mounting catalog is the same as the second mounting catalog, deleting the log storage partition, and downloading the corresponding compiled partition mirror image to a storage space according to the configuration partition table file so as to reform a log storage partition.
4. The log file storing method according to claim 3, wherein after the step of determining whether said first mount directory is identical to said second mount directory, further comprising:
and if the first mounting catalog is different from the second mounting catalog, downloading the corresponding compiled partition mirror image to a storage space according to the configuration partition table file so as to form a new log storage partition.
5. The log file storing method as claimed in claim 4, wherein said log file storing method further comprises:
when the log files at each preset node are read, determining whether the available storage capacity of the log storage partition is lower than a preset threshold value;
and if the available storage capacity of the log storage partition is lower than a preset threshold value, storing the read log files at each preset node to the new log storage partition.
6. The log file storing method according to claim 5, wherein after the step of storing the read log file at each preset node to the new log storage partition, further comprising:
monitoring whether the available storage capacity of the new log storage partition is lower than a preset threshold;
and if the available storage capacity of the new log storage partition is monitored to be lower than a preset threshold value, performing redundancy elimination operation on the log files in the log storage partition and the new log storage partition.
7. A mobile terminal, the mobile terminal comprising: a memory, a processor and a log file storage program stored on the memory and executable on the processor, which when executed by the processor implements the steps of the log file storage method of any one of claims 1 to 6.
8. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a log file storage program which, when executed by a processor, implements the steps of the log file storage method according to any one of claims 1 to 6.
CN201810852673.8A 2018-07-30 2018-07-30 Log file storage method, mobile terminal and computer readable storage medium Active CN109002547B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810852673.8A CN109002547B (en) 2018-07-30 2018-07-30 Log file storage method, mobile terminal and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810852673.8A CN109002547B (en) 2018-07-30 2018-07-30 Log file storage method, mobile terminal and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN109002547A CN109002547A (en) 2018-12-14
CN109002547B true CN109002547B (en) 2023-09-01

Family

ID=64597408

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810852673.8A Active CN109002547B (en) 2018-07-30 2018-07-30 Log file storage method, mobile terminal and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN109002547B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110147291A (en) * 2019-03-29 2019-08-20 努比亚技术有限公司 Terminal and its log management-control method, computer readable storage medium
CN110716908A (en) * 2019-09-29 2020-01-21 捷开通讯(深圳)有限公司 Log information writing method, system, storage medium and mobile terminal
CN111198855B (en) * 2019-12-31 2023-07-25 深圳移航通信技术有限公司 Log data processing method and device
CN113704205B (en) * 2021-07-29 2022-09-23 荣耀终端有限公司 Log storage method, chip, electronic device and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106406768A (en) * 2016-09-28 2017-02-15 努比亚技术有限公司 Android system user data partitioning adjustment method and device
CN107276789A (en) * 2017-05-19 2017-10-20 努比亚技术有限公司 Daily record method for uploading, device and computer-readable recording medium
CN107798099A (en) * 2017-10-27 2018-03-13 努比亚技术有限公司 A kind of log information grasping means, terminal and computer-readable recording medium
CN107832191A (en) * 2017-10-31 2018-03-23 努比亚技术有限公司 Blank screen detection method, mobile terminal and computer-readable recording medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105389507B (en) * 2015-11-13 2018-12-25 小米科技有限责任公司 The method and device of monitoring system partitioned file

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106406768A (en) * 2016-09-28 2017-02-15 努比亚技术有限公司 Android system user data partitioning adjustment method and device
CN107276789A (en) * 2017-05-19 2017-10-20 努比亚技术有限公司 Daily record method for uploading, device and computer-readable recording medium
CN107798099A (en) * 2017-10-27 2018-03-13 努比亚技术有限公司 A kind of log information grasping means, terminal and computer-readable recording medium
CN107832191A (en) * 2017-10-31 2018-03-23 努比亚技术有限公司 Blank screen detection method, mobile terminal and computer-readable recording medium

Also Published As

Publication number Publication date
CN109002547A (en) 2018-12-14

Similar Documents

Publication Publication Date Title
US10635449B2 (en) Method and apparatus for running game client
CN107276789B (en) Log uploading method and device and computer readable storage medium
CN109002547B (en) Log file storage method, mobile terminal and computer readable storage medium
CN108040159B (en) Restart positioning method based on hardware drive, mobile terminal and readable storage medium
CN107357704B (en) Application program detection method, terminal and computer readable storage medium
CN108600516B (en) Data acquisition method, mobile terminal and computer readable storage medium
US9588757B2 (en) Data update method, user terminal, and data update system
CN109766119B (en) Recovery partition upgrade method, terminal and computer readable storage medium
CN109472157B (en) Application data storage method, mobile terminal and computer storage medium
US20220255639A1 (en) Radio frequency parameter processing method and device, and mobile terminal and storage medium
CN108121613B (en) Memory page-based restart positioning method, mobile terminal and readable storage medium
CN108012031B (en) Mobile terminal restart positioning method, mobile terminal and computer readable storage medium
CN112597115A (en) Container mirror image compression method and device, terminal equipment and medium
CN108196968B (en) Mobile terminal restart positioning method, mobile terminal and computer readable storage medium
US20160308879A1 (en) Application-Based Service Providing Method, Apparatus, and System
CN108052437B (en) Restart positioning method, mobile terminal and computer readable storage medium
CN108089937B (en) Direct memory allocation-based restart positioning method, mobile terminal and storage medium
CN108255631B (en) Mobile terminal restart positioning method, mobile terminal and computer readable storage medium
CN113039517B (en) Audio resource calling method and device and electronic equipment
CN110209434B (en) Memory management method and device and computer readable storage medium
CN109151081B (en) Production comprehensive testing method and device, intelligent terminal and readable storage medium
CN108228423B (en) Mobile terminal restart positioning method, mobile terminal and computer readable storage medium
CN108268335B (en) Restart positioning method based on system service, mobile terminal and storage medium
CN109062688B (en) Memory allocation method, server and mobile terminal
CN108076200B (en) Mobile terminal restart positioning method, mobile terminal and computer readable 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
GR01 Patent grant
GR01 Patent grant