CN109117339A - A kind of method and system that daily record data saves - Google Patents

A kind of method and system that daily record data saves Download PDF

Info

Publication number
CN109117339A
CN109117339A CN201710496297.9A CN201710496297A CN109117339A CN 109117339 A CN109117339 A CN 109117339A CN 201710496297 A CN201710496297 A CN 201710496297A CN 109117339 A CN109117339 A CN 109117339A
Authority
CN
China
Prior art keywords
daily record
record data
caching
stored
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
CN201710496297.9A
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201710496297.9A priority Critical patent/CN109117339A/en
Publication of CN109117339A publication Critical patent/CN109117339A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
    • G06F11/3096Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents wherein the means or processing minimize the use of computing system or of computing system component resources, e.g. non-intrusive monitoring which minimizes the probe effect: sniffing, intercepting, indirectly deriving the monitored data from other directly available data
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3003Monitoring arrangements specially adapted to the computing system or computing system component being monitored
    • G06F11/302Monitoring arrangements specially adapted to the computing system or computing system component being monitored where the computing system component is a software system
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3055Monitoring arrangements for monitoring the status of the computing system or of the computing system component, e.g. monitoring if the computing system is on, off, available, not available
    • 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
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2201/00Indexing scheme relating to error detection, to error correction, and to monitoring
    • G06F2201/865Monitoring of software

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Quality & Reliability (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses the method and systems that daily record data saves, and are related to field of computer technology.One specific embodiment of this method includes: to monitor the operating status of system main thread;The daily record data of system is cached;According to the operating status of the main thread of monitoring or caching critical value, judge whether to store the daily record data of caching.This embodiment avoids the main thread resources occupied when program is run, and reduces real-time file and save and the bereft problem of main thread resource caused by sub thread creation, improve program efficient operation, user will be preferably minimized using the influence of program, improves the preservation efficiency and safe coefficient of user journal.

Description

A kind of method and system that daily record data saves
Technical field
The present invention relates to the method and systems that field of computer technology more particularly to a kind of daily record data save.
Background technique
The program volume of raising with mobile subscriber to application demand, application is increasing, and programmed logic is also increasingly Complexity, tradition rely on one two programmer's maintenance applications, be gradually expanded to more than ten or tens place developer composition it is more A team safeguards jointly.Also, simple dependence developer, which carries out program development and optimization in simulated environment, to be become increasingly to be stranded Difficulty, and then need the truthful data of build environment, i.e., daily record data is saved.In the prior art, mainly in program The preservation of daily record data is carried out while operation, and directly stores daily record data in a hard disk.For example, for iOS system, By the NSLog function of iOS system, the log number comprising time and programmed logic node is generated while program operation According to being saved into hard drive space finally by file operation then by the macro realization code for redefining NSLog of Define.
In realizing process of the present invention, at least there are the following problems in the prior art for inventor's discovery:
Main thread resource when occupying program operation, real-time file saves and thread creation will cause main thread resource quilt It deprives, although hardware device resources promotion, which may be alleviated to save because of daily record data, occupies problem caused by resource, Still it will affect the operation of system program in performance.Also, the efficiency that daily record data saves is very low.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of method and system that daily record data saves, occupancy journey can be avoided It is bereft to reduce main thread resource caused by real-time file preservation and sub thread creation for main thread resource when sort run Problem improves program efficient operation, will be preferably minimized to user using the influence of program, improves the preservation effect of user journal Rate and safe coefficient.
To achieve the above object, according to an aspect of an embodiment of the present invention, a kind of side that daily record data saves is provided Method.
The method that a kind of daily record data of the embodiment of the present invention saves, comprising: the operating status of system main thread is carried out It monitors;The daily record data of system is cached;According to the operating status of the main thread of monitoring or caching critical value, judge whether The daily record data of caching is stored.
Optionally, the operating status of the main thread according to monitoring or caching critical value, judge whether the day that will be cached It includes: to judge whether the daily record data of the caching reaches caching critical value, or whether judge system that will data, which carry out storage, It interrupts, or judges whether the main thread enters suspend mode;If not having, the daily record data of caching is not deposited Storage;Otherwise, the daily record data of caching is stored.
Optionally, this method further include: before being stored the daily record data of caching, the daily record data is carried out Encryption;After judging to be stored the daily record data, the daily record data of the encryption is stored.
Optionally, this method further include: after being cached the daily record data of system, and in the log that will be cached Before data are stored, the daily record data is subjected to serializing operation.
Optionally, this method further include: before the daily record data of system is cached, setting caching critical value;And And before being stored the daily record data of caching, the root of storage position is specified;
Optionally, this method further include: after being cached the daily record data of system, define the daily record data General-purpose attribute, the general-purpose attribute comprise at least one of the following: log storing path, log index, stl status symbol, and log is closed Code file, function and the line number and log content of connection;Also, after the daily record data of caching is stored, definition Store path, title and the content of the journal file of the daily record data.
According to another aspect of an embodiment of the present invention, a kind of system that daily record data saves is provided.
The system that a kind of daily record data of the embodiment of the present invention saves, including module is monitored, for system main thread Operating status is monitored;Cache module, for caching the daily record data of system;Judge memory module, is used for basis The operating status or caching critical value of the main thread of monitoring, judge whether to store the daily record data of caching.
Optionally, described to judge that memory module judges whether the daily record data of the caching reaches caching critical value, or Judge whether system interrupts, or judges whether the main thread enters suspend mode;If not having, not by the log of caching Data are stored;Otherwise, the daily record data of caching is stored.
Optionally, the judgement memory module further include: encryption unit, for being stored by the daily record data of caching Before, the daily record data is encrypted;After judging to be stored the daily record data, memory module is judged The daily record data of the encryption is stored.
Optionally, the cache module further include: serialization unit, for cache module by the daily record data of system into After row caching, and before judging that memory module is stored the daily record data of caching, the daily record data is carried out Serializing operation.
Optionally, system further include: setup module caches it for carrying out the daily record data of system in cache module Before, setting caching critical value;And before judging that memory module is stored the daily record data of caching, storage position is specified The root set.
Optionally, the system further include: log properties module, for after the daily record data of system is cached, The general-purpose attribute of the daily record data is defined, the general-purpose attribute comprises at least one of the following: log storing path, log rope Draw, stl status symbol, the associated code file of log, function and line number and log content;Journal file module is used for After the daily record data of caching is stored in a hard disk, definition stores the path of the journal file of the daily record data, name Title and content.
It is according to an embodiment of the present invention in another aspect, providing a kind of electronic equipment.
The a kind of electronic equipment of the embodiment of the present invention, comprising: one or more processors;Storage device, for storing one A or multiple programs, when one or more of programs are executed by one or more of processors, so that one or more A processor realizes the method that daily record data described in any of the above embodiments saves.
It is according to an embodiment of the present invention in another aspect, providing computer-readable medium.
The computer-readable medium of the embodiment of the present invention, is stored thereon with computer program, which is characterized in that described program The method that daily record data described in any of the above embodiments saves is realized when being executed by processor.
One embodiment in foregoing invention has the following advantages that or the utility model has the advantages that by the operation shape to system main thread The monitoring of state judges whether then according to the operating status of the main thread of monitoring or caching critical value by buffered day Will data are stored.Because before storing, monitoring the operating status of main thread, and then can judge to store Optimal time.The creation and file that daily record data storage thread can be carried out when main thread resource enters dormant state save, Ensure program efficient operation, the influence that user uses will be preferably minimized, improves the preservation efficiency and safe journey of user journal Degree.In turn, it avoids and is completely dependent on programmed hardware to save performance present in the method for log and high problem is lost.
Further effect possessed by above-mentioned non-usual optional way adds hereinafter in conjunction with specific embodiment With explanation.
Detailed description of the invention
Attached drawing for a better understanding of the present invention, does not constitute an undue limitation on the present invention.Wherein:
Fig. 1 is that the embodiment of the present invention can be applied to exemplary system architecture figure therein;
Fig. 2 is the schematic diagram of the key step for the method that daily record data according to an embodiment of the present invention saves;
Fig. 3 is the flow chart for the method that daily record data according to an embodiment of the present invention saves;
Fig. 4 is the schematic diagram of the main modular for the device that daily record data according to an embodiment of the present invention saves;
Fig. 5 is adapted for the structural representation of the computer system for the terminal device or server of realizing the embodiment of the present invention Figure.
Specific embodiment
Below in conjunction with attached drawing, an exemplary embodiment of the present invention will be described, including the various of the embodiment of the present invention Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize It arrives, it can be with various changes and modifications are made to the embodiments described herein, without departing from scope and spirit of the present invention.Together Sample, for clarity and conciseness, descriptions of well-known functions and structures are omitted from the following description.
Fig. 1 shows the system that can be saved using the method or daily record data that the daily record data of the embodiment of the present invention saves Exemplary system architecture 100.
As shown in Figure 1, system architecture 100 may include terminal device 101,102,103, network 104 and server 105. Network 104 between terminal device 101,102,103 and server 105 to provide the medium of communication link.Network 104 can be with Including various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 101,102,103 and be interacted by network 104 with server 105, to receive or send out Send message etc..Various telecommunication customer end applications, such as the application of shopping class, net can be installed on terminal device 101,102,103 (merely illustrative) such as the application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform softwares.
Terminal device 101,102,103 can be the various electronic equipments with display screen and supported web page browsing, packet Include but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 105 can be to provide the server of various services, such as utilize terminal device 101,102,103 to user The shopping class website browsed provides the back-stage management server (merely illustrative) supported.Back-stage management server can be to reception To the data such as information query request analyze etc. processing, and by processing result (such as target push information, product letter Breath -- merely illustrative) feed back to terminal device.
It should be noted that the method that daily record data provided by the embodiment of the present invention saves generally is held by server 105 Row, correspondingly, the device that daily record data saves are generally positioned in server 105.
It should be understood that the number of terminal device, network and server in Fig. 1 is only schematical.According to realization need It wants, can have any number of terminal device, network and server.
Fig. 2 is the schematic diagram of the key step for the method that daily record data according to an embodiment of the present invention saves.
As shown in Fig. 2, the method that the daily record data of the embodiment of the present invention saves specifically includes that
S201: the operating status of system main thread is monitored.Wherein, system involved in the embodiment of the present invention is IOS system, the interface provided for the monitoring technique of iOS system main thread RunLoop Status Change currently based on iOS system are complete At realization logic provides support by apple inside relevant RunLoop, if apple iOS system is in RunLoop realization technology There is bigger variation to update, function involved in the automatic iOS log Techniques of preserving based on RunLoop can be improved.For When iOS system operation saves log, monitored by operating status of the RunLoop to system main thread.Under normal conditions, IOS application mainly operates among main thread, wherein showing that the operation with intercorrelation must be held among main thread with the page Row, in order to guarantee that user can carry out program interaction use in real time, iOS system has used the mechanism of RunLoop a kind of to protect Card application program can efficiently carry out switching and communicating between thread after opening in real time.
For the NSLog function provided in the prior art by apple iOS system, generated while program is run first Log comprising time and programmed logic node;Pass through the macro realization code for redefining NSLog of define again;Finally by text Part operation is saved into hard drive space.It is that developer generates to obtain program operation logic node that iOS log, which saves function, Reference data, by the way that in insertion program operation logic code, triggering when being executed by user is determined by the reference data of feedback Program production environment operation logic.It is moved since apple iOS system is operate in the apples such as iPhone, iPad and iPod Touch The iOS application of application system on dynamic electronic equipment, reliable comparable scarcity of hardware resource itself, early stage passes through disabling Production environment log generates to ensure that user program normally executes, this significantly limits the demand that developer optimizes program. As the hardware resource of its mobile electronic device constantly improves in Apple Inc., existing equipment can satisfy production environment day The needs that will generates, but since program complexity is gradually increased, aim at the distribution that the display form in code is hash, exploitation day Personnel, which can only often rely on, to be redefined NSLog to save log in real time, this to be completely dependent on programmed hardware to save log Method is very high to the loss of performance.Even if relying on thread Techniques of preserving, i.e., log is saved by way of multithreading, It is also very high that it, which is consumed, because the central processing unit of mobile device will comprehensively consider battery consumption and volume limit after all System is supported multithreading limited.Automatic iOS log Techniques of preserving of the embodiment of the present invention based on RunLoop is exactly to utilize RunLoop technology realizes that more efficient log saves.
In the main thread that application in iOS system is managed in one by RunLoop immediately after opening, examine in real time It surveys the interaction of user and realizes the display of the page, meeting trigger executes when user carries out the operation such as screen touch, passes through The switching of RunLoop state, realizes that entire application logic normally executes.The main thread of RunLoop monitoring mainly includes following Six kinds of states:
kCFRunLoopEntry Loop will be entered
kCFRunLoopBeforeTimers Timer will be handled
kCFRunLoopBeforeSources Source will be handled
kCFRunLoopBeforeWaiting Suspend mode will be entered
kCFRunLoopAfterWaiting Just waken up from suspend mode
kCFRunLoopExit It will move out Loop
The operation logic of iOS program will issue once triggering main thread RunLoop state transformation KCFRunLoopAfterWaiting (just being waken up from suspend mode) notice, and then program enters processing Timer Source shape State.At this time be usually issue kCFRunLoopBeforeTimers (will handle Timer) with KCFRunLoopBeforeSources (will handle Source) two states notice;And when user's time out program interaction or Programmed logic operation finishes, then can enter wait state, can issue kCFRunLoopBeforeWaiting at this time (will enter Suspend mode) notice.When program is collapsed, kCFRunLoopExit (will move out Loop) notice can be issued.
S202: the daily record data of system is cached.The embodiment of the present invention is by redefining NSLog function, by system Daily record data caching in memory, realize provisional preservation.
Before being cached the daily record data of system, setting caching critical value, the caching critical value can be static state Maximum value is also possible to the dynamic value of the ratio setting according to memory.After daily record data is cached in memory, by log number According to carrying out serializing operation, and then after storing daily record data in query process, can be obtained by unserializing operation To daily record data.Before being stored the daily record data of caching, daily record data is encrypted;Judging log After data are stored, the daily record data of encryption is stored, is supported by the encryption, it can be to avoid developer It cracks using the log content for getting daily record data.
S203: according to the operating status of the main thread of monitoring or caching critical value, judge whether the daily record data that will be cached It is stored.Wherein, judge whether the daily record data of the caching reaches caching critical value, or judge whether system occurs It is disconnected, or judge whether the main thread enters suspend mode;If not having, the daily record data of caching is not stored;Otherwise, The daily record data of caching is stored.Before being stored the daily record data of caching, the root of storage position is specified. It determines and stores the daily record data of caching, then it in a hard disk by the daily record data storage of caching, i.e., will be provisional It saves and carries out permanent storage.Other than these three states, if user calls directly log and saves function, can also it touch Hair saves operation.
By whether the judgement of storage, so that the main thread of system is in suspend mode shape during storing daily record data State perhaps caches the critical value for reaching setting or program is explicitly called and saves function immediately, executes asynchronous thread and opens, saves Daily record data.When executing the starting of preservation thread when main thread enters dormant state and executing storage operation, normal main thread Suspend mode occur when user's finger frames out, it can be ensured that log information quickly and effectively preserves, will not and main thread Preempting resources.
In addition, defining the general-purpose attribute of daily record data, general-purpose attribute packet after being cached the daily record data of system Include following at least one: log storing path, log index, stl status symbol, the associated code file of log, function and row Number and log content;Also, after being stored the daily record data of caching, the log text of storing daily record data is defined Path, title and the content of part.
The method that the daily record data of the embodiment of the present invention saves can be completed above-mentioned each step by the creation of class, Such as creation log management class, log properties class and journal file class.Wherein, as shown in following table log management class, daily record data Preservation is mainly realized by log management class, and initialization, switch control, the string operation management, file behaviour of log management are undertaken It manages and (data is stored from memory operational administrative in a hard disk), log management, shortcut function management and lock-in tube Reason and parameter management.Program can initialize the root (log management of a specified hard disk storing position by the management class File);Pass through the opening and closing of switch control log management class;Sequence is carried out for the log character string that needs save Change;Prompt operation function (the default item of selection setting, to parameter without configuration, and the preservation of prompt operation is provided simultaneously Log information be stored separately in some file in hard disk), including fast save, fast read and quick delete;Day Will management is managed to log in memory is saved, including storage Log Names and storage time, read access time, convenient for application With the decryption in the reading and reading process of server;Additionally provide safer synchronous preservation function and parameter setting Function, synchronous to save the demand that user saves in real time that can solve, parameter management supports caller according to system hardware condition Largest buffered log number is set dynamically, improves log and saves efficiency.
The achievable definition to daily record data general-purpose attribute of log properties class, wherein it is as shown in the table, by daily record data After being cached in memory, log properties class defines log storing path, log index, stl status and accords with, associated by log Code file, function and line number and log content.Log properties class institute defined attribute is mainly used for single log definition, intermediate range Sequence only needs to provide log content when calling, and external call is redefined by NSLog function can be not necessarily to do any other change, Also without providing additional log information.
Journal file includes multiple or single daily record data, as shown in the table, by journal file class to journal file Path, title and content are defined.Journal file class is mainly used for the file access of batch log information, external call program Filename and path required for can determining itself according to respective business module.
Fig. 3 is the flow chart for the method that daily record data according to an embodiment of the present invention saves.
As shown in figure 3, management module is initialized after the starting of iOS program, wherein initialization management module includes log pipe Manage class, log properties class and journal file class.The day of a specified hard disk storing position can be initialized by log management class Will managing folder and management filename, specified folder name are to pass through when defining the data in unified file folder Prefix is arranged to realize.After being provided with, journal file will be saved according to the module of setting to specified file.
Default initialization method can provide the dependence that necessary default parameters is handled as program, and routine call person can lead to The method of setting default parameters is crossed according to the specified parameter value for being suitble to oneself application program of actual hardware condition.
Registration main thread RunLoop is a most important step, and main thread RunLoop is the master under RunLoop monitoring Thread registers iOS system RunLoop, can get the operating status for the main thread that RunLoop is listened to, and then can help It helps and determines when to determine that unlatching thread execution journal preservation is maximally efficient.
After the switch for opening log management class, the NSLog method that routine call person can be provided by system is carried out Daily record data output, institute output position only needs provide necessary logical message content, without providing log index, state With path and associated with, function, code etc., these information will encrypt automatically generation by log properties class.Program tune simultaneously User saves operation without execution journal, does not also need to open thread progress file access operations, log management module can close Automatic encrypting storing of suitable time.By the setting to parameters and the operating status of the system main thread got, sentence It is disconnected whether to store the daily record data of caching into hard disk.Also, the embodiment of the present invention provides operation bidirectional without caller, After only needing to be implemented simple configuration sentence, so that it may which completely seamless carry out log preservation allows the log number of production environment It is combined according to the daily record data logical seamlessness with exploitation environment.Convenient and fast file operation can allow the access of log eased, be User data collection provides support.Embedded character string encrypting module can provide effective daily record data safeguard protection.
Fig. 4 is the schematic diagram of the main modular for the device that daily record data according to an embodiment of the present invention saves.
As shown in figure 4, the device that the daily record data of the embodiment of the present invention saves mainly includes monitoring module 401, caching mould Block 402 and judge memory module 403.Wherein, module 401 is monitored for monitoring the operating status of system main thread;It is slow Storing module 402 is for caching the daily record data of system;Judge that memory module 403 is used for the fortune of the main thread according to monitoring Row state or caching critical value, judge whether to store the daily record data of caching.Wherein, the log number of the embodiment of the present invention System according to the device of preservation is iOS system.Also, monitor module by RunLoop to the operating status of system main thread into Row is monitored.
Judge that memory module judges whether the daily record data of caching reaches caching critical value, or judges whether system occurs It interrupts, or judges whether main thread enters suspend mode;If not having, the daily record data of caching is not stored;Otherwise, will The daily record data of caching is stored.Judge memory module further include: encryption unit, for being carried out in the daily record data that will be cached Before storage, daily record data is encrypted;After judging to be stored daily record data, judge that memory module will add Close processed daily record data is stored.
Cache module further include: serialization unit, for cache module after being cached the daily record data of system, And before judging that memory module is stored the daily record data of caching, daily record data is subjected to serializing operation.
The device that the daily record data of the embodiment of the present invention saves further includes setup module, log properties module and journal file Module.Setup module is used for before cache module is cached the daily record data of system, setting caching critical value;And Before judging that memory module is stored the daily record data of caching, the root of storage position is specified.Log properties module For after being cached the daily record data of system, defining the general-purpose attribute of daily record data, general-purpose attribute include with down toward Few one kind: log storing path, log index, stl status symbol, the associated code file of log, function and line number, Yi Ji Will content.Journal file module is used for after being stored the daily record data of caching in a hard disk, definition storage log number According to journal file path, title and content.
The device that the daily record data of the embodiment of the present invention saves judges the encryption of memory module by the caching of daily record data Unit can carry out string format encryption and log properties module and journal file module to daily record data to daily record data Essential information carry out perfect, priority cache is into memory.Reach maximum number in caching or main thread RunLoop enters When dormant state or program explicitly call preservation function immediately (system is interrupted because of reasons such as collapses), judge to store mould Block executes asynchronous thread and opens, and saves daily record data.And then it saves and uses while not influencing user's normal use program function Daily record data when family program is run, the data can be applied to user behavior analysis, program operating analysis and really produce ring A variety of data such as border Parameter analysis analyze scene.User journal data are provided by application developer meets programmed logic positioning need It the daily record data wanted and is made of the necessary location data that log management module generates.Developer is opening log management module Later, without switching original any log location code of exploitation environment, the synchronization that can have both completed production environment executes calling, and It calls the daily record data generated that will more completely be stored in user's hard disc data, that is, turn off application or reopens, also It is available and feed back.
Below with reference to Fig. 5, it illustrates the computer systems 500 for the terminal device for being suitable for being used to realize the embodiment of the present invention Structural schematic diagram.Terminal device shown in Fig. 5 is only an example, function to the embodiment of the present invention and should not use model Shroud carrys out any restrictions.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored in Program in memory (ROM) 502 or be loaded into the program in random access storage device (RAM) 503 from storage section 508 and Execute various movements appropriate and processing.In RAM 503, also it is stored with system 500 and operates required various programs and data. CPU 501, ROM 502 and RAM 503 are connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to always Line 504.
I/O interface 505 is connected to lower component: the importation 506 including keyboard, mouse etc.;It is penetrated including such as cathode The output par, c 507 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 508 including hard disk etc.; And the communications portion 509 of the network interface card including LAN card, modem etc..Communications portion 509 via such as because The network of spy's net executes communication process.Driver 510 is also connected to I/O interface 505 as needed.Detachable media 511, such as Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 510, in order to read from thereon Computer program be mounted into storage section 508 as needed.
Particularly, disclosed embodiment, the process described above with reference to flow chart may be implemented as counting according to the present invention Calculation machine software program.For example, embodiment disclosed by the invention includes a kind of computer program product comprising be carried on computer Computer program on readable medium, the computer program include the program code for method shown in execution flow chart.? In such embodiment, which can be downloaded and installed from network by communications portion 509, and/or from can Medium 511 is dismantled to be mounted.When the computer program is executed by central processing unit (CPU) 501, system of the invention is executed The above-mentioned function of middle restriction.
It should be noted that computer-readable medium shown in the present invention can be computer-readable signal media or meter Calculation machine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but not Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Meter The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wires Taking formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only storage Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device, Or above-mentioned any appropriate combination.In the present invention, computer readable storage medium can be it is any include or storage journey The tangible medium of sequence, the program can be commanded execution system, device or device use or in connection.And at this In invention, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for By the use of instruction execution system, device or device or program in connection.Include on computer-readable medium Program code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentioned Any appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of various embodiments of the invention, method and computer journey The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part of one module, program segment or code of table, a part of above-mentioned module, program segment or code include one or more Executable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, institute in box The function of mark can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are practical On can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it wants It is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and execute rule The dedicated hardware based systems of fixed functions or operations is realized, or can use the group of specialized hardware and computer instruction It closes to realize.
Being described in the embodiment of the present invention involved module or unit can be realized by way of software, can also be with It is realized by way of hardware.Described module or unit also can be set in the processor, for example, can be described as: A kind of processor includes monitoring module, cache module and judging memory module.Wherein, the title of these units is under certain conditions The restriction to the unit itself is not constituted, is also described as example, monitoring module " for the operation to system main thread The module that state is monitored ".
As on the other hand, the present invention also provides a kind of computer-readable medium, which be can be Included in equipment described in above-described embodiment;It is also possible to individualism, and without in the supplying equipment.Above-mentioned calculating Machine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, makes Obtaining the equipment includes: to monitor the operating status of system main thread;The daily record data of system is cached;According to monitoring Main thread operating status or caching critical value, judge whether to store the daily record data of caching.
Technical solution according to an embodiment of the present invention can be avoided main thread resource when occupying program operation, reduce The bereft problem of main thread resource caused by real-time file saves and sub thread creates, improves program efficient operation, will User is preferably minimized using the influence of program, improves the preservation efficiency and safe coefficient of user journal.
Above-mentioned specific embodiment, does not constitute a limitation on the scope of protection of the present invention.Those skilled in the art should be bright It is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and substitution can occur.It is any Made modifications, equivalent substitutions and improvements etc. within the spirit and principles in the present invention, should be included in the scope of the present invention Within.

Claims (14)

1. a kind of method that daily record data saves characterized by comprising
The operating status of system main thread is monitored;
The daily record data of system is cached;
According to the operating status of the main thread of monitoring or caching critical value, judge whether to store the daily record data of caching.
2. the method according to claim 1, wherein the operating status or caching of the main thread according to monitoring Critical value judges whether that the daily record data of caching is carried out to storage includes:
Judge whether the daily record data of the caching reaches caching critical value, perhaps judges whether system is interrupted or sentenced Whether the main thread that breaks enters suspend mode;If not having, the daily record data of caching is not stored;Otherwise, by caching Daily record data is stored.
3. the method according to claim 1, wherein further include:
Before being stored the daily record data of caching, the daily record data is encrypted;
After judging to be stored the daily record data, the daily record data of the encryption is stored.
4. the method according to claim 1, wherein further include:
It, will be described after being cached the daily record data of system, and before being stored the daily record data of caching Daily record data carries out serializing operation.
5. the method according to claim 1, wherein further include:
Before the daily record data of system is cached, setting caching critical value;Also,
Before being stored the daily record data of caching, the root of storage position is specified.
6. the method according to claim 1, wherein further include:
After being cached the daily record data of system, the general-purpose attribute of the daily record data, the general-purpose attribute packet are defined Include following at least one: log storing path, log index, stl status symbol, the associated code file of log, function and row Number and log content;And
After being stored the daily record data of caching, definition stores the path of the journal file of the daily record data, title And content.
7. the system that a kind of daily record data saves characterized by comprising
Module is monitored, is monitored for the operating status to system main thread;
Cache module, for caching the daily record data of system;
Judge memory module, for the operating status or caching critical value according to the main thread of monitoring, judges whether will to cache Daily record data is stored.
8. system according to claim 7, which is characterized in that the judgement memory module judges the log number of the caching According to whether caching critical value is reached, perhaps judge whether system interrupts or judge whether the main thread enters suspend mode; If not having, the daily record data of caching is not stored;Otherwise, the daily record data of caching is stored.
9. system according to claim 7, which is characterized in that the judgement memory module further include:
Encryption unit, for before being stored the daily record data of caching, the daily record data to be encrypted;
After judging to be stored the daily record data, judge memory module by the daily record data of the encryption into Row storage.
10. system according to claim 7, which is characterized in that the cache module further include:
Serialization unit for cache module after being cached the daily record data of system, and is judging memory module Before the daily record data of caching is stored, the daily record data is subjected to serializing operation.
11. system according to claim 7, which is characterized in that further include:
Setup module, for before cache module is cached the daily record data of system, setting to cache critical value;And Before judging that memory module is stored the daily record data of caching, the root of storage position is specified.
12. system according to claim 7, which is characterized in that further include:
Log properties module, for after being cached the daily record data of system, defining the general category of the daily record data Property, the general-purpose attribute comprises at least one of the following: log storing path, log index, stl status symbol, log associated generation Code file, function and line number and log content;
Journal file module, for after being stored the daily record data of caching in a hard disk, definition to store the log Path, title and the content of the journal file of data.
13. a kind of electronic equipment characterized by comprising
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors are real Now such as method as claimed in any one of claims 1 to 6.
14. a kind of computer-readable medium, is stored thereon with computer program, which is characterized in that described program is held by processor Such as method as claimed in any one of claims 1 to 6 is realized when row.
CN201710496297.9A 2017-06-26 2017-06-26 A kind of method and system that daily record data saves Pending CN109117339A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710496297.9A CN109117339A (en) 2017-06-26 2017-06-26 A kind of method and system that daily record data saves

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710496297.9A CN109117339A (en) 2017-06-26 2017-06-26 A kind of method and system that daily record data saves

Publications (1)

Publication Number Publication Date
CN109117339A true CN109117339A (en) 2019-01-01

Family

ID=64822636

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710496297.9A Pending CN109117339A (en) 2017-06-26 2017-06-26 A kind of method and system that daily record data saves

Country Status (1)

Country Link
CN (1) CN109117339A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111651331A (en) * 2020-06-10 2020-09-11 江苏经贸职业技术学院 Operation and maintenance auditing platform and operation and maintenance steps
CN112650156A (en) * 2019-10-12 2021-04-13 北京京东乾石科技有限公司 Method and device for displaying operation condition of unmanned equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6493837B1 (en) * 1999-07-16 2002-12-10 Microsoft Corporation Using log buffers to trace an event in a computer system
CN105183626A (en) * 2015-09-30 2015-12-23 深圳怡化电脑股份有限公司 Log storage method and system of paper currency recognition module
CN105468502A (en) * 2015-11-30 2016-04-06 北京奇艺世纪科技有限公司 Log collection method, device and system
CN105868093A (en) * 2016-04-25 2016-08-17 上海斐讯数据通信技术有限公司 Log write-in method and server side
CN106055367A (en) * 2016-06-01 2016-10-26 腾讯科技(深圳)有限公司 Script file loading method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6493837B1 (en) * 1999-07-16 2002-12-10 Microsoft Corporation Using log buffers to trace an event in a computer system
CN105183626A (en) * 2015-09-30 2015-12-23 深圳怡化电脑股份有限公司 Log storage method and system of paper currency recognition module
CN105468502A (en) * 2015-11-30 2016-04-06 北京奇艺世纪科技有限公司 Log collection method, device and system
CN105868093A (en) * 2016-04-25 2016-08-17 上海斐讯数据通信技术有限公司 Log write-in method and server side
CN106055367A (en) * 2016-06-01 2016-10-26 腾讯科技(深圳)有限公司 Script file loading method and device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112650156A (en) * 2019-10-12 2021-04-13 北京京东乾石科技有限公司 Method and device for displaying operation condition of unmanned equipment
CN112650156B (en) * 2019-10-12 2022-09-30 北京京东乾石科技有限公司 Method and device for displaying operation condition of unmanned equipment
CN111651331A (en) * 2020-06-10 2020-09-11 江苏经贸职业技术学院 Operation and maintenance auditing platform and operation and maintenance steps

Similar Documents

Publication Publication Date Title
US10073605B2 (en) Providing dynamic widgets in a browser
CN109274731A (en) Deployment, call method and the device of web services based on multi-tenant technology
CN109409119A (en) Data manipulation method and device
CN110083660A (en) A kind of method, apparatus of synchrodata, medium and electronic equipment
CN110019080B (en) Data access method and device
CN107844324A (en) Customer terminal webpage redirects treating method and apparatus
CN109981719A (en) Information processing method and its system, computer system and computer readable medium
US20130013549A1 (en) Hardware-assisted approach for local triangle counting in graphs
CN110196790A (en) The method and apparatus of abnormal monitoring
US20130132828A1 (en) Method and apparatus for implementing microblog message pages
CN108989369A (en) The method and its system of progress current limliting are requested user
CN110795315A (en) Method and device for monitoring service
CN107613040A (en) A kind of method and apparatus of domain name system DNS server lookup
CN110389873A (en) A kind of method and apparatus of determining server resource service condition
CN110096258A (en) A method of the OpenStack infrastructure architecture management based on Terraform
CN110083457A (en) A kind of data capture method, device and data analysing method, device
CN109117339A (en) A kind of method and system that daily record data saves
CN110109983A (en) A kind of method and apparatus operating Redis database
CN110020271A (en) Method and system for cache management
CN110109912A (en) A kind of identifier generation method and device
CN109947736A (en) The method and system calculated in real time
CN107729394A (en) Data Mart management system and its application method based on Hadoop clusters
CN109429229A (en) Obtain the method, apparatus and computer readable storage medium of network access information
US11687503B2 (en) Maintaining foreign key references across domains
CN110275701A (en) Data processing method, device, medium and calculating equipment

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: 20190101