Log printing method and device, electronic equipment, medium and program product

By obtaining log printing information and judging the current limit operation, the disk exhaustion problem caused by large-scale log information is solved, and the optimization management of disk space and the efficiency of problem positioning is achieved.

CN120448215APending Publication Date: 2025-08-08CHONGQING ANT CONSUMER FINANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510465226.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-08
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In high concurrency or abnormal situations, large amounts of log information are written to disk, resulting in exhaustion of storage resources, affecting system stability and normal operation.

Method used

By obtaining log printing information, including the current disk usage, historical printing volume and printing speed, we can determine whether the current limit printing operation needs to be started, limit the number of logs printed, and use the current limit strategy to reduce unnecessary log writing.

Benefits of technology

Effectively prevent disks from being fully occupied, reduce the demand for disk space, avoid potential risks, and improve problem positioning efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448215A_ABST
    Figure CN120448215A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a log printing method and device, electronic equipment, a medium and a program product. The method comprises the steps that log printing information is obtained, and the log printing information comprises at least one of the following information: the current disk utilization rate, the historical printing amount corresponding to various logs in a disk, and the log printing speed in a historical time period; based on the log printing information and the log printing security boundary condition, whether a current-limiting printing operation needs to be started or not is judged, wherein the current-limiting printing operation is used for limiting the printing number of logs in a disk; and if yes, starting the current-limiting printing operation on the to-be-printed log.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of information processing technology, and in particular to a log printing method, device, electronic device, medium, and program product. Background Art

[0002] Logging is a crucial task in modern software development and operations. It not only helps developers track state changes during program execution but also provides valuable information for problem diagnosis. However, in practice, various reasons (such as sudden errors and abnormal traffic) can cause large amounts of log information to be generated in a short period of time. If these logs are not properly managed, they can easily consume server storage space, affecting system operation and even causing service interruptions. Summary of the Invention

[0003] The embodiments of this specification provide a log printing method, device, electronic device, medium, and program product. Before printing, the method determines whether a current-limited printing operation needs to be initiated based on log printing information and log printing safety boundary conditions. If a current-limited printing operation needs to be initiated, the method reduces unnecessary log writing operations by initiating a corresponding current-limiting operation on the log to be printed, effectively preventing the disk from being full, reducing the demand for disk space, and avoiding various potential risks caused by excessive log volume. The above technical solution is as follows:

[0004] In a first aspect, an embodiment of this specification provides a log printing method, comprising:

[0005] Obtain log printing information; the log printing information includes at least one of the following: current disk usage, historical printing volume corresponding to various log types on the disk, and log printing speed within a historical time period;

[0006] Based on the log printing information and the log printing safety boundary conditions, it is determined whether a current limiting printing operation needs to be started; the current limiting printing operation is used to limit the number of logs printed on the disk;

[0007] If so, the above-mentioned current-limited printing operation is started for the log to be printed.

[0008] In a second aspect, an embodiment of this specification provides a log printing device, the device comprising:

[0009] An information acquisition module is used to obtain log printing information; the log printing information includes at least one of the following: current disk usage, historical printing volume corresponding to various log types on the disk, and log printing speed;

[0010] A judgment module, configured to judge whether a current-limited printing operation needs to be started based on the log printing information and the log printing safety boundary conditions; the current-limited printing operation is used to limit the number of logs printed on the disk;

[0011] The current limiting printing module is used to start the current limiting printing operation on the log to be printed if the current limiting printing operation needs to be started.

[0012] In a third aspect, an embodiment of this specification provides an electronic device, including: a processor and a memory;

[0013] The processor is connected to the memory;

[0014] The aforementioned memory is used to store executable program code;

[0015] The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method provided in the first aspect of the embodiment of this specification.

[0016] In a fourth aspect, an embodiment of this specification provides a computer storage medium, wherein the computer storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor and executing the method provided in the first aspect of the embodiment of this specification.

[0017] In a fifth aspect, an embodiment of this specification provides a computer program product comprising instructions, which, when executed on a computer or a processor, enables the computer or the processor to execute the log printing method provided in the first aspect of the embodiment of this specification.

[0018] In the embodiments of the present specification, before printing, it is determined whether it is necessary to start a current-limited printing operation based on log printing information such as the current disk usage rate, the historical printing volume corresponding to various types of logs on the disk, the log printing speed, and the log printing safety boundary conditions. If it is necessary to start a current-limited printing operation, unnecessary log writing operations are reduced by starting the corresponding current-limiting operation for the log to be printed, thereby effectively preventing the disk from being full, reducing the demand for disk space, and avoiding various potential risks caused by excessive log volume. At the same time, it also reduces the total amount of logs that need to be manually reviewed to a certain extent, making problem location more efficient and quick. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of this specification, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0020] Figure 1 A schematic diagram of the architecture of a log printing system provided as an exemplary embodiment of this specification;

[0021] Figure 2 A flowchart of a log printing method provided as an exemplary embodiment of this specification;

[0022] Figure 3 A flowchart of another log printing method provided as an exemplary embodiment of this specification;

[0023] Figure 4 A schematic diagram of an implementation process of a log printing method provided by an exemplary embodiment of this specification;

[0024] Figure 5 A schematic structural diagram of a log printing device provided as an exemplary embodiment of this specification;

[0025] Figure 6 The present invention provides a structural diagram of an electronic device according to an exemplary embodiment of the present invention. DETAILED DESCRIPTION

[0026] The technical solutions in the embodiments of this specification will be described clearly and completely below in conjunction with the drawings in the embodiments of this specification.

[0027] In this specification, claims, and the accompanying drawings, the terms "first," "second," "third," and so on are used to distinguish between different items, not to describe a particular order. Furthermore, the terms "including," "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or apparatus comprising a series of steps or elements is not limited to the listed steps or elements but may optionally include steps or elements not listed, or may optionally include other steps or elements inherent to the process, method, product, or apparatus.

[0028] It should be noted that the information (including but not limited to user device information, user personal information, etc.), data (including but not limited to data used for analysis, stored data, displayed data, etc.), and signals involved in the embodiments of this specification are all authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data must comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the log printing information and logs to be printed involved in this specification are all obtained with full authorization.

[0029] With the rapid development of information technology, computer systems are becoming increasingly complex. To ensure system stability and maintainability, log printing has become an indispensable component. By recording system runtime status information, error messages, and other information, developers and operations personnel can effectively locate problems and quickly resolve them. However, related log printing technologies have some significant flaws. For example, in high-concurrency or abnormal situations, large amounts of log information are continuously written to disk, consuming significant storage resources and, in severe cases, exhausting disk space, rendering the entire system inoperable.

[0030] Based on this, the embodiment of this specification provides a log printing method, which aims to optimize the log management strategy. Before printing, it determines whether it is necessary to start a current limiting printing operation through log printing information and log printing security boundary conditions, and reduces unnecessary log writing operations by starting corresponding current limiting operations on the log to be printed when necessary, effectively preventing the disk from being full, reducing the demand for disk space, and avoiding various potential risks caused by excessive log volume. At the same time, it reduces the total amount of logs that require manual review to a certain extent, making problem location more efficient and quick.

[0031] Please refer to the following Figure 1 , Figure 1 This is a schematic diagram of the architecture of a log printing system provided by an exemplary embodiment of this specification. Figure 1 As shown, the log printing system may include: a terminal 110 and a server 120 .

[0032] in:

[0033] Terminal 110 may include one or more development terminals. A development version of the software may be installed in terminal 110, enabling developers to add log print statements to program code online, for example. Terminal 110 may establish a data connection with the network and, through the network, establish a data connection with server 120, for example, to send server access requests and receive log print results. Terminal 110 may be, but is not limited to, a mobile phone, tablet computer, laptop computer, or other device with the user version of the software installed.

[0034] As can be understood, in a terminal environment, log printing is often used during debugging and development. Developers can add log print statements to their code to output information such as the program's running status and variable values to terminal 110 for debugging and analysis. This log printing method is very useful for developers, helping them quickly locate and resolve problems in their code.

[0035] Server 120 can be a server that can provide multiple log printing services. It can collect data on the corresponding log printing information of server 120 and, based on the log printing information and the log printing safety boundary conditions, determine whether to initiate a current-limited printing operation. The current-limited printing operation is used to limit the number of logs printed on the disk. If so, the current-limited printing operation is initiated for the logs to be printed. Optionally, server 120 can also, but is not limited to, output the log printing results after the current-limited printing operation is initiated to terminal 110, etc. Server 120 can be, but is not limited to, a hardware server, a virtual server, a cloud server, etc.

[0036] As will be appreciated, in a server environment, logs are typically generated by the server 120 to record the server's 120 operating status, error messages, access history, and the like. These logs are crucial for the management and maintenance of the server 120, helping administrators understand the health of the server 120 and promptly identify and resolve issues. The logs generated by the server 120 are typically output to various files, such as system logs, application logs, and security logs, which are stored in a distributed manner across different servers.

[0037] It is understandable that the log printing process is not limited to being executed by the server 120, but can also be executed by the terminal 110. The embodiments of this specification do not specifically limit this. The following embodiments are all described by taking the server 120 executing the log printing as an example.

[0038] The network may be a medium providing a communication link between the server 120 and the terminal 110, or may be the Internet including network devices and transmission media, but is not limited thereto. The transmission media may be a wired link, such as, but not limited to, a coaxial cable, optical fiber, and a digital subscriber line (DSL), or a wireless link, such as, but not limited to, wireless fidelity (WIFI), Bluetooth, and a mobile device network.

[0039] Understandably, Figure 1 The number of terminals 110 and servers 120 in the log printing system shown is for illustrative purposes only. In a specific implementation, the log printing system may include any number of terminals 110 and servers. This specification does not specifically limit this. For example, but not limited to, the terminal 110 may be a terminal cluster consisting of multiple terminals, and the server 120 may be a server cluster consisting of multiple servers.

[0040] Next, combine Figure 1 , introduces the log printing method provided by the embodiment of this manual. For details, please refer to Figure 2, which is a flow chart of a log printing method provided by an exemplary embodiment of this specification. Figure 2 As shown, the log printing method includes the following steps:

[0041] S202, obtaining log printing information.

[0042] Specifically, when the preset trigger condition for the server to print logs is triggered, it means that the server generates or obtains a log to be printed that needs to be printed. In order to avoid various potential risks caused by the excessive amount of logs printed on the disk, before printing the log to be printed, the server can first obtain log printing information, such as but not limited to collecting the log size and remaining disk space from each service component of the server, so as to timely understand the current disk usage and log printing status of the server.

[0043] The above-mentioned preset trigger conditions may include, but are not limited to, at least one of the following: the program in the server executes to a certain step or stage (for example, but not limited to, in a web application, when an HTTP request is received or an HTTP response is sent, relevant log information may be recorded); the program in the server encounters an error or exception (in this case, error logs are usually triggered to be printed. Such log information helps developers locate and solve the problem. For example, but not limited to, in database operations, if an SQL statement fails to execute, relevant error logs may be recorded); the system status in the server changes (for example, but not limited to, when the server is started, stopped, or restarted, relevant system logs may be recorded; or when the system resource usage, such as CPU usage, memory usage, etc., reaches a certain threshold, log recording may also be triggered); a scheduled log printing task is triggered (for example, but not limited to, a scheduled task can be set to regularly check the health of the system and record relevant log information); an external event that can trigger log printing is received (for example, but not limited to, in a web application, when a user performs an operation such as logging in, logging out, submitting a form, etc., relevant log recording may be triggered; or when a message or notification from another system is received, log printing may also be triggered).

[0044] It is understandable that the above preset trigger conditions may vary depending on different log systems, applications, and server configurations. Therefore, in practical applications, the embodiments of this specification may be, but are not limited to, setting and configuring the preset trigger conditions for log printing according to specific needs and environments.

[0045] The above-mentioned log printing information may include, but is not limited to, at least one of the following: current disk usage, historical print volume corresponding to various log types on the disk, and log printing speed within a historical time period. The above-mentioned current disk usage refers to the proportion of disk space currently occupied on the server. It directly reflects the remaining disk space and is an important indicator for measuring disk usage status. When the disk usage is too high (for example, approaching or reaching 100%), the system may experience problems such as slow operation and inability to store new data properly. By obtaining the disk usage, insufficient disk space issues can be promptly discovered and addressed to ensure stable system operation. Logs are files that record various information generated during the operation of a system or application. The historical print volume corresponding to various log types on the disk can be the amount of information recorded (printed) or the number of prints in these log files within a historical time period, or it can be the number of printed information corresponding to various log types on the disk. The specific setting can be based on actual needs and is not limited in the embodiments of this specification. The above-mentioned historical print volume can reflect the system's activity and information generation within a specific time period. By analyzing the historical print volume of various log types, key information such as the system's operating status, user behavior, and error frequency can be understood. The historical print volume of various log types is crucial for system maintenance, troubleshooting, and performance optimization. For example, if an unusual increase in the historical print volume of a particular log type is observed, further investigation may be necessary to determine whether there is a potential issue or attack. The log print speed described above refers to the rate at which the system or application generates and records log information during a historical time period. The log print speed during this historical time period can be determined based on the number of logs printed during that time period, reflecting the system's information processing capacity within a specific time window.

[0046] Please continue to refer to Figure 2 ,like Figure 2 As shown, after obtaining the log printing information in S202, the log printing method may also include but is not limited to:

[0047] S204: Determine whether a current-limited printing operation needs to be started based on the log printing information and the log printing safety boundary condition.

[0048] Specifically, the above-mentioned log printing security boundary conditions refer to conditions set in order to control the amount and frequency of log printing and prevent excessive log volume from causing server performance problems or sensitive information leakage. They are usually set based on factors such as log level, log content, number of logs in the time window, and disk space usage. The server can check the current log printing situation (log printing information) in real time or regularly to determine whether the log printing security boundary conditions have been reached or exceeded, and then decide whether it is necessary to start the current limiting printing operation. For example, if the log printing security boundary conditions have been reached or exceeded, it is determined that the current limiting printing operation needs to be started; if the log printing security boundary conditions have not been reached or exceeded, it is determined that the current limiting printing operation does not need to be started, and the log can continue to be printed normally. The above-mentioned current limiting printing operation is used to limit the number of logs printed on the disk, such as but not limited to operations to limit the amount and frequency of log printing by reducing the log printing frequency, limiting log printing, etc.

[0049] Optionally, the log printing safety boundary conditions may include, but are not limited to, at least one of the following: disk usage is less than or equal to a usage threshold, and the print volume corresponding to the same type of log on the disk is less than or equal to a target print threshold. The above-mentioned S204, based on the log printing information and the log printing safety boundary conditions, determines whether it is necessary to initiate a current-limited printing operation. The implementation process may include, but is not limited to: determining whether the current disk usage is greater than a usage threshold (for example, but not limited to 80%, 90%, etc.), and / or determining whether the historical print volume corresponding to each type of log on the disk is greater than a target print threshold, and / or determining whether the disk usage in a future time period, based on the log printing speed in the historical time period, will be greater than the usage threshold; if the current disk usage is greater than the usage threshold, or there is at least one target type of log on the disk with a historical print volume greater than the target print threshold, or the disk usage in a future time period will be greater than the usage threshold, then it is determined that the current-limited printing operation needs to be initiated. That is, first determine whether the log printing safety boundary conditions are exceeded based on the log printing information. If exceeded, it means that continuing normal printing may cause the log to quickly fill up the disk or the printing volume of the same type of log is too large and affect the stability of the system. In this case, it is determined that the current limiting printing operation needs to be started to limit the number of logs printed on the disk.

[0050] The historical printing volume corresponding to each type of log on the disk can be obtained by, but is not limited to, pre-processing the logs printed on the disk, such as, but not limited to, extracting key features such as error codes, exception types, etc. from them using natural language processing technology or other pattern recognition methods, and classifying the logs printed on the disk according to the obtained key features, and obtaining real-time statistics on the number of logs in each category. The above pre-processing can also be, but is not limited to, converting each log printed on the disk into a fixed-length vector representation, which contains basic attributes such as timestamp, level, source IP, key information, and keywords or phrases extracted by natural language processing technology. The above classification can be, but is not limited to, using K-means or other suitable clustering methods to group and count all logs on the disk, find a set of logs with similar patterns, and classify logs whose similarity between corresponding vectors is less than a preset similarity threshold into one category.

[0051] The disk usage rate in the future time period can be, but is not limited to, first predicted by a time series trend prediction model based on the log printing speed in the historical time period to obtain the log printing volume in the future time period, and then calculated based on the current disk usage rate and the log printing volume in the future time period. In other words, a sliding window mechanism can be used to perform short-term trend analysis on the log printing situation in the future time period to obtain the disk usage rate in the future time period.

[0052] When encountering unexpected situations (such as network attacks and software bugs), log printing can quickly generate a large number of repetitive error logs. This redundant information can obscure valuable diagnostic clues, making troubleshooting more difficult. In other words, certain types of errors or warnings often recur multiple times within a short period of time. This wastes valuable disk resources and creates unnecessary complexity for subsequent log analysis. Therefore, effectively controlling log volume and ensuring that critical information is accurately recorded has become a pressing issue.

[0053] Based on this, the embodiment of this specification obtains the historical printing volume corresponding to the same type of logs, and starts a current limiting printing operation when the historical printing volume corresponding to at least one target type of log on the disk is too much, that is, greater than the target printing threshold. This can avoid the problem of a large number of duplicate logs being printed and wasting disk storage resources, effectively control the amount of logs printed on the disk, and thus to a certain extent ensure that key information can be effectively recorded, thereby improving the effectiveness of log printing.

[0054] At the same time, the embodiments of this specification can also obtain the current disk usage of the server and start a current-limited printing operation when the current disk usage is greater than a usage threshold (for example, but not limited to 80%, 90%, etc.). Therefore, when the disk space is almost full or insufficient, unnecessary log writing operations can be reduced through the current-limited printing operation, thereby effectively reducing the demand for disk space for log printing and preventing the disk space from being quickly filled up and affecting system performance and stability.

[0055] In addition, the embodiments of the present specification can also predict the disk usage rate in the future time period based on the log printing speed in the historical time period, that is, use a sliding window mechanism to perform short-term trend analysis on the log printing situation in the future time period, and start the current limiting printing operation when it is predicted that the disk usage rate in the future time period will be greater than the usage threshold (for example, but not limited to 80%, 90%, etc.). Therefore, when it is predicted that the disk space is almost full or insufficient, unnecessary log writing operations can be reduced as early as possible by performing the current limiting printing operation in advance, effectively reducing the demand for disk space for log printing, reducing the speed at which the disk space is filled up by logs, and preventing the disk space from being quickly filled up and affecting system performance and stability.

[0056] Please continue to refer to Figure 2 ,like Figure 2 As shown, in the above S204, after determining whether to start the current-limited printing operation based on the log printing information and the log printing safety boundary condition, the log printing method may also include but is not limited to:

[0057] S206: If the current-limited printing operation needs to be started, the current-limited printing operation is started for the log to be printed.

[0058] Specifically, when it is determined that a current limiting printing operation needs to be initiated, a current limiting printing operation such as reducing the printing frequency of the log to be printed or limiting the printing of the log to be printed can be performed to control the printing volume and / or frequency of subsequent logs to be printed. The above-mentioned logs to be printed refer to logs that have been generated but not yet printed.

[0059] In the embodiments of the present specification, before printing, it is determined whether it is necessary to start a current-limited printing operation based on log printing information such as the current disk usage rate, the historical printing volume corresponding to various types of logs on the disk, the log printing speed, and the log printing safety boundary conditions. If it is necessary to start a current-limited printing operation, unnecessary log writing operations are reduced by starting the corresponding current-limiting operation for the log to be printed, thereby effectively preventing the disk from being full, reducing the demand for disk space, and avoiding various potential risks caused by excessive log volume. At the same time, it also reduces the total amount of logs that need to be manually reviewed to a certain extent, making problem location more efficient and quick.

[0060] Optionally, the implementation process of initiating the current-limited printing operation for the logs to be printed in S206 may include, but is not limited to: first, determining the remaining print limit corresponding to each type of log on the disk based on the current disk usage rate and the historical print volume corresponding to each type of log on the disk; then, initiating the current-limited printing operation for the logs to be printed based on the remaining print limit corresponding to each type of log on the disk, for example, but not limited to, limiting the printing operation of a certain type of log on the disk when the remaining print limit corresponding to the log on the disk is 0, or reducing the printing frequency of a certain type of log on the disk when the remaining print limit corresponding to the log on the disk is less than a remaining safety printing threshold. The remaining print limit corresponding to each type of log is used to represent the upper limit of the log volume allowed to continue printing for each type of log without affecting disk space usage. The implementation process of determining the remaining print limit corresponding to each type of log on the disk may include, but is not limited to: first, calculating the remaining available disk space based on the current disk usage rate and a preset disk space safety threshold (for example, reserving 20% or 10% of the disk space as a safety margin); then, allocating a reasonable remaining print limit for each type of log based on the historical print volume corresponding to each type of log on the disk and the log printing speed.

[0061] Optionally, after the current limiting printing operation is started, you can continue to obtain the log printing status and adjust the corresponding current limiting strategy and log printing safety boundary conditions according to the actual printing situation and disk usage to ensure that log printing meets debugging requirements without negatively affecting system performance, thereby improving the flexibility of log printing.

[0062] In some possible embodiments, please refer to Figure 2 ,like Figure 2 As shown, in the above S204, after determining whether to start the current-limited printing operation based on the log printing information and the log printing safety boundary condition, the log printing method may also include but is not limited to:

[0063] S208: If the current-limited printing operation does not need to be started, a normal printing operation is started for the log to be printed.

[0064] Specifically, if there is no need to initiate a current-limited printing operation, indicating that normal printing will not exceed the log printing safety boundary conditions, that is, it will not affect system performance and stability, then normal printing operations can be directly initiated for the print log. The above-mentioned normal printing operation refers to the process of outputting the log information generated during system operation to a designated log storage medium (such as a file, database, log management system, etc.) according to preset rules and configurations without special restrictions or abnormal circumstances.

[0065] In some possible embodiments, after obtaining the log printing information, when the current disk usage is greater than or equal to the target threshold, it means that the current disk space usage is too high and logs can no longer be printed safely. In this case, the historical logs stored in the disk can be cleaned up to maintain the health of the system; or, the historical logs stored in the disk are cleaned up according to a preset period (for example, but not limited to every half a month or a month, etc.), so as to avoid the problem of consuming a large amount of CPU or disk IO by regularly archiving and cleaning the logs when the disk space is almost full. Or, when there are target historical logs on the disk that have been printed for more than a preset time (for example, but not limited to one month, half a year, one year, etc.), the target historical logs on the disk are cleaned up to avoid the problem that logs that have exceeded a certain time (preset time) occupy disk space for a long time, resulting in the disk available space gradually becoming less over time and important logs cannot be fully recorded. That is, by deleting logs that have exceeded a certain time, invalid occupation of disk space is avoided and the health of the system is maintained.

[0066] Please refer to the following Figure 3 , which is a flow chart of another log printing method provided by an exemplary embodiment of this specification. Figure 3 As shown, the log printing method includes the following steps:

[0067] S302, obtaining log printing information.

[0068] Specifically, the above S302 is consistent with the above S202 and will not be repeated here.

[0069] S304: Determine whether a current-limited printing operation needs to be started based on the log printing information and the log printing safety boundary condition.

[0070] Specifically, the above S304 is consistent with the above S204 and will not be repeated here.

[0071] S306: If the current-limited printing operation needs to be started, a current-limited policy corresponding to the current-limited printing operation is determined based on the log printing information and the log printing safety boundary condition.

[0072] Optionally, the log printing safety boundary conditions may include, but are not limited to, at least one of the following: the disk usage is less than or equal to the usage threshold, the print volume corresponding to the same type of log on the disk is less than or equal to the target printing threshold, and the target printing threshold may be, but is not limited to, the upper limit of a type of log on the disk that is allowed to be printed. The specific setting may be based on the actual printing situation and disk space, etc., and the embodiments of this specification do not limit this. The current limiting strategy may include, but is not limited to, current limiting log types and / or current limiting control types. The above S306, based on the log printing information and the log printing safety boundary conditions, determines the implementation process of the current limiting strategy corresponding to the current limiting printing operation, which may include, but is not limited to:

[0073] When the current disk usage is greater than the usage threshold, the current limiting control type corresponding to the non-core error class log is determined to be hard current limiting and the current limiting control type corresponding to the core error class log is determined to be soft current limiting; when the current disk usage is less than or equal to the usage threshold and there is at least one target class log in the disk with a historical printing volume greater than the target printing threshold, the current limiting control type corresponding to the target class log is determined to be soft current limiting; or, when the predicted disk usage in the future time period is greater than the usage threshold, the current limiting control type is determined to be soft current limiting, and the above-mentioned predicted disk usage is predicted based on the log printing speed in the historical time period and the current disk usage, and the above-mentioned future time period is the time period after the historical time period; when the predicted disk usage is less than or equal to the usage threshold and there is at least one target class log in the disk in the future time period with a predicted printing volume greater than the target printing threshold, the current limiting control type corresponding to the target class log is determined to be soft current limiting, and the above-mentioned predicted printing volume is predicted based on the log printing speed of the target class log in the historical time period and the historical printing volume corresponding to the target class log on the disk.

[0074] The aforementioned non-core error logs are logs that record non-critical errors or exceptions. These errors may not seriously impact the overall operation of the system, or may only occur occasionally and are easily resolved. The content of non-core error logs may include, but is not limited to: warning messages during system or application runtime. These warnings typically indicate potential problems with certain operations but may not necessarily result in system crashes or data loss; exceptions caused by improper user operations or input errors. These exceptions help understand user usage habits and the causes of problems; and prompts indicating insufficient system resources or performance bottlenecks. These prompts can help administrators optimize system configuration and performance. The aforementioned non-core error logs are primarily used to provide additional contextual information to help developers and operations personnel gain a more comprehensive understanding of the system's operating status and user behavior. The aforementioned core error logs are logs that record critical errors or exceptions. These errors typically have a serious impact on the overall operation of the system and may even cause system crashes or data loss. Core error logs may include, but are not limited to, error messages from system or application crashes, which help locate the root cause and repair the system; prompts for data corruption or loss, which are crucial for ensuring data integrity and security; and security-related errors and exceptions, such as unauthorized access attempts and data leaks, which are crucial for ensuring system security. Core error logs primarily provide critical error information to help developers and operations personnel quickly locate and resolve issues. They typically carry a higher priority and urgency, requiring prompt processing and response.

[0075] The hard limit described above is a strict log output (printing) restriction policy that limits (or denies) log printing. The soft limit described above is a more flexible and relaxed restriction policy that mainly reduces the frequency or speed of log printing through some mechanisms (such as delayed processing and log merging).

[0076] In the embodiment of the present specification, when the current disk usage is greater than the usage threshold, a current limiting strategy is adopted that directly limits the printing of non-core error logs and reduces the printing frequency of core error logs. This ensures that key information in the log printing process can be effectively recorded, while also ensuring that system resources will not be over-consumed by log printing, effectively controlling the amount of log printing, and avoiding various potential risks caused by excessive log volume, thereby protecting the stability and performance of the system.

[0077] When the current disk usage is less than or equal to the usage threshold and the historical printing volume corresponding to at least one target class log on the disk is greater than the target printing threshold, it means that the historical printing volume corresponding to at least one target class log on the disk is too much, and there may be a large number of duplicate target class logs wasting disk space. In this case, a soft current limiting strategy can be used to print target class logs with excessive historical printing volume to avoid the problem of a large number of duplicate target class logs being invalidly printed, thereby improving the effectiveness of log printing.

[0078] If the predicted disk usage in the future time period is greater than the usage threshold, it means that if normal printing continues, the disk space usage may exceed the log printing safety boundary condition, affecting system performance and stability. In this case, you can reduce the log printing frequency in advance to effectively reduce the future log printing volume and ensure system stability and performance during future printing.

[0079] Optionally, the above-mentioned current limiting strategy can also be, but not limited to, setting different printing frequencies according to the log level. For example, but not limited to, ERROR and WARN level logs to be printed are printed in real time, while INFO or DEBUG level logs to be printed can have their printing frequency reduced.

[0080] Optionally, the above-mentioned rate limiting strategy can also be, but is not limited to, controlling the log output frequency through a counter or time interval. For example, but not limited to, you can set a time interval (such as every 5 minutes, every 10 minutes, etc.) to limit the number of times the log to be printed with the same content is printed, and use the rate limiting plug-in provided by the logging framework or a custom filter to achieve frequency limiting printing.

[0081] S308: Start a corresponding current-limited printing operation for the print log according to the current-limiting policy.

[0082] Specifically, after determining a rate limiting strategy, it can be implemented in the logging system. For example, but not limited to, the rate limiting printing operation corresponding to the category of the log to be printed can be initiated based on the rate limiting strategy. This can effectively prevent the surge in log volume during high concurrency or abnormal situations, which can lead to system performance degradation or disk space exhaustion. The rate limiting strategy can be flexibly adjusted based on actual printing conditions to ensure that important information is not missed while also coping with the impact of massive data in unexpected situations.

[0083] In some possible embodiments, such as Figure 4As shown, the implementation process of the above-mentioned log printing method may include, but is not limited to: first obtaining log printing information, and then determining whether it exceeds the log printing safety boundary condition. If the log printing safety boundary condition is exceeded, the target key feature will be extracted from the log to be printed before the current limiting printing operation is started on the log to be printed; then, based on the target key feature, the log to be printed is classified to obtain the category corresponding to the log to be printed; finally, based on the remaining disk space and / or the category corresponding to the log to be printed, the current limiting printing operation is started for the log to be printed, for example, but not limited to, when the remaining disk space is less than a first threshold and greater than a second threshold (the second threshold is less than the first threshold), the printing frequency of the log to be printed is reduced, and when the remaining disk space is less than the second threshold, the printing operation of the log to be printed is limited, etc. If the log printing safety boundary condition is not exceeded, a normal printing operation will be started on the log to be printed. After executing the greater than operation, the actual printing effect, i.e., the log printing information, can be continuously obtained, and the threshold parameters in the log printing safety boundary condition can be updated and fine-tuned accordingly to maintain the health of the system.

[0084] Please refer to the following Figure 5 , Figure 5 This is a schematic diagram of a log printing device provided as an exemplary embodiment of this specification. Figure 5 As shown, the log printing device 500 includes:

[0085] The information acquisition module 510 is used to obtain log printing information; the log printing information includes at least one of the following: current disk usage, historical printing volume corresponding to various log types in the disk, and log printing speed;

[0086] The judgment module 520 is used to judge whether it is necessary to start a current-limited printing operation based on the log printing information and the log printing safety boundary conditions; the current-limited printing operation is used to limit the number of logs printed on the disk;

[0087] The current limiting printing module 530 is configured to start the current limiting printing operation for the log to be printed if the current limiting printing operation needs to be started.

[0088] In a possible implementation, the log printing safety boundary condition includes at least one of the following: the disk usage is less than or equal to the usage threshold, and the print volume corresponding to the same type of logs on the disk is less than or equal to the target print threshold;

[0089] The judgment module 520 is specifically used for:

[0090] Determine whether the above-mentioned current disk usage is greater than the above-mentioned usage threshold, and / or determine whether the historical printing volume corresponding to each type of log in the disk is greater than the above-mentioned target printing threshold, and / or whether the disk usage in the future time period predicted based on the log printing speed in the above-mentioned historical time period will be greater than the above-mentioned usage threshold; if the above-mentioned current disk usage is greater than the above-mentioned usage threshold or there is at least one target type of log in the above-mentioned disk whose historical printing volume is greater than the above-mentioned target printing threshold or the disk usage in the above-mentioned future time period will be greater than the above-mentioned usage threshold, it is determined that the current limiting printing operation needs to be started.

[0091] In a possible implementation, the log printing device 500 further includes:

[0092] A determination module, configured to determine a current limiting strategy corresponding to the current limiting printing operation based on the log printing information and the log printing safety boundary conditions;

[0093] The current limiting printing module 530 is specifically used for:

[0094] The corresponding current limiting printing operation is initiated for the log to be printed according to the current limiting strategy.

[0095] In one possible implementation, the log printing safety boundary condition includes at least one of the following: disk usage is less than or equal to a usage threshold, and the print volume corresponding to the same type of logs on the disk is less than or equal to a target print threshold; the flow limiting strategy includes a flow limiting log type and / or a flow limiting control type;

[0096] The current limiting printing module 530 is specifically used for:

[0097] When the current disk usage is greater than the usage threshold, the current limiting control type corresponding to the non-core error class log is determined to be hard current limiting, and the current limiting control type corresponding to the core error class log is determined to be soft current limiting; when the current disk usage is less than or equal to the usage threshold and the historical printing volume corresponding to at least one target class log in the disk is greater than the target printing threshold, the current limiting control type corresponding to the target class log is determined to be soft current limiting; or, when the predicted disk usage in a future time period is greater than the usage threshold, the current limiting control type is determined to be soft current limiting; the predicted disk usage is predicted based on the log printing speed in the historical time period and the current disk usage; the future time period is a time period after the historical time period; when the predicted disk usage is less than or equal to the usage threshold and the predicted printing volume corresponding to at least one target class log in the disk in the future time period is greater than the target printing threshold, the current limiting control type corresponding to the target class log is determined to be soft current limiting; the predicted printing volume is predicted based on the log printing speed of the target class log in the historical time period and the historical printing volume of the target class log in the disk.

[0098] In a possible implementation, the log printing device 500 further includes:

[0099] The feature extraction module is used to extract target key features from the log to be printed.

[0100] The classification module is used to classify the logs to be printed based on the target key features to obtain the categories corresponding to the logs to be printed.

[0101] The current limiting printing module 530 is specifically configured to start the current limiting printing operation on the log to be printed based on the remaining disk space and / or the category corresponding to the log to be printed.

[0102] In a possible implementation, the current limiting printing module 530 is specifically configured to:

[0103] Based on the current disk usage and the historical printing volume of each type of log in the disk, the remaining printing limit corresponding to each type of log in the disk is determined; based on the remaining printing limit corresponding to each type of log in the disk, the current-limited printing operation is started for the log to be printed.

[0104] In a possible implementation, the log printing device 500 further includes:

[0105] The disk cleaning module is used to clean up the historical logs stored in the disk when the current disk usage rate is greater than or equal to the target threshold; or to clean up the historical logs stored in the disk according to a preset period; or to clean up the above-mentioned target historical logs in the disk when there are target historical logs on the disk that have been printed for more than a preset time.

[0106] In a possible implementation, the log printing device 500 further includes:

[0107] The normal printing module is used to start a normal printing operation on the log to be printed if no.

[0108] The division of the modules in the above-mentioned log printing device is only for illustration. In other embodiments, the log printing device can be divided into different modules as needed to complete all or part of the functions of the above-mentioned log printing device. The implementation of each module in the log printing device provided in the embodiments of this specification can be in the form of a computer program. The computer program can be run on a terminal or a server. The program modules constituted by the computer program can be stored in the memory of the terminal or the server. When the computer program is executed by the processor, all or part of the steps of the log printing method described in the embodiments of this specification are implemented.

[0109] See next Figure 6 , Figure 6 This is a schematic diagram of the structure of an electronic device provided by an exemplary embodiment of this specification. Figure 6 As shown, the electronic device 600 may include: at least one processor 610, at least one communication bus 620, a user interface 630, at least one network interface 640, and a memory 650. The communication bus 620 may be used to implement connection and communication between the above components.

[0110] The user interface 630 may include a display screen (Display) and a camera (Camera). Optionally, the user interface 630 may also include a standard wired interface and a wireless interface.

[0111] The network interface 640 may optionally include a Bluetooth module, a Near Field Communication (NFC) module, a Wireless Fidelity (Wi-Fi) module, and the like.

[0112] The processor 610 may include one or more processing cores. The processor 610 utilizes various interfaces and circuits to connect various components within the electronic device 600. By running or executing instructions, programs, code sets, or instruction sets stored in the memory 650, and accessing data stored in the memory 650, the processor 610 performs various functions and processes data for the routing electronic device 600. Optionally, the processor 610 may be implemented using at least one of the following hardware forms: a digital signal processing (DSP), a field-programmable gate array (FPGA), or a programmable logic array (PLA). The processor 610 may integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. The CPU primarily processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing the content displayed on the display; and the modem handles wireless communications. It is understood that the modem may not be integrated into the processor 610 and may be implemented as a separate chip.

[0113] Among them, the memory 650 may include a random access memory (RAM) or a read-only memory (ROM). Optionally, the memory 650 includes a non-transitory computer-readable medium. The memory 650 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 650 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as an information acquisition function, a log printing function, a current limiting printing function, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 650 may also be optionally at least one storage device located away from the aforementioned processor 610. As Figure 6 As shown, the memory 650 as a computer storage medium may include an operating system, a network communication module, a user interface module, and an application program.

[0114] Specifically, the processor 610 can be used to call the application stored in the memory 650 and perform the following operations: obtain log printing information; the above-mentioned log printing information includes at least one of the following: current disk usage, historical printing volume corresponding to various types of logs on the disk, and log printing speed within a historical time period; based on the above-mentioned log printing information and log printing safety boundary conditions, determine whether it is necessary to start a current limiting printing operation; the above-mentioned current limiting printing operation is used to limit the number of prints of logs on the above-mentioned disk; if so, start the above-mentioned current limiting printing operation for the log to be printed.

[0115] In some possible embodiments, the log printing safety boundary condition includes at least one of the following: disk usage is less than or equal to a usage threshold, and the print volume corresponding to the same type of logs on the disk is less than or equal to a target print threshold;

[0116] When the processor 610 determines whether to start the current-limited printing operation based on the log printing information and the log printing safety boundary condition, it is specifically configured to perform:

[0117] Determine whether the above-mentioned current disk usage is greater than the above-mentioned usage threshold, and / or determine whether the historical printing volume corresponding to each type of log in the disk is greater than the above-mentioned target printing threshold, and / or whether the disk usage in the future time period predicted based on the log printing speed in the above-mentioned historical time period will be greater than the above-mentioned usage threshold; if the above-mentioned current disk usage is greater than the above-mentioned usage threshold or there is at least one target type of log in the above-mentioned disk whose historical printing volume is greater than the above-mentioned target printing threshold or the disk usage in the above-mentioned future time period will be greater than the above-mentioned usage threshold, it is determined that the current limiting printing operation needs to be started.

[0118] In some possible embodiments, after the processor 610 determines whether it is necessary to start the current limiting printing operation based on the log printing information and the log printing safety boundary conditions, and before executing the current limiting printing operation to be started on the log to be printed, it is also used to execute: determine the current limiting policy corresponding to the current limiting printing operation based on the log printing information and the log printing safety boundary conditions.

[0119] When the processor 610 executes the initiation of the current-limited printing operation on the log to be printed, it is specifically configured to execute: initiating the corresponding current-limited printing operation on the log to be printed according to the current-limiting strategy.

[0120] In some possible embodiments, the log printing safety boundary condition includes at least one of the following: disk usage is less than or equal to a usage threshold, and the print volume corresponding to the same type of logs on the disk is less than or equal to a target print threshold; the current limiting strategy includes a current limiting log type and / or a current limiting control type;

[0121] When the processor 610 determines the current limiting policy corresponding to the current limiting printing operation based on the log printing information and the log printing safety boundary condition, it is specifically configured to execute:

[0122] When the current disk usage is greater than the usage threshold, the current limiting control type corresponding to the non-core error class log is determined to be hard current limiting, and the current limiting control type corresponding to the core error class log is determined to be soft current limiting; when the current disk usage is less than or equal to the usage threshold and the historical printing volume corresponding to at least one target class log in the disk is greater than the target printing threshold, the current limiting control type corresponding to the target class log is determined to be soft current limiting; or, when the predicted disk usage in a future time period is greater than the usage threshold, the current limiting control type is determined to be soft current limiting; the predicted disk usage is predicted based on the log printing speed in the historical time period and the current disk usage; the future time period is a time period after the historical time period; when the predicted disk usage is less than or equal to the usage threshold and the predicted printing volume corresponding to at least one target class log in the disk in the future time period is greater than the target printing threshold, the current limiting control type corresponding to the target class log is determined to be soft current limiting; the predicted printing volume is predicted based on the log printing speed of the target class log in the historical time period and the historical printing volume of the target class log in the disk.

[0123] In some possible embodiments, before the processor 610 executes the current-limited printing operation on the log to be printed, it is also used to execute: extracting target key features from the log to be printed; classifying the log to be printed based on the target key features to obtain the category corresponding to the log to be printed.

[0124] When the processor 610 executes the above-mentioned starting the above-mentioned current-limited printing operation on the log to be printed, it is specifically configured to execute: starting the above-mentioned current-limited printing operation on the log to be printed based on the remaining disk space and / or the category corresponding to the log to be printed.

[0125] In some possible embodiments, when the processor 610 executes the current-limited printing operation on the log to be printed, it is specifically configured to execute:

[0126] Based on the current disk usage and the historical printing volume of each type of log in the disk, the remaining printing limit corresponding to each type of log in the disk is determined; based on the remaining printing limit corresponding to each type of log in the disk, the current-limited printing operation is started for the log to be printed.

[0127] In some possible embodiments, the processor 610 is further configured to: clear the historical logs stored on the disk when the current disk usage is greater than or equal to the target threshold; or, clear the historical logs stored on the disk according to a preset period; or, clear the target historical logs on the disk when there are target historical logs on the disk that have been printed for longer than a preset time.

[0128] In some possible embodiments, after the processor 610 determines whether to start the current-limited printing operation based on the log printing information and the log printing safety boundary condition, it is further configured to execute:

[0129] If not, normal printing operation is started for the log to be printed.

[0130] The embodiments of this specification also provide a computer-readable storage medium storing instructions that, when executed on a computer or processor, cause the computer or processor to perform one or more steps of the above-described embodiments. If the components of the log printing device are implemented as software functional units and sold or used as independent products, they can be stored in the computer-readable storage medium.

[0131] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When software is used for implementation, it can be implemented in whole or in part in the form of a computer program product. The above-mentioned computer program product includes one or more computer instructions. When the above-mentioned computer program instructions are loaded and executed on a computer, the above-mentioned process or function according to the embodiment of this specification is generated in whole or in part. The above-mentioned computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The above-mentioned computer instructions can be stored in a computer-readable storage medium or transmitted by the above-mentioned computer-readable storage medium. The above-mentioned computer instructions can be transmitted from a website, computer, server or data center to another website, computer, server or data center by wired, such as coaxial cable, optical fiber, digital subscriber line (DSL) or wireless (such as infrared, wireless, microwave, etc.). The above-mentioned computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The above-mentioned available media can be magnetic media (for example, floppy disks, hard disks, tapes), optical media, for example, digital versatile discs (DVDs), or semiconductor media, for example, solid state disks (SSDs).

[0132] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a computer-readable storage medium. When executed, the program can include the processes of the above-described method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks. The technical features of this embodiment and the implementation scheme can be combined in any manner unless they conflict.

[0133] The embodiments described above are merely preferred embodiments of this specification and are not intended to limit the scope of this specification. Without departing from the design spirit of this specification, various modifications and improvements made to the technical solutions of this specification by ordinary technicians in this field should fall within the scope of protection determined by the claims.

[0134] The foregoing description of specific embodiments of the present disclosure is intended to be a description of other embodiments. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims and the specification can be performed in a different order than that described in the embodiments described in the specification and still achieve the desired results. Furthermore, the processes depicted in the accompanying drawings do not necessarily require the specific order shown or the sequential order to achieve the desired results. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.

Claims

1. A log printing method, the method comprising: Get log printing information; The log printing information includes at least one of the following: current disk usage, historical printing volume corresponding to various types of logs on the disk, and log printing speed within a historical time period; Determining whether a current limiting printing operation needs to be started based on the log printing information and the log printing safety boundary condition; the current limiting printing operation is used to limit the number of logs printed on the disk; If so, the current-limited printing operation is started for the log to be printed.

2. The method according to claim 1, wherein the log printing safety boundary condition comprises at least one of the following: a disk usage rate is less than or equal to a usage rate threshold, and a print volume corresponding to the same type of logs on the disk is less than or equal to a target print threshold; The determining whether to start the current-limited printing operation based on the log printing information and the log printing safety boundary condition includes: Determining whether the current disk usage is greater than the usage threshold, and / or determining whether the historical printing volume corresponding to each type of log in the disk is greater than the target printing threshold, and / or determining whether the disk usage in a future time period predicted based on the log printing speed in the historical time period is greater than the usage threshold; If the current disk usage is greater than the usage threshold or there is at least one target type log in the disk with a historical printing volume greater than the target printing threshold or the disk usage in the future time period will be greater than the usage threshold, it is determined that the current limiting printing operation needs to be started.

3. The method of claim 1 , further comprising: after determining whether to initiate a current-limited printing operation based on the log printing information and the log printing safety boundary condition, and before initiating the current-limited printing operation on the log to be printed: Determining a current limiting policy corresponding to the current limiting printing operation based on the log printing information and the log printing safety boundary condition; The starting of the current-limited printing operation for the log to be printed includes: The corresponding current limiting printing operation is initiated for the log to be printed according to the current limiting strategy.

4. The method according to claim 3, wherein the log printing safety boundary condition comprises at least one of the following: a disk usage rate is less than or equal to a usage rate threshold, and a print volume corresponding to the same type of logs on the disk is less than or equal to a target print threshold; the flow limiting strategy comprises a flow limiting log type and / or a flow limiting control type; The determining, based on the log printing information and the log printing safety boundary condition, a current limiting policy corresponding to the current limiting printing operation includes: When the current disk usage is greater than the usage threshold, determining that the current limiting control type corresponding to the non-core error log is hard current limiting and the current limiting control type corresponding to the core error log is soft current limiting; When the current disk usage is less than or equal to the usage threshold and the historical printing volume corresponding to at least one target type log in the disk is greater than the target printing threshold, determining that the current limiting control type corresponding to the target type log is soft current limiting; or When the predicted disk usage in a future time period is greater than the usage threshold, determining that the current limiting control type is soft current limiting; the predicted disk usage is predicted based on the log printing speed in the historical time period and the current disk usage; the future time period is a time period after the historical time period; When the predicted disk usage is less than or equal to the usage threshold and there is at least one target class log in the disk within the future time period and the predicted printing volume corresponding to the target class log is greater than the target printing threshold, the current limiting control type corresponding to the target class log is determined to be soft current limiting; the predicted printing volume is predicted based on the log printing speed of the target class log within the historical time period and the historical printing volume corresponding to the target class log in the disk.

5. The method according to claim 1, before initiating the current-limited printing operation on the log to be printed, the method further comprises: Extract target key features from the log to be printed; Classifying the logs to be printed based on the target key features to obtain categories corresponding to the logs to be printed; The starting of the current-limited printing operation for the log to be printed includes: Based on the remaining disk space and / or the category corresponding to the log to be printed, the current-limited printing operation is started for the log to be printed.

6. The method according to claim 1, wherein the starting the current-limited printing operation for the log to be printed comprises: Determining the remaining print limit corresponding to each type of log in the disk based on the current disk usage and the historical print volume corresponding to each type of log in the disk; The current-limited printing operation is initiated for the log to be printed based on the remaining printing upper limit corresponding to each type of log in the disk.

7. The method of claim 1, further comprising: When the current disk usage is greater than or equal to the target threshold, clearing the historical logs stored in the disk; or Clean up historical logs stored on disk according to preset cycles; or When there is a target history log in the disk whose printing time exceeds a preset time, the target history log in the disk is cleared.

8. The method according to claim 1, after determining whether to start a current-limited printing operation based on the log printing information and the log printing safety boundary condition, the method further comprises: If not, normal printing operation is started for the log to be printed.

9. A log printing device, comprising: Information acquisition module, used to obtain log printing information; The log printing information includes at least one of the following: current disk usage, historical printing volume corresponding to various types of logs on the disk, and log printing speed; A judgment module, configured to judge whether a current-limited printing operation needs to be started based on the log printing information and the log printing safety boundary conditions; The current limiting printing operation is used to limit the number of logs printed on the disk; The current limiting printing module is used to start the current limiting printing operation on the log to be printed if the current limiting printing operation needs to be started.

10. An electronic device comprising: processor and memory; The processor is connected to the memory; The memory is used to store executable program code; The processor runs a program corresponding to the executable program code by reading the executable program code stored in the memory, so as to execute the method according to any one of claims 1 to 8.

11. A computer storage medium storing a plurality of instructions, wherein the instructions are suitable for being loaded by a processor and executing the method steps according to any one of claims 1 to 8.

12. A computer program product comprising instructions, which, when executed on a computer or a processor, enables the computer or the processor to execute the log printing method according to any one of claims 1 to 8.