CN104765775A - Log saving method and device - Google Patents

Log saving method and device Download PDF

Info

Publication number
CN104765775A
CN104765775A CN201510117118.7A CN201510117118A CN104765775A CN 104765775 A CN104765775 A CN 104765775A CN 201510117118 A CN201510117118 A CN 201510117118A CN 104765775 A CN104765775 A CN 104765775A
Authority
CN
China
Prior art keywords
daily record
rank
format
journal format
record rank
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.)
Granted
Application number
CN201510117118.7A
Other languages
Chinese (zh)
Other versions
CN104765775B (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.)
Sina Technology China Co Ltd
Original Assignee
Sina Technology China 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 Sina Technology China Co Ltd filed Critical Sina Technology China Co Ltd
Priority to CN201510117118.7A priority Critical patent/CN104765775B/en
Publication of CN104765775A publication Critical patent/CN104765775A/en
Application granted granted Critical
Publication of CN104765775B publication Critical patent/CN104765775B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a log saving method and device, and aims at increasing the application migration efficiency. The method comprises the steps of reading a log configuration file of the application; determining a first log format according to the log configuration file, wherein the first log format is the log format of the application before being migrated to a target environment; determining a conversion rule according to the first log format, wherein the conversion rule is the rule of converting the first log format into the second log format, and the second log format is the log format corresponding to the target environment; converting the format of the outputted log of the application according to the conversion rule; saving to the specified saving address. According to the method, the first log format is converted into the second log format, so that the log subjected to format conversion can be saved without modifying related interfaces and configuration of the application, and as a result, the application migration efficiency can be effectively increased.

Description

A kind of log preservation method and device
Technical field
The application relates to field of computer technology, particularly relates to a kind of log preservation method and device.
Background technology
Namely platform serves, and (Platform as a Service, PaaS) is the pattern that server platform is provided as a kind of service.In fact namely using the platform of research and development of software as a kind of service commitment to user.Along with the arrival PaaS in cloud computing epoch develops more and more faster.Also many application migration are just had to PaaS environment.
Normal application all can be furnished with logging tools, daily record is saved on local disk, for recording some mistake or Debugging message of this application, debug after convenient.And these logging tools are all generally third party's logging tools.In PaaS environment, because distributed and security reason, generally all daily record can be saved in a unified daily record center.
Solve the unified problem being saved in the specific daily record center of PaaS environment of the daily record that third party's logging tools is exported, according to prior art, developer is needed to remodify the code of logging tools, application programming interfaces (the Application Program Interface of third party's logging tools will be used, API) daily record changes into and uses the distinctive API daily record of PaaS environment, and revised daily record will be saved in specific daily record center in PaaS.
Visible, in the prior art, once need by certain application migration in PaaS platform, just need developer to revise the code of third party's logging tools, workload is larger, and transport efficiency is lower.
Summary of the invention
The embodiment of the present application provides a kind of log preservation method and device, in order to improve the efficiency of application migration.
The log preservation method that the embodiment of the present application provides, comprising:
Read the daily record configuration file of application;
Determine the first journal format according to daily record configuration file, wherein, described first journal format for described in be applied in the journal format before moving to targeted environment;
According to described first journal format determination transformation rule, wherein, described transformation rule is the rule the first journal format being converted to the second journal format, and described second journal format is journal format corresponding to described targeted environment;
According to described transformation rule, format conversion is carried out in the daily record described application exported, and is saved to designated store address.
The daily record save set that the embodiment of the present application provides, comprising:
Read module, for reading the daily record configuration file of application;
First determination module, for determining the first journal format according to daily record configuration file, wherein, described first journal format for described in be applied in the journal format before moving to targeted environment;
Second determination module, for according to described first journal format determination transformation rule, wherein, described transformation rule is the rule the first journal format being converted to the second journal format, and described second journal format is journal format corresponding to described targeted environment;
Modular converter, for according to described transformation rule, format conversion is carried out in the daily record described application exported;
Preserve module, for by described carry out format conversion after daily record be saved to designated store address.
The embodiment of the present application provides a kind of log preservation method and device, and the method is read the daily record configuration file of application, determines the first journal format according to daily record configuration file; Wherein, described first journal format for described in be applied in the journal format before moving to targeted environment.According to described first journal format determination transformation rule; Wherein, described transformation rule is the rule the first journal format being converted to the second journal format, and described second journal format is journal format corresponding to described targeted environment.According to described transformation rule, format conversion is carried out in the daily record described application exported, and is saved to designated store address.The method, by the first journal format is converted to the second journal format, just can preserve the daily record after format conversion, and does not need relevant interface and the configuration of revising application, like this, effectively can improve the transport efficiency of application.
Accompanying drawing explanation
Accompanying drawing described herein is used to provide further understanding of the present application, and form a application's part, the schematic description and description of the application, for explaining the application, does not form the improper restriction to the application.In the accompanying drawings:
The log preservation method schematic flow sheet that Fig. 1 provides for the embodiment of the present application;
The store method schematic flow sheet of the language output statement that Fig. 2 provides for the embodiment of the present application;
The daily record save set structural representation that Fig. 3 provides for the embodiment of the present application.
Embodiment
For making the object of the application, technical scheme and advantage clearly, below in conjunction with the application's specific embodiment and corresponding accompanying drawing, technical scheme is clearly and completely described.Obviously, described embodiment is only some embodiments of the present application, instead of whole embodiments.Based on the embodiment in the application, those of ordinary skill in the art are not making the every other embodiment obtained under creative work prerequisite, all belong to the scope of the application's protection.
The log preservation method that Fig. 1 provides for the embodiment of the present application, specifically comprises the following steps:
S101: the daily record configuration file reading application.
In the embodiment of the present application, suppose to apply current residing environment be stand-alone environment (namely, current environment), if will by place's application migration under the present circumstances to distributed environment (namely, targeted environment) under, need the daily record of this application from current environment migration (preservation) to targeted environment.
When daily record due to described application moves to targeted environment from current environment, the form of daily record is needed to change, to ensure that daily record effectively (namely normally uses) after being saved in targeted environment, and the definition of daily record configuration file has journal format, therefore, first the application needs the daily record configuration file reading the application before moving to targeted environment, to obtain journal format.
General, because the daily record of each application is preserved by the logging tools of this application self, concrete, logging tools can read daily record configuration file, and the daily record of application is preserved according to journal formats such as the daily record rank comprised in daily record configuration file, journal layout modes, therefore, when the embodiment of the present application server reads the daily record configuration file of application, specifically daily record configuration file can be read from the logging tools of this application.
General, at least include the journal formats such as daily record rank corresponding to current environment, journal layout mode in daily record configuration file, then the application can obtain the daily record configuration file comprising described journal format.
To take below journal format as daily record rank be example, illustrate and read daily record configuration file, to obtain the process of journal format.
Under normal circumstances, the daily record configuration file of certain logging tools can have various configurations mode, then in the embodiment of the present application, daily record configuration file can by the wherein a kind of realization in following several mode.
Mode one: all daily record ranks comprising this logging tools in daily record configuration file, as, the logging tools of current application is log4j, then can include all daily record rank FATAL, ERROR, WARN, INFO, DEBUG, TRACE of this log4j in this daily record configuration file, wherein, the rank height order of each daily record rank successively decreases successively according to arrangement sequencing.Then this daily record configuration file represents: the daily record exporting the daily record rank corresponded in daily record configuration file.
Mode two: the partial log rank comprising this logging tools in daily record configuration file, e.g., comprises front four (i.e. FATAL, ERROR, WARN, INFO) daily record ranks of log4j.Then this daily record configuration file represents: the daily record exporting the daily record rank corresponded in daily record configuration file.It should be noted that, (namely log4j has six kinds of daily record ranks, described in mode one six kind of daily record rank), and in mode two, contains only four kinds of daily record ranks in daily record configuration file, just represent that the daily record of these four kinds of daily record ranks that this application exports needs to preserve, the daily record of other two kinds of daily record ranks does not need to preserve.
Mode three: the some daily record ranks comprising this logging tools in daily record configuration file, e.g., comprises the 4th the daily record rank (INFO) of log4j.Then this daily record configuration file represents: export the daily record that (preservation) rank is not less than the daily record rank in this daily record configuration file.Also namely, only needing to preserve daily record rank is the daily record of FATAL, ERROR, WARN, INFO, and does not need the daily record of preserving other two kinds of daily record ranks.
It should be noted that, the logging tools described in the embodiment of the present application can be logging tools of increasing income, and also can be non-logging tools of increasing income, not do concrete restriction here.
It should be noted that in addition, in the embodiment of the present application, the daily record configuration file of application can be read by the logging tools in targeted environment, and perform following step S102 ~ S104.Concrete, before this is applied in and moves in targeted environment, himself may carry logging tools, but the logging tools himself carried be current environment (as, stand-alone environment), be not targeted environment (e.g., distributed environment), therefore, the daily record configuration file in the self-contained logging tools of this application can be read by the logging tools of targeted environment.Wherein, the logging tools of targeted environment can be arranged on the every station server in targeted environment.In addition, in order to avoid the logging tools of targeted environment clashes with the self-contained logging tools of application, when application moves to targeted environment from current environment, logging tools self-contained for this application can first be forbidden by the logging tools of targeted environment.
S102: determine the first journal format according to daily record configuration file.
Concrete, after reading out daily record configuration file by step S101, just can obtain the journal format in daily record configuration file, and determine the first journal format accordingly, this first journal format for described in be applied in the journal format before moving to targeted environment.
Such as, suppose that application needs to move to PaaS environment (targeted environment) from stand-alone environment (current environment), and the logging tools of application is log4j, this log4j is the logging tools of increasing income; Wherein, if daily record configuration file one is configured in the manner described above, then, server can read the daily record configuration file of logging tools log4j, daily record rank (journal format) in the daily record configuration file obtained comprises all daily record ranks of the logging tools of this daily record configuration file configuration, as, FATAL, ERROR, WARN, INFO, DEBUG, TRACE.Then can using each daily record rank of this acquisition as the first daily record rank.
Again such as, if daily record configuration file two is configured in the manner described above, then, server reads daily record configuration file, daily record rank (journal format) in the daily record configuration file obtained comprises partial log rank FATAL, ERROR, WARN, INFO of this logging tools, then also using each daily record rank of this acquisition as the first daily record rank.
Again such as, if daily record configuration file three is configured in the manner described above, then, server reads daily record configuration file, daily record rank (journal format) in the daily record configuration file obtained only comprises a daily record Grade I NFO in this daily record configuration file, all daily record ranks that then can be corresponding according to the logging tools of this current environment preserved in advance, search be not less than INFO other daily records rank FATAL, ERROR, WARN, FATAL, ERROR, WARN of to finding again, and INFO self is as the first daily record rank.It should be noted that, all daily record ranks corresponding for the logging tools of current environment can be kept in the logging tools of targeted environment in advance.
In upper example, the daily record rank determined according to read daily record configuration file, then can using the daily record rank in targeted environment as the second daily record rank as the first daily record rank.
S103: according to the first journal format determination transformation rule.
The embodiment of the present application, according to the first journal format determination transformation rule, specifically refers to according to the first journal format, determines the transformation rule of the journal format the first journal format being converted to targeted environment, using this corresponding relation as described transformation rule.The journal format of this targeted environment is as the second journal format, that is: when journal format is daily record rank, according to the first journal format determination transformation rule, be specially: according to the first daily record rank, determine the corresponding relation of the first daily record rank and the second daily record rank set up in advance, this corresponding relation is exactly the transformation rule that described needs are determined.
The journal format of different logging tools definition is generally different, and such as, the daily record rank (the first daily record rank) that the logging tools 1 under stand-alone environment defines comprises six kinds: FATAL, ERROR, WARN, INFO, DEBUG, TRACE; The daily record rank (the first daily record rank) that logging tools 2 under stand-alone environment defines comprises five kinds: FATAL, ERROR, WARN, INFO, DEBUG.But the daily record rank in PaaS environment (targeted environment) is: ERROR, WARN, INFO, DEBUG.Therefore, in the embodiment of the present application, can for each logging tools, preset each first daily record rank of this logging tools and the corresponding relation of each second daily record rank, this corresponding relation is exactly the transformation rule the first daily record rank being converted to the second daily record rank.
Visible, different logging tools, corresponding transformation rule is different.
After determined the first journal format in configuration file by step S102, need to determine the transformation rule corresponding with this first journal format from multiple default transformation rule.
Concrete, first can determine the daily record configuration file storing this first journal format, then determine the logging tools that this daily record configuration file is corresponding, then by transformation rule corresponding for the logging tools determined, be defined as the transformation rule that this first journal format is corresponding.
Along using example, the transformation rule of logging tools 1 and logging tools 2 difference correspondence as shown in Table 1 and Table 2.
First daily record rank Second daily record rank
FATAL ERROR
ERROR ERROR
WARN WARN
INFO INFO
DEBUG DEBUG
TRACE DEBUG
Table 1
First daily record rank Second daily record rank
FATAL ERROR
ERROR ERROR
WARN WARN
INFO INFO
DEBUG DEBUG
Table 2
In Table 1, each first daily record rank is followed successively by from high to low: FATAL, ERROR, WARN, INFO, DEBUG, TRACE; In table 2, each first daily record rank is followed successively by from high to low: FATAL, ERROR, WARN, INFO, DEBUG.
Illustrate for table 1, when the daily record that the first daily record rank is FATAL moves in targeted environment, this daily record needs to be converted to the second daily record rank ERROR.In like manner, the first daily record rank is the daily record of TRACE when moving in targeted environment, and this daily record needs to be converted to the second daily record rank DEBUG.The daily record of all the other the first daily record ranks, when moving in targeted environment, is still simple.
Along using example, suppose that the first daily record rank reads from the configuration file of logging tools log4j, and above-mentioned logging tools 1 is logging tools log4j, then determine that transformation rule corresponding to the first daily record rank is the transformation rule that log4j is corresponding, this transformation rule is as shown in table 1.The transformation rule that three kinds of modes use is table 1.
S104: according to the transformation rule determined, carries out format conversion by the daily record that application exports, and is saved to designated store address.
In the embodiment of the present application, described designated store address can be previously defined in the logging tools of targeted environment, server is when preserving daily record, can from the logging tools of targeted environment, obtain this designated store address and preserve daily record, this designated store address can be the daily record center in targeted environment.
In the embodiment of the present application, according to the transformation rule determined, format conversion is carried out in the daily record that application exports, and be saved to designated store address, be specially, according to the corresponding relation (i.e. transformation rule) of the first daily record rank set up in advance and the second daily record rank, the first daily record rank of the daily record this application exported converts the second daily record rank to, and according to the memory address read from logging tools, daily record is saved in described memory address.
Along using example, if daily record configuration file one is configured in the manner described above, the the first daily record rank then determined by step S102 is all daily record rank (FATAL of logging tools log4j, ERROR, WARN, INFO, DEBUG, TRACE), then pass through the corresponding relation of the first daily record rank shown in table 1 and the second daily record rank, the each first daily record rank determined is converted to the second daily record rank, concrete, FATAL is converted to ERROR, and TRACE is converted to DEBUG, other the first daily record rank (ERROR, WARN, INFO, DEBUG) former form can be kept.Daily record after this format conversion is kept at the daily record center of PaaS environment.
In method shown in above-mentioned Fig. 1, server only needs to read daily record rank in the daily record configuration file before application migration as the first daily record rank, and according to default transformation rule, first daily record rank is converted to the second daily record rank being applicable to targeted environment, and the daily record after this format conversion is kept at designated store address (as, the daily record center of PaaS environment), like this, after the daily record of applying moves to targeted environment, because its journal format has been converted to the journal format being applicable to targeted environment, effectively can ensure to aim at targeted environment this day effective, in addition, all daily records of applying all unification are kept at described designated store address, be convenient to follow-up checking.Visible, the method does not need to revise each api interface in logging tools and relevant configuration, just the daily record of application can be moved to targeted environment, effectively can improve the transport efficiency of application.
In the embodiment of the present application, further, due to by after application migration to targeted environment, the form of its daily record exported there occurs change, therefore, check the daily record stored in targeted environment for the ease of user, occur when avoiding checking daily record feeling uncertain, above-mentioned daily record is saved in described memory address before, described method also comprises: the mark adding the first daily record rank of this daily record before conversion in the daily record after conversion.
Such as, the daily record after format conversion is kept at daily record center by the application, and wherein, the daily record rank before this format conversion is TRACE, and the daily record rank after format conversion is DEBUG.When then preserving (output) this daily record, in the daily record after format conversion, add inlet identity TRACE.Then when showing this daily record, the mark TRACE added in show log, and do not show the daily record rank DEBUG of its reality.
Such as, " JAVA_Trace:rget () flags:0yq34javaruntime " is the log content shown under PaaS environment.The daily record of this to be a daily record rank be under the present circumstances TRACE rank, when moving to targeted environment, its daily record rank has been converted to DEBUG rank, but, because the logging tools of targeted environment is before being saved in daily record center, mark TRACE is added in this daily record, therefore, contain mark TRACE in shown daily record, and do not show the daily record rank DEBUG after its conversion, thus be convenient to user and check, occur feeling uncertain when avoiding user to check daily record.
In the embodiment of the present application, by in application migration to targeted environment time, except the daily record of this application is moved to targeted environment, also comprise and the language output statement of this application is also moved to targeted environment, be convenient to for this application service (using when e.g., ensureing that this application normally starts or debugs this application).
Therefore, see Fig. 2, the method described in the embodiment of the present application also comprises the steps:
S201: the language output statement reading application.
In the embodiment of the present application, suppose that application needs to move to PaaS environment (targeted environment) from stand-alone environment (current environment), the language output statement read be move to targeted environment before the language output statement of application.
Common, language output statement comprises program language and statement content, wherein, includes the output classification of this language output statement in program language, as the output classification of normal (out) or wrong (err).
Such as, the language output statement of reading is: System.out.println (" test "), and System.out.println is program language, and " test " is statement content, and the out in System.out.println represents output classification.
S202: the output classification determining described language output statement.
It should be noted that, in order to the language output statement of current environment normally can be saved in targeted environment designated store address (as, daily record center), language output statement is needed to preserve as special daily record, after such guarantee moves to targeted environment, the output content of language output statement is saved in designated store address, so need the classification determining language output statement; Wherein, the journal format of described special daily record (language output statement) is daily record rank.
Because language output statement comprises output classification, therefore, the output classification in this language output statement can directly be read.
Along using example, export classification out owing to comprising in the language output statement System.out.println (" test ") that reads out, therefore, can determine that the output classification of this language output statement is for correct (out).
S203: according to the corresponding relation of each output classification set up in advance and the second daily record rank, determine the second daily record rank that the output classification of described language output statement is corresponding.
Concrete, the output classification of the language output statement set up in advance and the corresponding relation of the second daily record rank as shown in table 3.
The output classification of language output statement Second daily record rank
err ERROR
out INFO
Table 3
Continue along using example, when the output classification determining language output statement is correct out, then as shown in Table 3, the second daily record rank of the corresponding targeted environment of this output classification is INFO.
S204: using the daily record of the output content of described language output statement as the second daily record rank determined, be saved in described designated store address.
Along using example, the output classification of the current environment language output statement read is out, second daily record rank of corresponding targeted environment is defined as INFO, then using the daily record of the output content of statement as the INFO daily record rank determined, by output redirection, output content is saved in designated store address (daily record center).
In method shown in above-mentioned Fig. 2, when applying needs and moving to targeted environment from current environment, server only needs to read language output statement, determine the output classification of language output statement, according to the corresponding relation of each output classification set up in advance and the second daily record rank, determine the second daily record rank that the output classification of described language output statement is corresponding, using the daily record of the output content of described language output statement as the second daily record rank determined, be saved in described designated store address.By said method, just language output statement can be saved in daily record center, highly versatile, transplanting efficiency is high.
Be a kind of log preservation method that the embodiment of the present application provides above, based on same thinking, the embodiment of the present application also provides corresponding daily record save set, as shown in Figure 3.
The daily record save set structural representation that Fig. 3 provides for the embodiment of the present application, specifically comprises:
Read module 31, for reading the daily record configuration file of application;
First determination module 32, for determining the first journal format according to daily record configuration file, wherein, described first journal format for described in be applied in the journal format before moving to targeted environment;
Second determination module 33, for according to described first journal format determination transformation rule, wherein, described transformation rule is the rule the first journal format being converted to the second journal format, and described second journal format is journal format corresponding to described targeted environment;
Modular converter 34, for according to described transformation rule, format conversion is carried out in the daily record described application exported;
Preserve module 35, for by described carry out format conversion after daily record be saved to designated store address.
Optionally, described journal format comprises: daily record rank; And
Described second determination module 33 is specifically for, the daily record rank read from daily record configuration file by described read module as the first daily record rank, and daily record rank corresponding to described targeted environment is as the second daily record rank; According to the first daily record rank, determine the corresponding relation of the first daily record rank and the second daily record rank set up in advance, using this corresponding relation as described transformation rule.
Optionally, described modular converter 34 specifically for, according to the corresponding relation of the first daily record rank set up in advance and the second daily record rank, first daily record rank of the daily record described application exported converts the second daily record rank to, adds the mark of the first daily record rank of this daily record before conversion in the daily record after conversion.
Optionally, described journal format comprises: daily record rank;
Described read module 31 also for, read application language output statement;
Described first determination module 32 also for, determine the output classification of described language output statement;
Described modular converter 34 also for, according to the corresponding relation of each output classification set up in advance and the second daily record rank, determine the second daily record rank that the output classification of described language output statement is corresponding;
Described preservation module 35 also for, using the daily record of the output content of described language output statement as the second daily record rank determined, be saved in described designated store address.
Optionally, described targeted environment comprises platform and namely serves PaaS environment;
Described designated store address comprises the address at daily record center.
Concrete above-mentioned device as shown in Figure 3 can be positioned on server.
In sum, the embodiment of the present application provides a kind of log preservation method and device, server only needs to read daily record rank in the daily record configuration file before application migration as the first daily record rank, and according to default transformation rule, first daily record rank is converted to the second daily record rank being applicable to targeted environment, and the daily record after this format conversion is kept at designated store address (as, the daily record center of PaaS environment), like this, after the daily record of applying moves to targeted environment, because its journal format has been converted to the journal format being applicable to targeted environment, effectively can ensure to aim at targeted environment this day effective, in addition, all daily records of applying all unification are kept at described designated store address, be convenient to follow-up checking.Visible, the method does not need to revise each api interface in logging tools and relevant configuration, just the daily record of application can be moved to targeted environment, effectively can improve the transport efficiency of application.
The present invention describes with reference to according to the process flow diagram of the method for the embodiment of the present invention, equipment (system) and computer program and/or block scheme.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block scheme and/or square frame and process flow diagram and/or block scheme and/or square frame.These computer program instructions can being provided to the processor of multi-purpose computer, special purpose computer, Embedded Processor or other programmable data processing device to produce a machine, making the instruction performed by the processor of computing machine or other programmable data processing device produce device for realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer-readable memory that works in a specific way of vectoring computer or other programmable data processing device, the instruction making to be stored in this computer-readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
These computer program instructions also can be loaded in computing machine or other programmable data processing device, make on computing machine or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computing machine or other programmable devices is provided for the step realizing the function of specifying in process flow diagram flow process or multiple flow process and/or block scheme square frame or multiple square frame.
In one typically configuration, computing equipment comprises one or more processor (CPU), input/output interface, network interface and internal memory.
Internal memory may comprise the volatile memory in computer-readable medium, and the forms such as random access memory (RAM) and/or Nonvolatile memory, as ROM (read-only memory) (ROM) or flash memory (flashRAM).Internal memory is the example of computer-readable medium.
Computer-readable medium comprises permanent and impermanency, removable and non-removable media can be stored to realize information by any method or technology.Information can be computer-readable instruction, data structure, the module of program or other data.The example of the storage medium of computing machine comprises, but be not limited to phase transition internal memory (PRAM), static RAM (SRAM), dynamic RAM (DRAM), the random access memory (RAM) of other types, ROM (read-only memory) (ROM), Electrically Erasable Read Only Memory (EEPROM), fast flash memory bank or other memory techniques, read-only optical disc ROM (read-only memory) (CD-ROM), digital versatile disc (DVD) or other optical memory, magnetic magnetic tape cassette, tape magnetic rigid disk stores or other magnetic storage apparatus or any other non-transmitting medium, can be used for storing the information can accessed by computing equipment.According to defining herein, computer-readable medium does not comprise temporary computer readable media (transitory media), as data-signal and the carrier wave of modulation.
Also it should be noted that, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, commodity or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, commodity or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, commodity or the equipment comprising described key element and also there is other identical element.
It will be understood by those skilled in the art that the embodiment of the application can be provided as method, system or computer program.Therefore, the application can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.And the application can adopt in one or more form wherein including the upper computer program implemented of computer-usable storage medium (including but not limited to magnetic disk memory, CD-ROM, optical memory etc.) of computer usable program code.
The foregoing is only the embodiment of the application, be not limited to the application.To those skilled in the art, the application can have various modifications and variations.Any amendment done within all spirit in the application and principle, equivalent replacement, improvement etc., within the right that all should be included in the application.

Claims (10)

1. a log preservation method, is characterized in that, comprising:
Read the daily record configuration file of application;
Determine the first journal format according to daily record configuration file, wherein, described first journal format for described in be applied in the journal format before moving to targeted environment;
According to described first journal format determination transformation rule, wherein, described transformation rule is the rule the first journal format being converted to the second journal format, and described second journal format is journal format corresponding to described targeted environment;
According to described transformation rule, format conversion is carried out in the daily record described application exported, and is saved to designated store address.
2. the method for claim 1, is characterized in that, described journal format comprises: daily record rank; And
According to described first journal format determination transformation rule, specifically comprise:
Using the daily record rank that reads from daily record configuration file as the first daily record rank, daily record rank corresponding to described targeted environment is as the second daily record rank;
According to the first daily record rank, determine the corresponding relation of the first daily record rank and the second daily record rank set up in advance, using this corresponding relation as described transformation rule.
3. method as claimed in claim 2, it is characterized in that, according to described transformation rule, format conversion is carried out in the daily record described application exported, and specifically comprises:
According to the corresponding relation of the first daily record rank set up in advance and the second daily record rank, the first daily record rank of the daily record described application exported converts the second daily record rank to;
The mark of the first daily record rank of this daily record before conversion is added in the daily record after conversion.
4. the method for claim 1, is characterized in that, described journal format comprises: daily record rank;
Described method also comprises:
Read the language output statement of application;
Determine the output classification of described language output statement;
According to the corresponding relation of each output classification set up in advance and the second daily record rank, determine the second daily record rank that the output classification of described language output statement is corresponding;
Using the daily record of the output content of described language output statement as the second daily record rank determined, be saved in described designated store address.
5. the method for claim 1, is characterized in that, described targeted environment comprises platform and namely serves PaaS environment;
Described designated store address comprises the address at daily record center.
6. a daily record save set, is characterized in that, comprising:
Read module, for reading the daily record configuration file of application;
First determination module, for determining the first journal format according to daily record configuration file, wherein, described first journal format for described in be applied in the journal format before moving to targeted environment;
Second determination module, for according to described first journal format determination transformation rule, wherein, described transformation rule is the rule the first journal format being converted to the second journal format, and described second journal format is journal format corresponding to described targeted environment;
Modular converter, for according to described transformation rule, format conversion is carried out in the daily record described application exported;
Preserve module, for by described carry out format conversion after daily record be saved to designated store address.
7. device as claimed in claim 6, it is characterized in that, described journal format comprises: daily record rank; And
Described second determination module is specifically for, the daily record rank read from daily record configuration file by described read module as the first daily record rank, and daily record rank corresponding to described targeted environment is as the second daily record rank; According to the first daily record rank, determine the corresponding relation of the first daily record rank and the second daily record rank set up in advance, using this corresponding relation as described transformation rule.
8. device as claimed in claim 7, it is characterized in that, described modular converter specifically for, according to the corresponding relation of the first daily record rank set up in advance and the second daily record rank, first daily record rank of the daily record described application exported converts the second daily record rank to, adds the mark of the first daily record rank of this daily record before conversion in the daily record after conversion.
9. device as claimed in claim 6, it is characterized in that, described journal format comprises: daily record rank;
Described read module also for, read application language output statement;
Described first determination module also for, determine the output classification of described language output statement;
Described modular converter also for, according to the corresponding relation of each output classification set up in advance and the second daily record rank, determine the second daily record rank that the output classification of described language output statement is corresponding;
Described preservation module also for, using the daily record of the output content of described language output statement as the second daily record rank determined, be saved in described designated store address.
10. device as claimed in claim 6, it is characterized in that, described targeted environment comprises platform and namely serves PaaS environment;
Described designated store address comprises the address at daily record center.
CN201510117118.7A 2015-03-17 2015-03-17 A kind of log preservation method and device Active CN104765775B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510117118.7A CN104765775B (en) 2015-03-17 2015-03-17 A kind of log preservation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510117118.7A CN104765775B (en) 2015-03-17 2015-03-17 A kind of log preservation method and device

Publications (2)

Publication Number Publication Date
CN104765775A true CN104765775A (en) 2015-07-08
CN104765775B CN104765775B (en) 2018-07-27

Family

ID=53647606

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510117118.7A Active CN104765775B (en) 2015-03-17 2015-03-17 A kind of log preservation method and device

Country Status (1)

Country Link
CN (1) CN104765775B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110083509A (en) * 2019-04-30 2019-08-02 新华三信息安全技术有限公司 A kind of regular method and device of daily record data
CN111008084A (en) * 2019-11-28 2020-04-14 中国银行股份有限公司 Multi-input and multi-output message format conversion method and device
WO2021092259A1 (en) * 2019-11-06 2021-05-14 Servicenow, Inc. Memory-efficient programmatic transformation of structured data
US11531683B2 (en) 2019-11-06 2022-12-20 Servicenow, Inc. Unified application programming interface for transformation of structured data

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1670708A (en) * 2004-03-17 2005-09-21 联想(北京)有限公司 Management method for computer log
US20120030172A1 (en) * 2010-07-27 2012-02-02 Oracle International Corporation Mysql database heterogeneous log based replication
CN102480489A (en) * 2010-11-30 2012-05-30 北京千橡网景科技发展有限公司 Logging method and device used in distributed environment
CN103778049A (en) * 2012-10-19 2014-05-07 北京市三希电子科技开发公司 Embedded system development log system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1670708A (en) * 2004-03-17 2005-09-21 联想(北京)有限公司 Management method for computer log
US20120030172A1 (en) * 2010-07-27 2012-02-02 Oracle International Corporation Mysql database heterogeneous log based replication
CN102480489A (en) * 2010-11-30 2012-05-30 北京千橡网景科技发展有限公司 Logging method and device used in distributed environment
CN103778049A (en) * 2012-10-19 2014-05-07 北京市三希电子科技开发公司 Embedded system development log system

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110083509A (en) * 2019-04-30 2019-08-02 新华三信息安全技术有限公司 A kind of regular method and device of daily record data
CN110083509B (en) * 2019-04-30 2022-09-20 新华三信息安全技术有限公司 Method and device for arranging log data
WO2021092259A1 (en) * 2019-11-06 2021-05-14 Servicenow, Inc. Memory-efficient programmatic transformation of structured data
US11429631B2 (en) 2019-11-06 2022-08-30 Servicenow, Inc. Memory-efficient programmatic transformation of structured data
US11531683B2 (en) 2019-11-06 2022-12-20 Servicenow, Inc. Unified application programming interface for transformation of structured data
CN111008084A (en) * 2019-11-28 2020-04-14 中国银行股份有限公司 Multi-input and multi-output message format conversion method and device
CN111008084B (en) * 2019-11-28 2023-08-18 中国银行股份有限公司 Multi-input and multi-output message format conversion method and device

Also Published As

Publication number Publication date
CN104765775B (en) 2018-07-27

Similar Documents

Publication Publication Date Title
CN111367886B (en) Method and device for data migration in database
CN107644286B (en) Workflow processing method and device
CN104298588A (en) Continuous integration implementation method and device
CN105446865A (en) Test method and device under multi-environment
CN104657140A (en) Code generating method and device
CN104765775A (en) Log saving method and device
CN112181804A (en) Parameter checking method, equipment and storage medium
CN110019111B (en) Data processing method, data processing device, storage medium and processor
CN104714957A (en) List structure changing method and device
CN106844288A (en) A kind of random string generation method and device
CN104572431A (en) Test method and test device
CN115599764A (en) Method, device and medium for migrating table data
CN105867886A (en) Method and device for writing table
CN103218241B (en) patch loading method and device
CN111078905A (en) Data processing method, device, medium and equipment
CN112667523B (en) Automatic test case filling method and device
CN110968888B (en) Data processing method and device
US10509659B1 (en) Input processing logic to produce outputs for downstream systems using configurations
CN101976219A (en) Method and system for debugging automatic testing script and agent device
CN112559444A (en) SQL (structured query language) file migration method and device, storage medium and equipment
CN113071541B (en) Method and device for generating trackside configuration file
CN114880394B (en) SQL script sharing method, device and medium
CN110019987B (en) Log matching method and device based on decision tree
CN110968758B (en) Webpage data crawling method and device
CN105956205A (en) Method and apparatus for generating HBASE passkey

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20230315

Address after: Room 501-502, 5/F, Sina Headquarters Scientific Research Building, Block N-1 and N-2, Zhongguancun Software Park, Dongbei Wangxi Road, Haidian District, Beijing, 100193

Patentee after: Sina Technology (China) Co.,Ltd.

Address before: 100080, International Building, No. 58 West Fourth Ring Road, Haidian District, Beijing, 20 floor

Patentee before: Sina.com Technology (China) Co.,Ltd.

TR01 Transfer of patent right