CN109582532B - Electronic device, log switch control method, and computer-readable storage medium - Google Patents

Electronic device, log switch control method, and computer-readable storage medium Download PDF

Info

Publication number
CN109582532B
CN109582532B CN201811252898.6A CN201811252898A CN109582532B CN 109582532 B CN109582532 B CN 109582532B CN 201811252898 A CN201811252898 A CN 201811252898A CN 109582532 B CN109582532 B CN 109582532B
Authority
CN
China
Prior art keywords
log
switch
program
preset
time
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811252898.6A
Other languages
Chinese (zh)
Other versions
CN109582532A (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

Images

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 invention relates to a log switch control method, an electronic device and a computer readable storage medium. 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 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 by the method.

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 a program is influenced. Therefore, how to realize automatic control of the log switch state becomes 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 aims 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 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 includes:
acquiring a weight value of the program;
substituting the weight 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 to calculate an evaluation score:
Q=P×((1-M)×a+(1-C)×b+(1-S)×c)+(d-|T-e|)+A
wherein Q is the 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 the current time information, A is the accumulated opening times of the 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 switch state is on;
and when the evaluation score is smaller than a preset score, determining that the second 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;
alternatively, the first and second liquid crystal display panels may be,
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, monitoring whether the interval time is equal to the first preset time or not in real time, and determining that the log switch control time to be monitored reaches when the interval time is equal to the first preset 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 a 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 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 obtaining current time information, the accumulated opening times of a log switch in a first preset time interval, identification information of a program and running 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 the first preset time interval into a preset formula to calculate an evaluation score:
Q=P×((1-M)×a+(1-C)×b+(1-S)×c)+(d-|T-e|)+A
wherein Q is the evaluation score, P is the weight value of the program, M is the memory utilization rate, C is the CPU utilization rate, S is the storage space utilization rate, T is the time value corresponding to the current time information, A is the accumulated opening times of the 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 switch state is on;
and when the evaluation score is smaller than a preset score, determining that the second 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;
alternatively, the first and second electrodes may be,
setting a first preset time according to a predetermined setting rule, recording the interval time between the current time point and the last log switch control time point in real time, monitoring whether the interval time is equal to the first preset time or not in real time, and determining that the log switch control time to be monitored reaches when the interval time is equal to the first preset 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 a 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, which is 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; when the second switch state is different from the first switch state, the log switch state of the program is adjusted 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 a 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 to illustrate, but are not to be construed 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 understood that not all of the shown components are required to be implemented, and more or less components may be implemented instead.
The storage 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 a program code 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.
Processor 12, which in some embodiments may be a Central Processing Unit (CPU), microprocessor or other data Processing chip, is configured to execute program codes stored in memory 11 or process data, such as executing 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 includes a memory usage rate, a CPU usage rate, and a storage space usage 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 current day in real time from the reset time on the current day, resetting the accumulated opening times of the log switch when the next reset time is reached, and restarting to record the accumulated opening times of the log switch on the next day. 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 the weight of a program, M is the memory utilization rate, C is the CPU utilization rate, S is the storage space utilization rate, T is the time value corresponding to the current time information, A is the accumulated opening times of the 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 switch state is on;
and when the evaluation score is smaller than a preset score, determining that the second 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 switch state is different from the first switch state.
In this embodiment, the adjusting module 102 is further configured to:
when the reset time is reached, a first log switch state is recognized. 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; when the second switch state is different from the first switch state, the log switch state of the program is adjusted from the first switch state to the second switch state. Compared with the prior art, the method and the device have the advantages that the log switch state can be automatically controlled according to the evaluation parameters when the log switch control time is up, on one hand, the problem that the running efficiency of a program 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 switch 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 for monitoring whether a predetermined log switch control time is reached in real time. The monitoring method comprises the following two schemes:
the first scheme comprises the following steps:
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 the 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 preset time interval may be within 2 hours before the last toggle control time.
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.
For example, the cumulative number of times of opening 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, so that 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 last 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.
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 current day in real time from the reset time on the current day, resetting the accumulated opening times of the log switch when the next reset time is reached, and restarting to record the accumulated opening times of the log switch on the next day. 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 to calculate an evaluation score:
Q=P×((1-M)×a+(1-C)×b+(1-S)×c)+(d-|T-e|)+A
wherein Q is the 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 the current time information, A is the accumulated opening times of the 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 switch state is on;
and when the evaluation score is smaller than a preset score, determining that the second 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 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:
when the reset time is reached, a first log switch state is recognized. 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 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 method and the device have the advantages that the log switch state can be automatically controlled according to the evaluation parameters when the log switch control time is up, on one hand, the problem that the running efficiency of a program 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 switch 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 comprises the following steps:
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 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 the log switch control time according to the average log access times.
Scheme two is as follows:
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 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.
For example, the cumulative number of times of opening 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, so that 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 a third preset time length.
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 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.
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 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 equivalent structural changes made by using the contents of the present specification and the drawings, or any other related technical fields, which are directly or indirectly applied to the present invention, are included in the scope of the present invention.

Claims (7)

1. An electronic device comprising a memory and a processor, wherein a log switch control program is stored on the memory, and when executed by the processor, performs the steps of:
a monitoring step: 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, monitoring whether the interval time is equal to the first preset time or not in real time, and determining that the log switch control time to be monitored reaches when the interval time is equal to the first preset time, wherein the predetermined setting rule comprises the following steps: 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 a 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; 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;
a first determination step: when the log switch control time of a certain program arrives, 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, wherein,
the evaluation parameters include: the method comprises the following steps of obtaining current time information, the accumulated opening times of a log switch in a first preset time interval, identification information of a program and running environment information of the program, wherein the running environment information of the program comprises: acquiring a weighted value of the program according to the memory utilization rate, the CPU utilization rate and the storage space utilization rate of the running environment;
determining a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule, including: calculating to obtain an evaluation score according to the weight 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, determining that the second switch is opened when the evaluation score is greater than or equal to the preset score, and determining that the second switch is closed when the evaluation score is smaller than the preset score;
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 switch state is different from the first switch state, the log switch state of the program is adjusted from the first switch state to the second switch state.
2. The electronic device of claim 1, wherein calculating an evaluation score according to a weight value of the program, a memory usage rate, a CPU usage rate, a storage space usage rate, a time value corresponding to current time information, and a cumulative number of times of turning on the log switch within a first predetermined time interval comprises:
substituting the weight 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 to calculate to obtain the evaluation score:
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 the accumulated opening times of the log switch in a first preset time interval, and a, b, C, d and e are constants.
3. The electronic device of claim 1, wherein the monitoring step is replaced with:
and 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.
4. A log switch control method is characterized by comprising the following steps:
a monitoring step: 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, monitoring whether the interval time is equal to the first preset time or not in real time, and determining that the log switch control time to be monitored reaches when the interval time is equal to the first preset time, wherein the predetermined setting rule comprises the following steps: 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 a 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; 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;
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, wherein,
the evaluation parameters include: 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 of the program, wherein the running environment information of the program comprises: acquiring a weighted value of the program according to the memory utilization rate, the CPU utilization rate and the storage space utilization rate of the running environment;
determining a second switch state for the log switch of the program according to the evaluation parameter and a preset switch state determination rule, including: calculating to obtain an evaluation score according to the weight 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, determining that the second switch is opened when the evaluation score is greater than or equal to the preset score, and determining that the second switch is closed when the evaluation score is smaller than the preset score;
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 switch state is different from the first switch state, the log switch state of the program is adjusted from the first switch state to the second switch state.
5. The method as claimed in claim 4, wherein the calculating an evaluation score according to the weight value of the program, the memory usage rate, the CPU usage rate, the storage space usage rate, the time value corresponding to the current time information, and the accumulated turn-on times of the log switch within the first predetermined time interval comprises:
substituting the weight 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 to calculate to obtain the evaluation score:
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 the accumulated opening times of the log switch in a first preset time interval, and a, b, C, d and e are constants.
6. The log switch control method of claim 4, wherein the monitoring step is replaced with:
and 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.
7. 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 4 to 6.
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 CN109582532A (en) 2019-04-05
CN109582532B true 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 (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4214804B2 (en) * 2003-03-10 2009-01-28 セイコーエプソン株式会社 Log transmission device, method and program thereof

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
基于日志的网络安全审计系统的设计与实现;王锡强;《中国优秀博硕士学位论文全文数据库(硕士)》;20070915(第03期);I139-127 *

Also Published As

Publication number Publication date
CN109582532A (en) 2019-04-05

Similar Documents

Publication Publication Date Title
US11023372B2 (en) Application memory reclaim method and apparatus
US10558544B2 (en) Multiple modeling paradigm for predictive analytics
WO2019140828A1 (en) Electronic apparatus, method for querying logs in distributed system, 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
CN108491122B (en) Click event response method, computer readable storage medium and terminal equipment
US11360872B2 (en) Creating statistical analyses of data for transmission to servers
JP2015032316A (en) Data storage device and data maintenance method
CN111176967A (en) Query method and device for remote out-of-band SSD log information and BMC
WO2019148657A1 (en) Method for testing associated environments, electronic device and computer readable storage medium
CN109582532B (en) Electronic device, log switch control method, and computer-readable storage medium
CN114546590A (en) Java virtual machine heap memory set object monitoring method and memory overflow analysis method
US20180137131A1 (en) Data retentions
CN111078418B (en) Operation synchronization method, device, electronic equipment and computer readable storage medium
CN112131179B (en) Task state detection method, device, computer equipment and storage medium
CN115061858A (en) Data persistence method and device, computer equipment and storage medium
JP2014052827A (en) Information processing device and information processing method
CN109934327B (en) Timing method and system of smart card
CN113656378A (en) Server management method, device and medium
CN107728769B (en) Background application management method and device and computer readable storage medium
CN112416701A (en) Service data monitoring method and device, computer equipment and readable storage medium
US20130227226A1 (en) Electronic device and method for data backup
CN113810486B (en) Internet of things platform docking method and device, electronic equipment and storage medium
CN110489967B (en) Method and device for analyzing program running risk
CN112699015B (en) Log output method, device, server and computer readable storage medium

Legal Events

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