CN109582532A - Electronic device, log method of controlling switch and computer readable storage medium - Google Patents

Electronic device, log method of controlling switch and computer readable storage medium Download PDF

Info

Publication number
CN109582532A
CN109582532A CN201811252898.6A CN201811252898A CN109582532A CN 109582532 A CN109582532 A CN 109582532A CN 201811252898 A CN201811252898 A CN 201811252898A CN 109582532 A CN109582532 A CN 109582532A
Authority
CN
China
Prior art keywords
log
program
preset
switch
switch state
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
CN201811252898.6A
Other languages
Chinese (zh)
Other versions
CN109582532B (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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201811252898.6A priority Critical patent/CN109582532B/en
Publication of CN109582532A publication Critical patent/CN109582532A/en
Application granted granted Critical
Publication of CN109582532B publication Critical patent/CN109582532B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3089Monitoring arrangements determined by the means or processing involved in sensing the monitored data, e.g. interfaces, connectors, sensors, probes, agents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/30Monitoring
    • G06F11/3065Monitoring arrangements determined by the means or processing involved in reporting the monitored data

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The present invention relates to a kind of pedestal O&M technology, a kind of log method of controlling switch, electronic device and computer readable storage medium are disclosed.The present invention obtains the first switch state for aiming at controlling the time day and assessment parameter of program when reaching the log switch control time of some program, determines that rule is that the log of program determines a second switch state according to assessment parameter and preset switches state;When second switch state is identical as first switch state, keeping the log switch state of program is first switch state;When the second log switch state is different from first switch state, the log switch state of program is adjusted to second switch state by first switch state.Compared to the prior art, compared to the prior art, the present invention can automatically control log switch state.

Description

Electronic device, log switch control method, and computer-readable storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to an electronic device, a log switch control method, and a computer-readable storage medium.
Background
During the running process, the program generates various log files, such as application program logs, security logs, system logs, and the like, and the log files usually record relevant contents and data of user operations. In actual use, when a problem occurs in the running process of a program, the log is the key of positioning, troubleshooting and information tracing of the application program. However, if log data is frequently accessed, the operating efficiency of the program is seriously affected. In order to avoid frequent access to log data, it is common practice to provide a log switch for the log, the state of the log switch being manually controlled, and when the log switch is in the off state, the log cannot be accessed, and when the log switch is in the on state, the log can be accessed. Although the method solves the problem of frequent log data access to a certain extent, because the state of the log switch is manually controlled, if an operator forgets to close the log switch in time due to misoperation, the log can be in a state of being accessible for a long time, and the running efficiency of the program is influenced. Therefore, how to realize the automatic control of the log switch state has become a technical problem to be solved urgently.
Disclosure of Invention
In view of the above, the present invention provides an electronic device, a log switch control method and a computer readable storage medium, which aim to solve the problem of how to automatically control the log switch state.
First, to achieve the above object, the present invention provides an electronic device, which includes a memory and a processor, wherein the memory stores a log switch control program, and the log switch control program, when executed by the processor, implements the following steps:
a first determination step: when the log switch control time of a certain program is reached, acquiring a first switch state and an evaluation parameter of the log of the program at the control time, and determining a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule;
a second determination step: when the second switch state is the same as the first switch state, keeping the log switch state of the program as the first switch state;
an adjusting step: when the second log switch state is different from the first switch state, adjusting the log switch state of the program from the first switch state to the second switch state.
Preferably, the evaluation parameters include: the method comprises the steps of current time information, the accumulated opening times of a log switch in a first preset time interval, program identification information and operating environment information.
Preferably, the running environment information of the program includes: the step of determining a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule comprises the following steps:
acquiring a weight value of the program;
substituting the weighted value of the program, the memory utilization rate, the CPU utilization rate, the storage space utilization rate, the time value corresponding to the current time information and the accumulated opening times of the log switch in a first preset time interval into a preset formula:
Q=P×((1-M)×a+(1-C)×b+(1-S)×c)+(d-|T-e|)+A
wherein Q is an evaluation score, P is a weight value of the program, M is a memory utilization rate, C is a CPU utilization rate, S is a storage space utilization rate, T is a time value corresponding to current time information, A is an accumulated opening time of a log switch in a first preset time interval, and a, b, C, d and e are constants;
obtaining the evaluation score obtained by calculation;
when the evaluation score is larger than or equal to a preset score, determining that the second log switch state is on;
and when the evaluation score is smaller than a preset score, determining that the second log switch state is closed.
Preferably, before the first determining step, the log switch control program when executed by the processor further implements:
monitoring whether the current time reaches a predetermined log switch control time in real time according to a plurality of predetermined log switch control times corresponding to the program;
or,
setting a first preset time according to a predetermined setting rule, recording the interval time between the current time and the last log switch control time in real time, and monitoring whether the interval time is equal to the first preset time or not in real time.
Preferably, the predetermined setting rule includes:
acquiring the accumulated opening times of the log switch in a second preset time interval;
when the accumulated opening times of the log switch in the second preset time interval is greater than or equal to a first preset threshold, the first preset time length is equal to the sum of the second preset time length and a third preset time length;
when the accumulated opening times of the log switch in the second preset time interval is smaller than or equal to the second preset threshold, the first preset time length is equal to the difference value between the second preset time length and a third preset time length;
and when the accumulated opening times of the log switch in the second preset time interval are smaller than the first preset threshold and larger than the second preset threshold, the first preset time length is equal to a second preset time length.
In addition, in order to achieve the purpose, the invention further provides a log switch control method. The method comprises the following steps:
a first determination step: when the log switch control time of a certain program is reached, acquiring a first switch state and an evaluation parameter of the log of the program at the control time, and determining a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule;
a second determination step: when the second switch state is the same as the first switch state, keeping the log switch state of the program as the first switch state;
an adjusting step: when the second log switch state is different from the first switch state, adjusting the log switch state of the program from the first switch state to the second switch state.
Preferably, the evaluation parameters include: the method comprises the steps of current time information, the accumulated opening times of a log switch in a first preset time interval, program identification information and operating environment information.
Preferably, the running environment information of the program includes: the step of determining a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule comprises the following steps:
acquiring a weight value of the program;
substituting the weighted value of the program, the memory utilization rate, the CPU utilization rate, the storage space utilization rate, the time value corresponding to the current time point and the accumulated opening times of the log switch in a first preset time interval into a preset formula:
Q=P×((1-M)×a+(1-C)×b+(1-S)×c)+(d-|T-e|)+A
wherein Q is an evaluation score, P is a weight value of the program, M is a memory utilization rate, C is a CPU utilization rate, S is a storage space utilization rate, T is a time value corresponding to current time information, A is an accumulated opening time of a log switch in a first preset time interval, and a, b, C, d and e are constants;
obtaining the evaluation score obtained by calculation;
when the evaluation score is larger than or equal to a preset score, determining that the second log switch state is on;
and when the evaluation score is smaller than a preset score, determining that the second log switch state is closed.
Preferably, before the first determining step, the method further comprises:
monitoring whether the current time point reaches a predetermined log switch control time point or not in real time according to a plurality of predetermined log switch control time points corresponding to the program;
or,
setting a first preset time according to a predetermined setting rule, recording the interval time between the current time point and the last time point of the log switch control in real time, and monitoring whether the interval time is equal to the first preset time or not in real time.
Preferably, the predetermined setting rule includes:
acquiring the accumulated opening times of the log switch in a second preset time interval;
when the accumulated opening times of the log switch in the second preset time interval is greater than or equal to a first preset threshold, the first preset time length is equal to the sum of the second preset time length and a third preset time length;
when the accumulated opening times of the log switch in the second preset time interval is smaller than or equal to the second preset threshold, the first preset time length is equal to the difference value between the second preset time length and a third preset time length;
and when the accumulated opening times of the log switch in the second preset time interval are smaller than the first preset threshold and larger than the second preset threshold, the first preset time length is equal to a second preset time length.
The present invention also provides a computer-readable storage medium storing a log switch control program executable by at least one processor to cause the at least one processor to execute the log switch control method.
When the log on-off control time of a certain program is reached, acquiring a first on-off state and an evaluation parameter of the log of the program at the control time, and determining a second on-off state for the log of the program according to the evaluation parameter and a preset on-off state determination rule; when the second switch state is the same as the first switch state, keeping the log switch state of the program as the first switch state; and when the second log switch state is different from the first switch state, adjusting the log switch state of the program from the first switch state to the second switch state. Compared with the prior art, the log on-off state can be automatically controlled according to the evaluation parameters when the log on-off control time is up, so that on one hand, the problem that the program running efficiency is reduced due to the fact that the log switch is in the on state for a long time is avoided, on the other hand, the log on-off control efficiency is improved, and the labor cost is saved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the structures shown in the drawings without creative efforts.
Fig. 1 is a schematic diagram of an electronic device according to an embodiment of the invention;
FIG. 2 is a block diagram of a first embodiment of the log switch control routine of FIG. 1;
FIG. 3 is a block diagram of a second embodiment of the log switch control routine of FIG. 1;
fig. 4 is a flowchart of a log switch control method according to a first embodiment of the present invention;
fig. 5 is a flowchart of a log switch control method according to a second embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
The principles and features of this invention are described below in conjunction with the following drawings, which are set forth by way of illustration only and are not intended to limit the scope of the invention.
The invention provides an electronic device.
Referring to fig. 1, fig. 1 is a schematic view of an electronic device according to an embodiment of the invention.
In the present embodiment, the log switch control program 10 is installed and run in the electronic apparatus 1. The electronic device 1 may be a desktop computer, a notebook, a palm computer, a server, or other computing equipment. The electronic device 1 may include, but is not limited to, a memory 11 and a processor 12. Fig. 1 only shows the electronic device 1 with components 11 and 12, but it is to be understood that not all of the shown components are required to be implemented, and that more or fewer components may alternatively be implemented.
The memory 11 may in some embodiments be an internal storage unit of the electronic device 1, such as a hard disk or a memory of the electronic device 1. The memory 11 may also be an external storage device of the electronic apparatus 1 in other embodiments, such as a plug-in hard disk provided on the electronic apparatus 1, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory 11 may also include an internal storage unit and an external storage device of the electronic apparatus 1. The memory 11 is used for storing application software installed in the electronic device 1 and various data, such as program codes of the log switch control program 10. The memory 11 may also be used to temporarily store data that has been output or is to be output.
The processor 12 may be a Central Processing Unit (CPU), microprocessor or other data Processing chip in some embodiments, and is used for executing program codes stored in the memory 11 or Processing data, such as executing the log switch control program 10.
Referring to fig. 2, fig. 2 is a block diagram of a log switch control program according to a first embodiment of the present invention. In this embodiment, the log switch control program 10 may be divided into one or more modules, and the one or more modules are stored in the memory 11 and executed by one or more processors (in this embodiment, the processor 12) to complete the present invention. For example, in fig. 2, the log switch control program 10 may be divided into a determination module 101 and an adjustment module 102. The module referred to in the present invention refers to a series of computer program instruction segments capable of performing specific functions, and is more suitable than a program for describing the execution process of the log switch control program 10 in the electronic device 1, wherein:
the determining module 101 is configured to, when a log switch control time of a certain program arrives, obtain a first switch state and an evaluation parameter of a log of the program at the control time, and determine a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule.
The evaluation parameters comprise current time information, cumulative opening times of the log switch in a first preset time interval, identification information of the program and running environment information. The running environment information of the program comprises the memory utilization rate, the CPU utilization rate and the storage space utilization rate of the running environment. Further, the current time information refers to time information at which the evaluation parameter of the program is currently acquired. The first preset time interval may be preset as required, for example, a reset time is preset for each day, the reset time of the day is used as the start time of the first preset time interval, and the current time is used as the end time of the first preset time interval. The current time refers to the time at which the evaluation parameter is acquired. The recording mode of the accumulated opening times of the log switch in the first preset time interval comprises the following steps: and recording the accumulated opening times of the log switch on the same day in real time from the reset time on the same day, resetting the accumulated opening times of the log switch when the next reset time is reached, and recording the accumulated opening times of the log switch on the next day again. And taking the zero point of the current day as the starting time of the first preset time interval, and taking the current time as the ending time of the first preset time interval.
The step of determining a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule comprises:
and acquiring the weight value of the program. For example, a corresponding weight value may be set for each program in advance according to the importance of the program, and a mapping relationship between the identification information of the program and the weight value may be stored. If the weight value of a program needs to be obtained, the weight value corresponding to the program can be found according to the identification information of the program.
Substituting the weighted value of the program, the memory utilization rate, the CPU utilization rate, the storage space utilization rate, the time value corresponding to the current time information and the accumulated opening times of the log switch in a first preset time interval into a preset formula:
Q=P×((1-M)×a+(1-C)×b+(1-S)×c)+(d-|T-e|)+A
wherein Q is an evaluation score, P is a weight of a program, M is a memory utilization rate, C is a CPU utilization rate, S is a storage space utilization rate, T is a time value corresponding to current time information, A is an accumulated opening time of a log switch in a first preset time interval, and a, b, C, d and e are constants.
Obtaining the evaluation score obtained by calculation;
when the evaluation score is larger than or equal to a preset score, determining that the second log switch state is on;
and when the evaluation score is smaller than a preset score, determining that the second log switch state is closed.
An adjusting module 102, configured to maintain the log switch state of the program as the first switch state when the second switch state is the same as the first switch state, and adjust the log switch state of the program from the first switch state to the second switch state when the second log switch state is different from the first switch state.
In this embodiment, the adjusting module 102 is further configured to:
upon arrival of the reset time, a first log switch state is identified. And when the log switch is in the on state, closing the log switch, and when the log switch is in the off state, keeping the log switch in the off state.
In this embodiment, when the log on-off control time of a certain program arrives, a first on-off state and an evaluation parameter of the log of the program at the control time are acquired, and a second on-off state is determined for the log of the program according to the evaluation parameter and a preset on-off state determination rule; when the second switch state is the same as the first switch state, keeping the log switch state of the program as the first switch state; and when the second log switch state is different from the first switch state, adjusting the log switch state of the program from the first switch state to the second switch state. Compared with the prior art, the log on-off state can be automatically controlled according to the evaluation parameters when the log on-off control time is up, so that on one hand, the reduction of the program running efficiency caused by the fact that the log switch is in an on state for a long time is avoided, on the other hand, the log on-off control efficiency is improved, and the labor cost is saved.
Referring to fig. 3, fig. 3 is a block diagram of a second embodiment of the log switch control routine of fig. 1.
On the basis of the first embodiment, the log switch control program further includes a monitoring module 100. The monitoring module 100 is used to monitor whether a predetermined log switch control time is reached in real time. The monitoring method comprises the following two schemes:
the first scheme is as follows:
the monitoring module 100 monitors whether the current time reaches a predetermined log on-off control time in real time according to a plurality of predetermined log on-off control times corresponding to the programs.
The method for setting the predetermined log switch control time comprises the following steps: dividing 24 hours into a plurality of time intervals, monitoring the log access times in different time intervals, summarizing and calculating the average log access times in different time intervals in 24 hours according to data in a plurality of days, and setting log switch control time according to the average log access times.
Scheme II:
the monitoring module 100 sets a first preset duration according to a predetermined setting rule. The predetermined setting rule includes:
and acquiring the accumulated opening times of the log switch in a second preset time interval. For example, the second predetermined time interval may be within 2 hours before the last log switch control time.
When the accumulated opening times of the log switch in the second preset time interval is greater than or equal to the first preset threshold, the first preset time length is equal to the sum of the second preset time length and the third preset time length.
For example, the cumulative turn-on number of the log switch in the second preset time interval is 6 times, the first preset threshold is 4 times, the second preset time period is 15 minutes, and the third preset time period is 10 minutes, then the first preset time period is equal to the sum of the second preset time period and the third preset time period, that is, 25 minutes.
And when the accumulated opening times of the log switch in the second preset time interval is less than or equal to a second preset threshold, the first preset time length is equal to the difference value between the second preset time length and the third preset time length.
When the accumulated opening times of the log switch in the second preset time interval is smaller than the first preset threshold and larger than the second preset threshold, the first preset time length is equal to the second preset time length.
After the first preset time length is set, recording the interval time length between the current time and the previous log switch control time in real time, and determining that the log switch control time to be monitored reaches when the interval time length is equal to the first preset time length. For example, the last log switch control time is 3 hours and 50 minutes, the first preset time period is 30 minutes, the time interval between the current time and 3 hours and 50 minutes is monitored, and if the current time is 4 hours and 20 minutes, the time interval between the current time and 3 hours and 50 minutes is equal to 30 minutes, and then it is determined that a log switch control time is reached.
And the second scheme can dynamically adjust the control time of the log switch according to the log access frequency.
In addition, the invention provides a log switch control method.
Referring to fig. 4, fig. 4 is a flowchart illustrating a log switch control method according to a first embodiment of the present invention.
In this embodiment, the method includes:
and S1, when the log switch control time of a certain program is reached, acquiring a first switch state and an evaluation parameter of the log of the program at the control time, and determining a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule.
The evaluation parameters comprise current time information, cumulative opening times of the log switch in a first preset time interval, identification information of the program and running environment information. The running environment information of the program comprises the memory utilization rate, the CPU utilization rate and the storage space utilization rate of the running environment. Further, the current time information refers to time information at which the evaluation parameter of the program is currently acquired. The first preset time interval may be preset as needed, for example,
the first preset time interval may be preset as required, for example, a reset time is preset for each day, the reset time of the day is used as the start time of the first preset time interval, and the current time is used as the end time of the first preset time interval. The current time refers to the time at which the evaluation parameter is acquired. The recording mode of the accumulated opening times of the log switch in the first preset time interval comprises the following steps: and recording the accumulated opening times of the log switch on the same day in real time from the reset time on the same day, resetting the accumulated opening times of the log switch when the next reset time is reached, and recording the accumulated opening times of the log switch on the next day again. And taking the zero point of the current day as the starting time of the first preset time interval, and taking the current time as the ending time of the first preset time interval.
The step of determining a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule comprises:
substituting the weighted value of the program, the memory utilization rate, the CPU utilization rate, the storage space utilization rate, the time value corresponding to the current time and the accumulated opening times of the log switch in a first preset time interval into a preset formula:
Q=P×((1-M)×a+(1-C)×b+(1-S)×c)+(d-|T-e|)+A
wherein Q is an evaluation score, P is a weighted value of a program, M is a memory utilization rate, C is a CPU utilization rate, S is a storage space utilization rate, T is a time value corresponding to current time information, A is an accumulated opening time of a log switch in a first preset time interval, and a, b, C, d and e are constants.
Obtaining the evaluation score obtained by calculation;
when the evaluation score is larger than or equal to a preset score, determining that the second log switch state is on;
and when the evaluation score is smaller than a preset score, determining that the second log switch state is closed.
And S2, when the second switch state is the same as the first switch state, keeping the log switch state of the program as the first switch state.
And S3, when the second log switch state is different from the first switch state, adjusting the log switch state of the program from the first switch state to the second switch state.
In this embodiment, the method further includes the steps of:
upon arrival of the reset time, a first log switch state is identified. And when the log switch is in the on state, closing the log switch, and when the log switch is in the off state, keeping the log switch in the off state.
In this embodiment, when the log on-off control time of a certain program arrives, a first on-off state and an evaluation parameter of the log of the program at the control time are acquired, and a second on-off state is determined for the log of the program according to the evaluation parameter and a preset on-off state determination rule; when the second switch state is the same as the first switch state, keeping the log switch state of the program as the first switch state; and when the second log switch state is different from the first switch state, adjusting the log switch state of the program from the first switch state to the second switch state. Compared with the prior art, the log on-off state can be automatically controlled according to the evaluation parameters when the log on-off control time is up, so that on one hand, the reduction of the program running efficiency caused by the fact that the log switch is in an on state for a long time is avoided, on the other hand, the log on-off control efficiency is improved, and the labor cost is saved.
Referring to fig. 5, fig. 5 is a flowchart illustrating a log switch control method according to a second embodiment of the present invention.
Prior to the first embodiment S1, the present embodiment further includes S01.
And S01, monitoring whether a predetermined log switch control time is reached in real time.
The monitoring method comprises the following two schemes:
the first scheme is as follows:
and monitoring whether the current time reaches a log switch control time in real time according to a plurality of predetermined log switch control times corresponding to the program.
The method for setting the predetermined log switch control time comprises the following steps: dividing 24 hours into a plurality of time intervals, monitoring the log access times in different time intervals, summarizing and calculating the average log access times in different time intervals in 24 hours according to data in a plurality of days, and setting log switch control time according to the average log access times.
Scheme II:
and setting a first preset time according to a predetermined setting rule. The predetermined setting rule includes:
and acquiring the accumulated opening times of the log switch in a second preset time interval. For example, the second predetermined time interval may be within 2 hours before the last log switch control time.
When the accumulated opening times of the log switch in the second preset time interval is greater than or equal to the first preset threshold, the first preset time length is equal to the sum of the second preset time length and the third preset time length.
For example, the cumulative turn-on number of the log switch in the second preset time interval is 6 times, the first preset threshold is 4 times, the second preset time period is 15 minutes, and the third preset time period is 10 minutes, then the first preset time period is equal to the sum of the second preset time period and the third preset time period, that is, 25 minutes.
And when the accumulated opening times of the log switch in the second preset time interval is less than or equal to a second preset threshold, the first preset time length is equal to the difference value between the second preset time length and the third preset time length.
When the accumulated opening times of the log switch in the second preset time interval is smaller than the first preset threshold and larger than the second preset threshold, the first preset time length is equal to the second preset time length.
For example, the second preset time interval may be 2 hours before the current time, and if the cumulative number of times the log switch is turned on in the two hours is 6 times, the first preset threshold is 4 times, the second preset time period is 15 minutes, and the third preset time period is 10 minutes, the first preset time period is equal to the sum of the second preset time period and the third preset time period, that is, 25 minutes.
After the first preset time length is set, recording the interval time length between the current time and the previous log switch control time in real time, and determining that the log switch control time to be monitored reaches when the interval time length is equal to the first preset time length. For example, the last log switch control time is 3 hours and 50 minutes, the first preset time period is 30 minutes, the time interval between the current time and 3 hours and 50 minutes is monitored, and if the current time is 4 hours and 20 minutes, the time interval between the current time and 3 hours and 50 minutes is equal to 30 minutes, and then it is determined that a log switch control time is reached.
And the second scheme can dynamically adjust the control time of the log switch according to the log access frequency.
Further, the present invention also provides a computer-readable storage medium storing a log switch control program, where the log switch control program is executable by at least one processor to cause the at least one processor to execute the log switch control method in any one of the above embodiments.
The above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention, and all modifications and equivalents of the present invention, which are made by the contents of the present specification and the accompanying drawings, or directly/indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. An electronic device comprising a memory and a processor, wherein the memory has stored thereon a log switch control program that when executed by the processor performs the steps of:
a first determination step: when the log switch control time of a certain program is reached, acquiring a first switch state and an evaluation parameter of the log of the program at the control time, and determining a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule;
a second determination step: when the second switch state is the same as the first switch state, keeping the log switch state of the program as the first switch state;
an adjusting step: when the second log switch state is different from the first switch state, adjusting the log switch state of the program from the first switch state to the second switch state.
2. The electronic device of claim 1, wherein the evaluation parameter comprises: the method comprises the steps of current time information, the accumulated opening times of a log switch in a first preset time interval, program identification information and operating environment information.
3. The electronic device of claim 2, wherein the execution environment information of the program comprises: the step of determining a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule comprises the following steps:
acquiring a weight value of the program;
substituting the weighted value of the program, the memory utilization rate, the CPU utilization rate, the storage space utilization rate, the time value corresponding to the current time information and the accumulated opening times of the log switch in a first preset time interval into a preset formula:
Q=P×((1-M)×a+(1-C)×b+(1-S)×c)+(d-|T-e|)+A
wherein Q is an evaluation score, P is a weight value of the program, M is a memory utilization rate, C is a CPU utilization rate, S is a storage space utilization rate, T is a time value corresponding to current time information, A is an accumulated opening time of a log switch in a first preset time interval, and a, b, C, d and e are constants;
obtaining the evaluation score obtained by calculation;
when the evaluation score is larger than or equal to a preset score, determining that the second log switch state is on;
and when the evaluation score is smaller than a preset score, determining that the second log switch state is closed.
4. The electronic device of any of claims 1-3, wherein prior to the first determining step, the log switch control program when executed by the processor further implements:
monitoring whether the current time reaches a predetermined log switch control time in real time according to a plurality of predetermined log switch control times corresponding to the program; or,
setting a first preset time according to a predetermined setting rule, recording the interval time between the current time and the last log switch control time in real time, and monitoring whether the interval time is equal to the first preset time or not in real time.
5. The electronic device of claim 4, wherein the predetermined setting rule comprises:
acquiring the accumulated opening times of the log switch in a second preset time interval;
when the accumulated opening times of the log switch in the second preset time interval is greater than or equal to a first preset threshold, the first preset time length is equal to the sum of the second preset time length and a third preset time length;
when the accumulated opening times of the log switch in the second preset time interval is smaller than or equal to the second preset threshold, the first preset time length is equal to the difference value between the second preset time length and a third preset time length;
and when the accumulated opening times of the log switch in the second preset time interval are smaller than the first preset threshold and larger than the second preset threshold, the first preset time length is equal to a second preset time length.
6. A log switch control method is characterized by comprising the following steps:
a first determination step: when the log switch control time of a certain program is reached, acquiring a first switch state and an evaluation parameter of the log of the program at the control time, and determining a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule;
a second determination step: when the second switch state is the same as the first switch state, keeping the log switch state of the program as the first switch state;
an adjusting step: when the second log switch state is different from the first switch state, adjusting the log switch state of the program from the first switch state to the second switch state.
7. The log switch control method of claim 6, wherein the evaluating the parameter comprises: the method comprises the following steps of obtaining current time information, accumulated opening times of a log switch in a first preset time interval, identification information of a program and running environment information, wherein the running environment information of the program comprises: the memory utilization rate, the CPU utilization rate and the storage space utilization rate of the running environment;
the step of determining a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule comprises:
acquiring a weight value of the program;
substituting the weighted value of the program, the memory utilization rate, the CPU utilization rate, the storage space utilization rate, the time value corresponding to the current time information and the accumulated opening times of the log switch in a first preset time interval into a preset formula:
Q=P×((1-M)×a+(1-C)×b+(1-S)×c)+(d-|T-e|)+A
wherein Q is an evaluation score, P is a weight value of the program, M is a memory utilization rate, C is a CPU utilization rate, S is a storage space utilization rate, T is a time value corresponding to current time information, A is an accumulated opening time of a log switch in a first preset time interval, and a, b, C, d and e are constants;
obtaining the evaluation score obtained by calculation;
when the evaluation score is larger than or equal to a preset score, determining that the second log switch state is on;
and when the evaluation score is smaller than a preset score, determining that the second log switch state is closed.
8. The log switch control method of claim 6 or 7, wherein prior to the first determining step, the method further comprises:
monitoring whether the current time reaches a predetermined log switch control time in real time according to a plurality of predetermined log switch control times corresponding to the program; or,
setting a first preset time according to a predetermined setting rule, recording the interval time between the current time and the last log switch control time in real time, and monitoring whether the interval time is equal to the first preset time or not in real time.
9. The log switch control method of claim 8, wherein the predetermined setting rule comprises:
acquiring the accumulated opening times of the log switch in a second preset time interval;
when the accumulated opening times of the log switch in the second preset time interval is greater than or equal to a first preset threshold, the first preset time length is equal to the sum of the second preset time length and a third preset time length;
when the accumulated opening times of the log switch in the second preset time interval is smaller than or equal to the second preset threshold, the first preset time length is equal to the difference value between the second preset time length and a third preset time length;
and when the accumulated opening times of the log switch in the second preset time interval are smaller than the first preset threshold and larger than the second preset threshold, the first preset time length is equal to a second preset time length.
10. A computer-readable storage medium storing a log switch control program executable by at least one processor to cause the at least one processor to perform the steps of the log switch control method according to any one of claims 6 to 9.
CN201811252898.6A 2018-10-25 2018-10-25 Electronic device, log switch control method, and computer-readable storage medium Active CN109582532B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811252898.6A CN109582532B (en) 2018-10-25 2018-10-25 Electronic device, log switch control method, and computer-readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811252898.6A CN109582532B (en) 2018-10-25 2018-10-25 Electronic device, log switch control method, and computer-readable storage medium

Publications (2)

Publication Number Publication Date
CN109582532A true CN109582532A (en) 2019-04-05
CN109582532B CN109582532B (en) 2022-07-22

Family

ID=65920797

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811252898.6A Active CN109582532B (en) 2018-10-25 2018-10-25 Electronic device, log switch control method, and computer-readable storage medium

Country Status (1)

Country Link
CN (1) CN109582532B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040233472A1 (en) * 2003-03-10 2004-11-25 Seiko Epson Corporation Log transmission device and log transmission method
CN1967499A (en) * 2006-04-24 2007-05-23 华为技术有限公司 Journal output system and output method
CN103309792A (en) * 2012-03-12 2013-09-18 联想(北京)有限公司 Method and system for controlling log information
JP2014026017A (en) * 2012-07-25 2014-02-06 Canon Inc Log generation device, method and program
CN107066374A (en) * 2017-03-20 2017-08-18 广东欧珀移动通信有限公司 A kind of data processing method and mobile terminal

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040233472A1 (en) * 2003-03-10 2004-11-25 Seiko Epson Corporation Log transmission device and log transmission method
CN1967499A (en) * 2006-04-24 2007-05-23 华为技术有限公司 Journal output system and output method
CN103309792A (en) * 2012-03-12 2013-09-18 联想(北京)有限公司 Method and system for controlling log information
JP2014026017A (en) * 2012-07-25 2014-02-06 Canon Inc Log generation device, method and program
CN107066374A (en) * 2017-03-20 2017-08-18 广东欧珀移动通信有限公司 A kind of data processing method and mobile terminal

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
王锡强: "基于日志的网络安全审计系统的设计与实现", 《中国优秀博硕士学位论文全文数据库(硕士)》 *

Also Published As

Publication number Publication date
CN109582532B (en) 2022-07-22

Similar Documents

Publication Publication Date Title
US10558544B2 (en) Multiple modeling paradigm for predictive analytics
KR102201919B1 (en) Random forest model training method, electronic device and storage medium
CN112346829B (en) Method and equipment for task scheduling
WO2020140369A1 (en) Data recovery control method, server and storage medium
CN111447150A (en) Access request current limiting method, server and storage medium
US8473789B2 (en) Memory leak monitoring system and associated methods
CN108491301B (en) Electronic device, abnormality early warning method based on redis and storage medium
CN103023984B (en) Terminal application server and application log filtering method thereof
CN107783829B (en) Task processing method and device, storage medium and computer equipment
CN111277640B (en) User request processing method, device, system, computer equipment and storage medium
US20150127614A1 (en) Point in time snapshots using copy on predicted write
CN113835985A (en) Method, device and equipment for monitoring and analyzing cause of stuck
CN104572436A (en) Automatic debugging and error proofing method and device
CN109284193B (en) Distributed data processing method based on multithreading and server
CN109582532B (en) Electronic device, log switch control method, and computer-readable storage medium
US20180137131A1 (en) Data retentions
CN111259299A (en) Data processing method, data processing device, computer equipment and storage medium
CN104268231B (en) A kind of file access method, device and Intelligent File System
US20170132268A1 (en) Method and apparatus for determining hot page in database
CN109934327B (en) Timing method and system of smart card
US20130227226A1 (en) Electronic device and method for data backup
CN108920722B (en) Parameter configuration method and device and computer storage medium
CN108896068B (en) Step counting method, server, mobile terminal and storage medium
CN105320853B (en) Information monitoring method and device and terminal
CN110490481B (en) Control method, device and equipment of wind control rule and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant