CN110007956A - A kind of method and device of dynamic configuration log - Google Patents
A kind of method and device of dynamic configuration log Download PDFInfo
- Publication number
- CN110007956A CN110007956A CN201910247872.0A CN201910247872A CN110007956A CN 110007956 A CN110007956 A CN 110007956A CN 201910247872 A CN201910247872 A CN 201910247872A CN 110007956 A CN110007956 A CN 110007956A
- Authority
- CN
- China
- Prior art keywords
- log
- rank
- order
- information
- level modification
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 25
- 230000004048 modification Effects 0.000 claims abstract description 121
- 238000012986 modification Methods 0.000 claims abstract description 121
- 230000004044 response Effects 0.000 claims abstract description 44
- 238000012545 processing Methods 0.000 claims description 31
- 230000001360 synchronised effect Effects 0.000 claims description 12
- 230000001960 triggered effect Effects 0.000 claims description 10
- 230000006870 function Effects 0.000 claims description 7
- 230000008859 change Effects 0.000 claims description 5
- 238000003860 storage Methods 0.000 claims description 3
- 238000007726 management method Methods 0.000 description 12
- 238000012423 maintenance Methods 0.000 description 4
- 230000008569 process Effects 0.000 description 4
- 238000000275 quality assurance Methods 0.000 description 3
- 230000008901 benefit Effects 0.000 description 2
- 238000010586 diagram Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 238000004458 analytical method Methods 0.000 description 1
- 238000012550 audit Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000000151 deposition Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000002452 interceptive effect Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 239000007787 solid Substances 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/70—Software maintenance or management
- G06F8/73—Program documentation
Abstract
The present invention provides a kind of method and devices of dynamic configuration log, it include: when receiving externally input log output order, call preset first interface, determine that the corresponding current log rank of log and log output order corresponding first log rank, when the first log rank is not higher than the current log rank, exports the log output and order corresponding log information;When receiving the external log level modification order inputted by preset second interface, determine whether the log level modification order is legal, when determining that the log level modification order is legal, by the second log rank that the corresponding current log level modification of the log is in the log level modification order, and output response information.This programme can reduce the management difficulty of equipment.
Description
Technical field
The present invention relates to audit management technical field, in particular to a kind of method and device of dynamic configuration log.
Background technique
The log information of equipment can help administrative staff's problem analysis, solution to ask in the exploitation of equipment, verification process
Topic, is the vital part of equipment.
Currently, in the development phase of equipment, need that important log information is added in code, so as to the debugging stage according to
These log informations carry out the tracking of problem, and in equipment test phase, carry out functional verification, positioning problems etc. according to log
Work.
But for the security consideration of equipment (for example, wifi module), producer can be positive formula weight production equipment not on the same day
Different log ranks is arranged in will information, and code corresponding to different log ranks is also different.In this case, equipment needs
According to the log of the open different stages of the different use demands of administrative staff, this meeting so that equipment code status disunity,
To increase the management difficulty of equipment.
Summary of the invention
The embodiment of the invention provides a kind of method and device of dynamic configuration log, the management that can reduce equipment is difficult
Degree.
In a first aspect, the embodiment of the invention provides a kind of methods of dynamic configuration log, comprising:
When receiving externally input log output order, preset first interface is called, determines that log is corresponding and works as
Corresponding first log rank is ordered in preceding log rank and log output, when the first log rank is worked as not higher than described
When preceding log rank, exports the log output and order corresponding log information;
When receiving the external log level modification order inputted by preset second interface, the journal stage is determined
Whether legal, when determining that the log level modification order is legal, by the corresponding current log of the log if Xiu Gai not order
Level modification is the second log rank in the log level modification order, and output response information.
Preferably,
When being provided with nonvolatile memory,
Before the externally input log output order of the reception, further comprise:
In device power, the current log rank of log is read from nonvolatile memory;
The current log rank is synchronized in global variable;
Corresponding first log rank, packet are ordered in the corresponding current log rank of determining log and log output
It includes:
The corresponding current log rank of the log is read from the global variable;
Read the first log rank in the log output order.
Preferably,
Whether the determination log level modification order is legal, when determining that the log level modification order is legal
When, it is the second log rank in the log level modification order, packet by the corresponding current log level modification of the log
It includes:
The log level modification order is decrypted using preset decipherment algorithm, obtains corresponding decrypted value;
Determine whether the corresponding format of the decrypted value is correct, if so, using the second log rank as working as the day before yesterday
Will rank is stored into the nonvolatile memory, and is the decryption by the corresponding current log level modification of the log
Otherwise the second log rank in value exports the first prompt information, first prompt information is for prompting log rank to be arranged
Failure.
Preferably,
The response message, comprising: the second prompt information and the corresponding log information of the second log rank, wherein
Second prompt information is for prompting log rank to be arranged to function;
The output response information, comprising:
Export second prompt information and the corresponding log information of the second log rank.
Preferably,
Interface is arranged in the log rank, comprising: universal asynchronous receiving-transmitting transmitter and/or untouchable interface;
When log rank setting interface includes: the untouchable interface,
It is described when receiving the external log level modification order inputted by preset second interface, determine the day
Whether the order of will level modification is legal, comprising:
It is external by the untouchable interface receiving, it is repaired according to the log rank that agreement predetermined inputs
When changing order, determine whether the log level modification order is legal.
Second aspect, the embodiment of the invention provides a kind of devices of dynamic configuration device log, comprising: order receives mould
Block, first processing module, Second processing module and information response's module;Wherein,
The Order receiver module, for when receiving externally input log output order, triggering first to handle mould
Block;When receiving the external log level modification order inputted by preset second interface, Second processing module is triggered;
The first processing module determines that log is corresponding current for when being triggered, calling preset first interface
Corresponding first log rank is ordered in log rank and log output, when the first log rank is current not higher than described
When log rank, and controls information response's module and export the corresponding log information of the log output order;
The Second processing module, for when being triggered, determining whether the log level modification order is legal, when true
It is that the log rank is repaired by the corresponding current log level modification of the log when log level modification order is legal calmly
Change the second log rank in order, and controls information response's module output response information.
Preferably,
Further comprise: data simultaneous module;
When being provided with nonvolatile memory,
The data simultaneous module, in device power, that reads log from nonvolatile memory to work as the day before yesterday
Will rank;The current log rank is synchronized in global variable;
The first processing module, for reading the data simultaneous module synchronous day from the global variable
The corresponding current log rank of will;Read the first log rank in the log output order.
Preferably,
The first processing module, for being solved using preset decipherment algorithm to the log level modification order
It is close, obtain corresponding decrypted value;Determine whether the corresponding format of the decrypted value is correct, if so, by second journal stage
Not Zuo Wei current log rank storage repaired into the nonvolatile memory, and by the corresponding current log rank of the log
Otherwise the second log rank being changed in the decrypted value controls information response's module and exports the first prompt information, described
First prompt information is for prompting log rank setup failed.
Preferably,
The response message, comprising: the second prompt information and the corresponding log information of the second log rank, wherein
Second prompt information is for prompting log rank to be arranged to function;
Information response's module, for exporting second prompt information under the control of the first processing module
Log information corresponding with the second log rank.
Preferably,
Interface is arranged in the log rank, comprising: universal asynchronous receiving-transmitting transmitter and/or untouchable interface;
When log rank setting interface includes: the untouchable interface,
The Order receiver module, for receiving outside by the untouchable interface, according to pre-defined
Agreement input log level modification order when, trigger the first processing module and determine that the log level modification order is
It is no legal.
The embodiment of the invention provides a kind of method and devices of dynamic configuration log, in order to improve the safety of log information
Property, the different log informations of equipment can be arranged with different log ranks, receiving what outside inputted according to demand in this way
After log output order, by calling preset first interface to determine, corresponding first log rank is ordered in log output, if
Current log rank corresponding not higher than log, to determine whether outside can call the corresponding log letter of the first log rank
Breath, to improve the safety of log information, and if only if when the first log rank is not higher than current log rank, output phase is answered
Log information;It outside can also according to demand, by preset second interface input journal level modification order to log
Log rank is modified, equipment by determine the order of log level modification it is whether legal come determine it is external whether can be to log
Rank is modified, and is log rank by the current log level modification of log when determining that log level modification order is legal
The second log rank in modification order, and by output response information, so that outside determines log rank by response message
It is whether successfully modified.To sum up, once equipment is attempted to carry out the output of log, first interface is called to realize, therefore,
Can not only guarantee that the output of log is strictly controlled, it is also possible that in different use demands Unified Device code
State realizes the purpose for reducing the management difficulty of equipment;And the other modification of journal stage is realized by second interface, Neng Gou
The other modification of journal stage is completed in the case where not changing device code, not only contributes to the maintenance of device code, the quality of code
Guarantee and the safety of equipment, can be with further such that equipment is unified in different use demand code status, realization be dropped
The purpose of the management difficulty of low equipment.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is the present invention
Some embodiments for those of ordinary skill in the art without creative efforts, can also basis
These attached drawings obtain other attached drawings.
Fig. 1 is a kind of flow chart of the method for dynamic configuration log that one embodiment of the invention provides;
Fig. 2 is the flow chart of the method for another dynamic configuration log that one embodiment of the invention provides;
Fig. 3 is a kind of structural schematic diagram of the device for dynamic configuration device log that one embodiment of the invention provides;
Fig. 4 is the structural schematic diagram of the device for another dynamic configuration device log that one embodiment of the invention provides.
Specific embodiment
In order to make the object, technical scheme and advantages of the embodiment of the invention clearer, below in conjunction with the embodiment of the present invention
In attached drawing, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment is
A part of the embodiment of the present invention, instead of all the embodiments, based on the embodiments of the present invention, those of ordinary skill in the art
Every other embodiment obtained without making creative work, shall fall within the protection scope of the present invention.
As shown in Figure 1, the embodiment of the invention provides a kind of methods of dynamic configuration log, comprising:
Step 101: when receiving externally input log output order, calling preset first interface, determine log
Corresponding first log rank is ordered in corresponding current log rank and log output, when the first log rank is not high
When the current log rank, exports the log output and order corresponding log information;
Step 102: when receiving the external log level modification order inputted by preset second interface, determining institute
Whether legal state the order of log level modification, it is when determining that the log level modification order is legal, the log is corresponding
Current log level modification is the second log rank in the log level modification order, and output response information.
In embodiments of the present invention, in order to improve the safety of log information, the different log informations of equipment can be set
Different log ranks is set, it is preset by calling in this way after receiving the external log output order inputted according to demand
First interface determines that corresponding first log rank is ordered in log output, if it is not higher than the corresponding current log rank of log,
Come determine it is external whether can call the corresponding log information of the first log rank, to improve the safety of log information, when and
Only when the first log rank is not higher than current log rank, corresponding log information is exported;Outside can also according to demand,
It is modified by log rank of the preset second interface input journal level modification order to log, equipment, which passes through, determines day
The order of will level modification it is whether legal come determine it is external whether can modify to log rank, when determining log level modification
It is the second log rank in the order of log level modification by the current log level modification of log, and pass through when ordering legal
Output response information, so that outside determines whether log rank is successfully modified by response message.To sum up, once equipment is tasted
Examination carries out the output of log, calls first interface to realize, therefore, can not only guarantee that the output of log is strictly controlled
System, it is also possible that in different use demands Unified Device code status, realize reduce equipment management difficulty mesh
's;And the other modification of journal stage is realized by second interface, and log can be completed in the case where not changing device code
The modification of rank not only contributes to the maintenance of device code, the quality assurance of code and the safety of equipment, can also be into
One step makes equipment unified in different use demand code status, realizes the purpose for reducing the management difficulty of equipment.
In an embodiment of the present invention, when being provided with nonvolatile memory,
Before the externally input log output order of the reception, further comprise:
In device power, the current log rank of log is read from nonvolatile memory;
The current log rank is synchronized in global variable;
Corresponding first log rank, packet are ordered in the corresponding current log rank of determining log and log output
It includes:
The corresponding current log rank of the log is read from the global variable;
Read the first log rank in the log output order.
In embodiments of the present invention, if equipment can working as log in device power with nonvolatile memory
Preceding log rank is synchronized in global variable from nonvolatile memory, and such equipment is in operating status and it needs to be determined that log
When current log rank, the current log rank of log can be determined from global variable, without from nonvolatile memory
The middle current log rank for reading log, therefore, it is possible to reduce the number that nonvolatile memory is read extends non-volatile
The service life of memory.
If it is understood that and equipment without nonvolatile memory, equipment powers on every time, can be silent to dispatch from the factory
Rank is recognized as current log rank to be judged.
In order to improve the safety of log, in an embodiment of the present invention, the determination log level modification order
It is whether legal, when determining that the log level modification order is legal, be by the corresponding current log level modification of the log
The second log rank in the log level modification order, comprising:
The log level modification order is decrypted using preset decipherment algorithm, obtains corresponding decrypted value;
Determine whether the corresponding format of the decrypted value is correct, if so, using the second log rank as working as the day before yesterday
Will rank is stored into the nonvolatile memory, and is the decryption by the corresponding current log level modification of the log
Otherwise the second log rank in value exports the first prompt information, first prompt information is for prompting log rank to be arranged
Failure.
In embodiments of the present invention, the external log level modification order inputted can be by encrypted order,
The order is imitated after the log level modification order for stealing plaintext version to avoid illegal user, and then to the journal stage of equipment
It does not modify and causes the leakage of log information.The log level modification that this is received can be ordered by preset decipherment algorithm
Order is decrypted, and obtains the decrypted value of plaintext version, and whether the format by determining decrypted value is correct, can determine the decrypted value
It whether is lawful order, however, it is determined that the format of decrypted value is correct, then can store the second log rank in decrypted value to non-
It in volatile memory, when to determine log rank again, is determined by information in nonvolatile memory, then by log
Current log level modification be the second log rank, the other modification of journal stage can be completed, and if the format of decrypted value not just
Really, then the first prompt information for prompting log rank setup failed can be exported, so that outside understands log level modification
Failure.
If it is understood that and equipment without nonvolatile memory, after outside modifies to log rank,
The log rank being newly written is effective during time operation in equipment.
Understand whether the setting of log rank succeeds in order to facilitate user, in an embodiment of the present invention, the response message,
It include: the second prompt information and the corresponding log information of the second log rank, wherein second prompt information is for mentioning
Show that log rank is arranged to function;
The output response information, comprising:
Export second prompt information and the corresponding log information of the second log rank.
In embodiments of the present invention, it after modifying to log rank, can export for prompting log rank to be arranged
Corresponding log information after successful second prompt information and log level modification is repaired so that user understands log rank
Change situation.
In an embodiment of the present invention, interface is arranged in the log rank, comprising: universal asynchronous receiving-transmitting transmitter and/or
Untouchable interface;
When log rank setting interface includes: the untouchable interface,
It is described when receiving the external log level modification order inputted by preset second interface, determine the day
Whether the order of will level modification is legal, comprising:
It is external by the untouchable interface receiving, it is repaired according to the log rank that agreement predetermined inputs
When changing order, determine whether the log level modification order is legal.
In embodiments of the present invention, the second interface for the modification log level commands of accessory external input, which can be, connects
The interface of touching property, such as universal asynchronous receiving-transmitting transmitter, can also be untouchable interface (such as TCP/UDP interface), with
Make to provide different journal stages other set-up mode for user, improves the usage experience of user.And it is arranged in log rank
It is external to be inputted by the untouchable interface, and according to agreement predetermined when interface is untouchable interface
Log level modification order, such equipment could identify the order, modify according still further to the order to log rank.
In order to more clearly illustrate technical solution of the present invention and advantage, below to one kind provided in an embodiment of the present invention
The method of dynamic configuration log is described in detail, as shown in Fig. 2, can specifically include following steps:
Step 201: in device power, the current log rank of log is read from nonvolatile memory.
Step 202: current log rank is synchronized in global variable.
Specifically, if equipment can be from nonvolatile memory in equipment when powering on nonvolatile memory
The current log rank of device log is read, and is synchronized in global variable.So that in the current log rank for determining log
When, it is read from global variable, to reduce the reading times of nonvolatile memory, extend nonvolatile memory uses the longevity
Life.If equipment, without nonvolatile memory, equipment is when powering on, current log of the meeting using factory default rank as log
Rank.
Step 203: receiving externally input log output order.
Step 204: calling log printing interface to execute: reading the current log rank of log from global variable.
Step 205: reading the first log rank in log output order.
Specifically, outside if you need to check, print log information, can with input journal export order, equipment needs pass through tune
With unified log printing interface, the first entrained log rank of log output order is determined, and read the current of log
Log rank, to determine whether to export corresponding log information according to current log rank and the first log rank.Due to day
The realization of will is using unified log printing interface, it is ensured that the output of log is strictly controlled, and can also be avoided not
Same use demand leads to the skimble-scamble situation of the code status of equipment, to reduce the management difficulty of equipment.
Step 206: determining whether the first log rank is not higher than current log rank.
Specifically, the log rank as set by different log informations is different, corresponding to more sensitive log information
Log rank it is also relatively high, therefore when whether can check outside determination, print required log information, it is thus necessary to determine that its
Whether the corresponding first log rank of the log information called is not higher than the current log rank of log, if so, can be defeated
Corresponding information out, completes the print service of log information, if it is not, not handling then, to improve the safety of log information.
Step 207: if so, corresponding log information is ordered in output journal output.
Step 208:, the log that according to preset agreement inputs external by preset untouchable interface receiving
When level modification order, log level modification order is decrypted using preset decipherment algorithm, obtains corresponding decrypted value.
Specifically, outside can be according to different application scenarios, when modifying the log rank of log, and modifying log rank
Can by untouchable interface (such as: UART) modify, can also be by the interface of contact (for example, UDP/TCP connects
Mouthful) modify, when outside modifies to log rank by untouchable interface, need to input according to preset agreement
Agreement predetermined carries out the other modification of journal stage.
In order to improve equipment log information safety, outside when modifying to log rank, need input plus
Log level modification order is formed by after close, such equipment is decrypted log rank by preset decipherment algorithm, i.e.,
It can get corresponding decrypted value, be that can determine whether the external order inputted is legal by the decrypted value.
It is understood that preset decipherment algorithm can be the symmetric encipherment algorithm made an appointment, it is non-right to be also possible to
Claim Encryption Algorithm.
Step 209: determining whether the corresponding format of decrypted value is correct, if so, executing step 210, otherwise, execute step
213。
Specifically, by determining whether the format for obtaining decrypted value is correct, can determine whether the decrypted value is illegally to order
It enables, however, it is determined that when the format of decrypted value is correct, can determine that the decrypted value is lawful order, therefore can be according in the decrypted value
The second log rank modify to the rank of log, however, it is determined that decrypted value is illegal command, then response log rank be arranged
Failure, to prompt outside.
Step 210: being the second log rank in decrypted value by the corresponding current log level modification of log.
It specifically, can be according to the second log rank in decrypted value, to log when determining decrypted value is lawful order
Current log rank modify, to complete the other modification of journal stage.
Step 211: the second prompt information of output and the corresponding log information of the second log rank, wherein the second prompt letter
Breath is for prompting log rank to be arranged to function.
Specifically, after to the log level modification of log, response log rank is needed to be arranged successfully, and respond correspondence
Log information, so as to combined outside response information determine whether log rank successfully modified.
Step 212: storing the second log rank as current log rank into nonvolatile memory.
Specifically, if equipment has nonvolatile memory, the second log rank of setting can be kept permanently having
Effect is stored modified second log rank as current log rank into nonvolatile memory, again so as to equipment
It is secondary when powering on, using the log rank stored in nonvolatile memory as current log rank.
And if equipment without nonvolatile memory when, the log rank that is newly written having during time operation equipment
Effect, can be using the factory default rank of log as current log rank after equipment powers on again.
Step 213: the first prompt information of output, wherein the first prompt information is for prompting log rank setup failed.
Specifically, when determining that externally input log level modification order is illegal, can be arranged with response log rank
Failure, so that outside understands the other modification situation of journal stage.
It should be noted that in order to improve the safety of log information, the log rank of equipment storage can be only band and close
The log rank of key information.And smart machine is in Product Status, it is only necessary to which the critical information of open only a few is hidden and set
Standby a large amount of interactive information play the purpose of protection device data.
As shown in figure 3, the embodiment of the invention provides a kind of devices of dynamic configuration device log, comprising:
Order receiver module 301, first processing module 302, Second processing module 303 and information response's module 304;Its
In,
The Order receiver module 301, for when receiving externally input log output order, triggering first to be handled
Module 302;When receiving the external log level modification order inputted by preset second interface, second processing mould is triggered
Block 303;
The first processing module 302 determines that log is corresponding for when being triggered, calling preset first interface
Corresponding first log rank is ordered in current log rank and log output, when the first log rank is not higher than described
When current log rank, and controls information response's module 304 and export the corresponding log information of the log output order;
The Second processing module 303, for when being triggered, determining whether the log level modification order is legal,
It is the journal stage by the corresponding current log level modification of the log when determining that the log level modification order is legal
The second log rank in Xiu Gai not ordering, and control the 304 output response information of information response's module.
In embodiments of the present invention, in order to improve the safety of log information, the different log informations of equipment can be set
Different log ranks is set, such Order receiver module is after receiving the external log output order inputted according to demand, touching
Hair first processing module is by calling preset first interface to determine that corresponding first log rank is ordered in log output, if no
Current log rank corresponding higher than log, to determine whether outside can call the corresponding log information of the first log rank,
To improve the safety of log information, and if only if the first log rank be not higher than current log rank when, at first
It manages module control information respond module and exports corresponding log information;Outside can also connect by preset second according to demand
Mouthful input journal level modification order modifies to the log rank of log, and Order receiver module is repaired receiving log rank
When changing order, Second processing module can be triggered, by Second processing module determine the order of log level modification it is whether legal come
Determine whether outside can modify to log rank, when determining that log level modification order is legal, by the current of log
Log rank is revised as the second log rank in log level modification order, and controls information response's module output response letter
Breath, so that outside determines whether log rank is successfully modified by response message.To sum up, once equipment is attempted to carry out log
Output, call first interface to realize, therefore, can not only guarantee that the output of log is strictly controlled, can be with
So that in different use demands Unified Device code status, realize reduce equipment management difficulty purpose;And log
The modification of rank is realized by second interface, can complete that journal stage is other to be repaired in the case where not changing device code
Change, not only contribute to the maintenance of device code, the quality assurance of code and the safety of equipment, can with further such that
Equipment is unified in different use demand code status, realizes the purpose for reducing the management difficulty of equipment.
Based on the device of dynamic configuration device log described in Fig. 3, in an embodiment of the present invention, as shown in figure 4, into one
Step includes: data simultaneous module 401;
When being provided with nonvolatile memory,
The data simultaneous module 401, for reading the current of log from nonvolatile memory in device power
Log rank;The current log rank is synchronized in global variable;
The first processing module 302, for reading the synchronization of data simultaneous module 401 from the global variable
The corresponding current log rank of the log;Read the first log rank in the log output order.
In an embodiment of the present invention, the first processing module, for utilizing preset decipherment algorithm to the log
Level modification order is decrypted, and obtains corresponding decrypted value;Determine whether the corresponding format of the decrypted value is correct, if
It is to store the second log rank as current log rank into the nonvolatile memory, and by the log
Corresponding current log level modification is otherwise the second log rank in the decrypted value controls information response's module
The first prompt information is exported, first prompt information is for prompting log rank setup failed.
9, device according to claim 6, which is characterized in that
The response message, comprising: the second prompt information and the corresponding log information of the second log rank, wherein
Second prompt information is for prompting log rank to be arranged to function;
Information response's module, for exporting second prompt information under the control of the first processing module
Log information corresponding with the second log rank.
10, according to the device any in claim 6 to 9, which is characterized in that
Interface is arranged in the log rank, comprising: universal asynchronous receiving-transmitting transmitter and/or untouchable interface;
When log rank setting interface includes: the untouchable interface,
The Order receiver module, for receiving outside by the untouchable interface, according to pre-defined
Agreement input log level modification order when, trigger the first processing module and determine that the log level modification order is
It is no legal.
The each embodiment of the present invention at least has the following beneficial effects:
1, in an embodiment of the present invention, in order to improve the safety of log information, the different logs of equipment can be believed
Different log ranks is arranged in breath, pre- by calling in this way after receiving the external log output order inputted according to demand
If first interface determine that corresponding first log rank is ordered in log output, if be not higher than the corresponding current log grade of log
Not, come determine it is external whether can call the corresponding log information of the first log rank, to improve the safety of log information, when
And if only if exporting corresponding log information when the first log rank is not higher than current log rank;It outside can also be according to need
It asks, is modified by log rank of the preset second interface input journal level modification order to log, equipment passes through true
Settled date will level modification order it is whether legal come determine it is external whether can modify to log rank, when determining log rank
It is the second log rank in the order of log level modification by the current log level modification of log when modification order is legal, and
By output response information, so that outside determines whether log rank is successfully modified by response message.To sum up, once setting
The standby output for attempting to carry out log, calls first interface to realize, therefore, can not only guarantee the output of log strictly by
To control, it is also possible that in different use demands Unified Device code status, realize reduce equipment management difficulty
Purpose;And the other modification of journal stage is realized by second interface, can be completed in the case where not changing device code
The other modification of journal stage not only contributes to the maintenance of device code, the quality assurance of code and the safety of equipment, may be used also
With further such that equipment is unified in different use demand code status, realization reduces the purpose of the management difficulty of equipment.
2, in an embodiment of the present invention, if equipment can be by log in device power with nonvolatile memory
Current log rank be synchronized in global variable from nonvolatile memory, such equipment is in operating status and it needs to be determined that day
When the current log rank of will, the current log rank of log can be determined from global variable, without depositing from non-volatile
The current log rank of log is read in reservoir, therefore, it is possible to reduce the number that nonvolatile memory is read extends non-easy
The service life of the property lost memory.
3, in an embodiment of the present invention, the external log level modification order inputted can be by encrypted life
It enables, imitates the order after the log level modification order for stealing plaintext version to avoid illegal user, and then to the day of equipment
Will rank, which is modified, causes the leakage of log information.The log rank that this is received can be repaired by preset decipherment algorithm
Change order to be decrypted, obtain the decrypted value of plaintext version, whether the format by determining decrypted value is correct, can determine the solution
Whether close value is lawful order, however, it is determined that the format of decrypted value is correct, then can store the second log rank in decrypted value
It into nonvolatile memory, when to determine log rank again, is determined by the information in nonvolatile memory, then will
The current log level modification of log is the second log rank, the other modification of journal stage can be completed, and if the format of decrypted value
It is incorrect, then the first prompt information for prompting log rank setup failed can be exported, so that outside understands log rank
Modification failure.
4, it in an embodiment of the present invention, after modifying to log rank, can export for prompting log rank
Corresponding log information after successful second prompt information and log level modification is set, so that user understands journal stage
It Xiu Gai not situation.
5, in an embodiment of the present invention, the second interface for the modification log level commands of accessory external input can be with
It is the interface of contact, such as universal asynchronous receiving-transmitting transmitter, can also be that (for example TCP/UDP connects for untouchable interface
Mouthful), so as to provide different journal stages other set-up mode for user, improve the usage experience of user.And in journal stage
Not She Zhi interface when being untouchable interface, it is external can be by the untouchable interface, and according to association predetermined
The order of input journal level modification is discussed, such equipment could identify the order, modify according still further to the order to log rank.
It should be noted that, in this document, such as first and second etc relational terms are used merely to an entity
Or operation is distinguished with another entity or operation, is existed without necessarily requiring or implying between these entities or operation
Any actual relationship or order.Moreover, the terms "include", "comprise" or its any other variant be intended to it is non-
It is exclusive to include, so that the process, method, article or equipment for including a series of elements not only includes those elements,
It but also including other elements that are not explicitly listed, or further include solid by this process, method, article or equipment
Some elements.In the absence of more restrictions, the element limited by sentence " including a 〃 〃 ", it is not excluded that
There is also other identical factors in the process, method, article or apparatus that includes the element.
Finally, it should be noted that the foregoing is merely presently preferred embodiments of the present invention, it is merely to illustrate skill of the invention
Art scheme, is not intended to limit the scope of the present invention.Any modification for being made all within the spirits and principles of the present invention,
Equivalent replacement, improvement etc., are included within the scope of protection of the present invention.
Claims (10)
1. a kind of method of dynamic configuration log characterized by comprising
When receiving externally input log output order, preset first interface is called, determines that log is corresponding and works as the day before yesterday
Corresponding first log rank is ordered in will rank and log output, when the first log rank works as the day before yesterday not higher than described
When will rank, exports the log output and order corresponding log information;
When receiving the external log level modification order inputted by preset second interface, determine that the log rank is repaired
Whether legal change order, when determining that the log level modification order is legal, by the corresponding current log rank of the log
The second log rank being revised as in the log level modification order, and output response information.
2. the method according to claim 1, wherein
When being provided with nonvolatile memory,
Before the externally input log output order of the reception, further comprise:
In device power, the current log rank of log is read from nonvolatile memory;
The current log rank is synchronized in global variable;
Corresponding first log rank is ordered in the corresponding current log rank of determining log and log output, comprising:
The corresponding current log rank of the log is read from the global variable;
Read the first log rank in the log output order.
3. according to the method described in claim 2, it is characterized in that,
Whether the determination log level modification order is legal, will when determining that the log level modification order is legal
The corresponding current log level modification of the log is the second log rank in the log level modification order, comprising:
The log level modification order is decrypted using preset decipherment algorithm, obtains corresponding decrypted value;
Determine whether the corresponding format of the decrypted value is correct, if so, using the second log rank as current log grade
It Cun Chu be not in the decrypted value into the nonvolatile memory, and by the corresponding current log level modification of the log
The second log rank, otherwise, export the first prompt information, first prompt information for prompt log rank setting lose
It loses.
4. the method according to claim 1, wherein
The response message, comprising: the second prompt information and the corresponding log information of the second log rank, wherein described
Second prompt information is for prompting log rank to be arranged to function;
The output response information, comprising:
Export second prompt information and the corresponding log information of the second log rank.
5. according to claim 1 to any method in 4, which is characterized in that
Interface is arranged in the log rank, comprising: universal asynchronous receiving-transmitting transmitter and/or untouchable interface;
When log rank setting interface includes: the untouchable interface,
It is described when receiving the external log level modification order inputted by preset second interface, determine the journal stage
Whether Xiu Gai not order legal, comprising:
It is external by the untouchable interface receiving, it is ordered according to the log level modification of agreement predetermined input
When enabling, determine whether the log level modification order is legal.
6. a kind of device of dynamic configuration device log characterized by comprising Order receiver module, first processing module,
Two processing modules and information response's module;Wherein,
The Order receiver module, for triggering first processing module when receiving externally input log output order;?
When receiving the external log level modification order inputted by preset second interface, Second processing module is triggered;
The first processing module determines the corresponding current log of log for when being triggered, calling preset first interface
Corresponding first log rank is ordered in rank and log output, when the first log rank is not higher than the current log
When rank, and controls information response's module and export the corresponding log information of the log output order;
The Second processing module, for when being triggered, determining whether the log level modification order is legal, when determining
State log level modification order it is legal when, by the corresponding current log level modification of the log be the log level modification order
The second log rank in order, and control information response's module output response information.
7. device according to claim 6, which is characterized in that further comprise: data simultaneous module;
When being provided with nonvolatile memory,
The data simultaneous module, for reading the current log grade of log from nonvolatile memory in device power
Not;The current log rank is synchronized in global variable;
The first processing module, for reading the synchronous log pair of the data simultaneous module from the global variable
The current log rank answered;Read the first log rank in the log output order.
8. device according to claim 7, which is characterized in that
The first processing module is obtained for the log level modification order to be decrypted using preset decipherment algorithm
Obtain corresponding decrypted value;Determine whether the corresponding format of the decrypted value correct, if so, using the second log rank as
The storage of current log rank is institute into the nonvolatile memory, and by the corresponding current log level modification of the log
The second log rank in decrypted value is stated, otherwise, information response's module is controlled and exports the first prompt information, described first mentions
Show information for prompting log rank setup failed.
9. device according to claim 6, which is characterized in that
The response message, comprising: the second prompt information and the corresponding log information of the second log rank, wherein described
Second prompt information is for prompting log rank to be arranged to function;
Information response's module, for exporting second prompt information and institute under the control of the first processing module
State the corresponding log information of the second log rank.
10. according to the device any in claim 6 to 9, which is characterized in that
Interface is arranged in the log rank, comprising: universal asynchronous receiving-transmitting transmitter and/or untouchable interface;
When log rank setting interface includes: the untouchable interface,
The Order receiver module, for receiving outside by the untouchable interface, according to association predetermined
When discussing the log level modification order of input, triggers the first processing module and determine whether the log level modification order closes
Method.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910247872.0A CN110007956A (en) | 2019-03-29 | 2019-03-29 | A kind of method and device of dynamic configuration log |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910247872.0A CN110007956A (en) | 2019-03-29 | 2019-03-29 | A kind of method and device of dynamic configuration log |
Publications (1)
Publication Number | Publication Date |
---|---|
CN110007956A true CN110007956A (en) | 2019-07-12 |
Family
ID=67168831
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910247872.0A Pending CN110007956A (en) | 2019-03-29 | 2019-03-29 | A kind of method and device of dynamic configuration log |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110007956A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111090460A (en) * | 2019-10-12 | 2020-05-01 | 浙江大学 | Code change log automatic generation method based on nearest neighbor algorithm |
CN111182066A (en) * | 2019-12-31 | 2020-05-19 | 青梧桐有限责任公司 | Log level dynamic adjustment method based on token authentication |
CN114500253A (en) * | 2022-01-13 | 2022-05-13 | 北京特立信电子技术股份有限公司 | Log information storage method and storage medium |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102650938A (en) * | 2011-02-28 | 2012-08-29 | 北京航空航天大学 | Management method for log system and log system |
US20140007119A1 (en) * | 2012-06-29 | 2014-01-02 | International Business Machines Corporation | Dynamically Adjusting a Log Level of a Transaction |
CN105843822A (en) * | 2015-01-16 | 2016-08-10 | 北京神州泰岳软件股份有限公司 | Method and device for changing log levels |
CN108846070A (en) * | 2018-06-07 | 2018-11-20 | 北京京东尚科信息技术有限公司 | Log processing method, system, electronic equipment and the storage medium of distributed system |
-
2019
- 2019-03-29 CN CN201910247872.0A patent/CN110007956A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102650938A (en) * | 2011-02-28 | 2012-08-29 | 北京航空航天大学 | Management method for log system and log system |
US20140007119A1 (en) * | 2012-06-29 | 2014-01-02 | International Business Machines Corporation | Dynamically Adjusting a Log Level of a Transaction |
CN105843822A (en) * | 2015-01-16 | 2016-08-10 | 北京神州泰岳软件股份有限公司 | Method and device for changing log levels |
CN108846070A (en) * | 2018-06-07 | 2018-11-20 | 北京京东尚科信息技术有限公司 | Log processing method, system, electronic equipment and the storage medium of distributed system |
Non-Patent Citations (1)
Title |
---|
CS408: ""(转)log4j(三)——如何控制不同级别的日志信息的输出?"", 《HTTPS://WWW.CNBLOGS.COM/LIXUWU/P/7235033.HTML》 * |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111090460A (en) * | 2019-10-12 | 2020-05-01 | 浙江大学 | Code change log automatic generation method based on nearest neighbor algorithm |
CN111182066A (en) * | 2019-12-31 | 2020-05-19 | 青梧桐有限责任公司 | Log level dynamic adjustment method based on token authentication |
CN114500253A (en) * | 2022-01-13 | 2022-05-13 | 北京特立信电子技术股份有限公司 | Log information storage method and storage medium |
CN114500253B (en) * | 2022-01-13 | 2024-03-12 | 北京特立信电子技术股份有限公司 | Log information storage method and storage medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110007956A (en) | A kind of method and device of dynamic configuration log | |
US10268845B2 (en) | Securing of the loading of data into a nonvolatile memory of a secure element | |
CN107196907B (en) | A kind of guard method of Android SO files and device | |
CN107832065A (en) | Firmware upgrade method, water purifier, upgrade-system and readable storage medium storing program for executing | |
CN109587142B (en) | Data security access module and equipment for service flow | |
CN103455349A (en) | Method and device for accessing intelligent card by application program | |
CN106020868B (en) | A kind of smart card firmware update and system | |
CN104378375A (en) | Remote access method for mobile phone, terminal device, server and system | |
CN105740013B (en) | Brush machine method of controlling operation thereof and device | |
US9298949B2 (en) | Method for programming a mobile end device chip | |
CN102402470A (en) | Method and device for automatically correcting error of program of flash memory and repairing program of flash memory | |
CN108898725A (en) | A kind of control method and device of door lock | |
CN101170765A (en) | Generation and authentication method for telecommunication intelligent card | |
CN104881351A (en) | Method and system for controlling journal output of mobile terminal | |
CN103684745B (en) | Set-top box copy prevention method, set-top-box system and set-top box | |
CN111093190B (en) | Method, device, system, electronic equipment and storage medium for writing key data | |
CN103379478A (en) | Control method, control system, client terminal and server | |
CN101236674A (en) | Intelligent cipher key equipment and method for information exchange with external apparatus | |
CN110298166A (en) | Control method, terminal device and the commissioning device of operating system debugging permission | |
CN103577204A (en) | Software upgrading method and software upgrading system for mobile devices | |
CN110764835A (en) | File configuration method and device of application environment, computer equipment and storage medium | |
JP2017536781A (en) | How to restore the maintenance element to the factory state | |
CN105592033B (en) | trusted service management system and method | |
CN115729568A (en) | Program burning protection method and device, burner and board card | |
TW201723946A (en) | Method and apparatus for switching point-of-sale (POS) terminal modes |
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 |
Application publication date: 20190712 |
|
RJ01 | Rejection of invention patent application after publication |