Method for dynamically and remotely controlling equipment log system

By dynamically adjusting the log mode and level, monitoring resources, and realizing remote control and caching mechanisms, the problem of fixed log system configuration and uncontrollable resource consumption is solved, the system flexibility and performance is improved, and the efficiency of logging and remote control is ensured. security.

CN118981409APending Publication Date: 2024-11-19DRAGONFLY INTELLIGENT VISION TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411086939.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-08
Publication Date
2024-11-19

AI Technical Summary

Technical Problem

The existing log system has fixed configuration, uncontrollable resource consumption, limited remote control capabilities and lack of adaptive mechanisms, resulting in inefficiency and increased maintenance difficulty.

Method used

Provide a dynamic remote control device logging system, which initializes the log module, sets the default mode and level, obtains runtime information, judges and updates the log mode and level, monitors resource usage, automatically adjusts policies, and realizes log caching and security. Connect, supports remote control and exception recovery.

Benefits of technology

It realizes dynamic control of the log system, improves flexibility and adaptability, optimizes system performance, enhances reliability and fault tolerance, and improves logging efficiency and remote control security.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118981409A_ABST
    Figure CN118981409A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of software engineering, in particular to a method for dynamically and remotely controlling an equipment log system, which comprises the following steps of: initializing a log module; setting a default log mode; setting default log levels; log information during software operation is obtained; recording the log information based on a current log mode and a log level; judging whether a log mode updating instruction is received or not; if a log mode updating instruction is received, updating the log mode; judging whether a log level updating instruction is received or not; if a log level updating instruction is received, updating the log level; the step from obtaining the log information to updating the log level is repeatedly executed to form closed-loop control, so that the dynamic control of the log system is realized, and the flexibility and adaptability of the system are improved; log management of the distributed system is facilitated through a remote control function; a system resource monitoring and self-adaptive adjusting mechanism is introduced, so that the system performance is optimized; and the reliability and the fault-tolerant capability are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of software engineering, and in particular to a method capable of dynamically and remotely controlling a device log system. Background Art

[0002] In software development and system maintenance, the log system plays a vital role. It records various information during the software operation process, including errors, warnings, operation records, etc., providing important diagnostic and analysis tools for developers and system administrators.

[0003] However, existing logging systems usually have the following problems:

[0004] Fixed log configuration: Most systems determine the log level and logging mode at startup and cannot be dynamically adjusted according to runtime requirements.

[0005] Uncontrollable resource consumption: Too detailed logging may lead to system performance degradation, while too brief logging may miss key information.

[0006] Limited remote control capabilities: In a distributed system, it is difficult to make real-time adjustments to the logging system of remote devices.

[0007] Lack of adaptive mechanism: The logging policy cannot be automatically adjusted according to system resource usage.

[0008] These problems lead to inefficient logging systems, increase the difficulty of system maintenance, and also affect the effectiveness of problem diagnosis and performance optimization. Summary of the invention

[0009] The purpose of the present invention is to provide a method for dynamically remotely controlling a device log system, so as to solve the problems in the prior art of fixed log system configuration, uncontrollable resource consumption, limited remote control capability and lack of adaptive mechanism.

[0010] To achieve the above object, the present invention provides the following technical solutions:

[0011] A method for dynamically remotely controlling a device log system comprises the following steps:

[0012] Initialize the log module;

[0013] Set the default logging mode;

[0014] Set the default log level;

[0015] Get log information when the software is running;

[0016] Based on the current log mode and log level, record the log information;

[0017] Determine whether a log mode update instruction is received;

[0018] If a log mode update instruction is received, the log mode is updated;

[0019] Determine whether a log level update instruction has been received;

[0020] If a log level update instruction is received, the log level is updated;

[0021] Repeat the steps from obtaining log information to updating log level to form a closed-loop control.

[0022] Specifically, the log mode includes one or more of the following: not recording any log, printing to the screen, recording to a file, and recording to a remote device site.

[0023] Specifically, the log level includes one or more of the following: error level, warning level, business information level, and debugging level.

[0024] Specifically, the step of updating the log mode includes:

[0025] Receive log mode update instructions;

[0026] Verifying the legitimacy of the update instruction;

[0027] Based on the verification results, update the current log mode.

[0028] Specifically, the step of updating the log level includes:

[0029] Receive log level update instructions;

[0030] Verifying the legitimacy of the update instruction;

[0031] Update the current log level based on the verification result.

[0032] Specifically, the following steps are also included:

[0033] Monitor system resource usage;

[0034] Based on the system resource usage, the log mode and / or log level are automatically adjusted.

[0035] Specifically, the following steps are also included:

[0036] Implement log cache mechanism;

[0037] Dynamically adjust the log cache strategy according to changes in log patterns.

[0038] Specifically, the log mode update instruction and the log level update instruction are sent through a local console or a remote control terminal.

[0039] Specifically, when the update instruction is sent through the remote control terminal, the following steps are also included:

[0040] Establish a secure connection between the device and the remote control terminal;

[0041] Encrypt and transmit update instructions;

[0042] Authentication and command decryption are performed on the device side.

[0043] Specifically, the following steps are also included:

[0044] Periodically save the current log mode and log level;

[0045] When the system is abnormal, it will automatically restore to the most recently saved log mode and log level.

[0046] The beneficial effects of the present invention include:

[0047] 1. Realize the dynamic control of the log system and improve the flexibility and adaptability of the system.

[0048] 2. The remote control function facilitates log management of distributed systems.

[0049] 3. Introduced system resource monitoring and adaptive adjustment mechanisms to optimize system performance.

[0050] 4. Multi-level configuration management (default configuration and dynamic configuration) improves the reliability and fault tolerance of the system.

[0051] 5. The introduction of log cache mechanism improves the efficiency of log recording.

[0052] 6. The design of security mechanism ensures the reliability of remote control and the security of data transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0053] Figure 1 is a flow chart of the method of the present invention.

[0054] Figure 2 It is a schematic diagram of the deployment of the system of the present invention. DETAILED DESCRIPTION

[0055] The following is combined with Figure 1-2 Specific embodiments of the present invention are described in detail.

[0056] Example 1: Basic function realization.

[0057] Step 1: Initialize the log module.

[0058] When the system starts, a log module object is created and necessary resources such as memory buffers, file handles, etc. are allocated.

[0059] Step 2: Set the default logging mode.

[0060] During initialization, set a default log mode, for example:

[0061] DEFAULT_LOG_MODE=LOG_MODE_FILE|LOG_MODE_PRINT

[0062] This sets up logging to both the file and the screen.

[0063] Step 3: Set the default log level.

[0064] Also set a default log level, for example:

[0065] DEFAULT_LOG_LEVEL=LOG_LEVEL_INFO

[0066] The default logging level is set here.

[0067] Step 4: Get the log information when the software is running

[0068] During the software operation, various log information is collected through the log interface function, such as:

[0069] def log(level,message):

[0070] if level<=current_log_level:

[0071] log_entry=f"{get_timestamp()}[{level}]{message}"

[0072] record_log(log_entry)

[0073] Step 5: Record log information based on the current log mode and log level.

[0074] Determine whether to log and how to log based on the currently set log mode and level:

[0075]

[0076]

[0077] Steps 6-9: Handle updates to logging modes and levels

[0078] Implement the function that updates the log mode and level:

[0079]

[0080] Step 10: Form a closed-loop control.

[0081] In the main loop, continuously check for update instructions and perform corresponding update operations:

[0082] Embodiment 2: Remote control function realization.

[0083] 1. Establish network services.

[0084] Implement a simple network service on the device side to receive remote control commands:

[0085]

[0086] 2. Process remote commands.

[0087]

[0088] 3. Implement security mechanism.

[0089] Add authentication and data encryption:

[0090]

[0091]

[0092] Embodiment 3: System resource adaptation

[0093] 1. Monitor system resources.

[0094]

[0095] 2. Automatically adjust the log strategy.

[0096]

[0097]

[0098] Example 4: Log cache mechanism.

[0099] 1. Implement log caching

[0100] 2. Dynamically adjust the cache strategy.

[0101]

[0102] Example 5: Abnormal recovery mechanism.

[0103] 1. Save the configuration regularly.

[0104]

[0105]

[0106] 2. Abnormal recovery.

[0107]

[0108] Among them, LOG_MODE_NONE: do not record any logs;

[0109] LOG_MODE_PRINT: print to the screen;

[0110] LOG_MODE_FILE: log to file;

[0111] LOG_MODE_NET: log to remote device site;

[0112] LOG_LEVEL_ERROR: error level;

[0113] LOG_LEVEL_WARN: warning level;

[0114] LOG_LEVEL_INFO: information level;

[0115] LOG_LEVEL_DEBUG: Debug level.

[0116] The present invention realizes a flexible, efficient and secure dynamic remote control device log system through the above method. The system has the following characteristics:

[0117] 1. Dynamic control: The log mode and level can be dynamically adjusted at runtime to meet different needs.

[0118] 2. Remote operation: Supports secure adjustment of log system parameters through remote control terminal.

[0119] 3. Resource adaptation: Automatically adjust the log strategy according to system resource usage to optimize system performance.

[0120] 4. Cache mechanism: Improve log recording efficiency and reduce I / O operations through log caching.

[0121] 5. Abnormal recovery: Save the configuration regularly and support recovery from abnormalities to improve system reliability.

[0122] 6. Security mechanism: Authentication and data encryption are implemented to ensure the security of remote control.

[0123] These features enable the present invention to effectively solve the problems existing in the log system in the prior art, and improve the flexibility, efficiency and reliability of the system. The method is particularly suitable for complex systems that require frequent adjustment of log strategies and device management in distributed environments.

[0124] It should be noted that the above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the protection scope of the present invention.

Claims

1. A method for dynamically remotely controlling a device log system, characterized in that: The following steps are involved: Initialize the log module; Set the default logging mode; Set the default log level; Get log information when the software is running; Based on the current log mode and log level, record the log information; Determine whether a log mode update instruction is received; If a log mode update instruction is received, the log mode is updated; Determine whether a log level update instruction has been received; If a log level update instruction is received, the log level is updated; Repeat the steps from obtaining log information to updating log level to form a closed-loop control.

2. The method according to claim 1, characterized in that The log mode includes one or more of the following: not recording any logs, printing to the screen, recording to a file, and recording to a remote device site.

3. The method according to claim 1, characterized in that The log level includes one or more of the following: error level, warning level, business information level, and debugging level.

4. The method according to claim 1, characterized in that: The steps of updating the log mode include: Receive log mode update instructions; Verifying the legitimacy of the update instruction; Update the current log mode based on the verification result.

5. The method according to claim 1, characterized in that The steps of updating the log level include: Receive log level update instructions; Verifying the legitimacy of the update instruction; Update the current log level based on the verification result.

6. The method according to claim 1, characterized in that The following steps are also included: Monitor system resource usage; Based on the system resource usage, the log mode and / or log level are automatically adjusted.

7. The method according to claim 1, characterized in that The following steps are also included: Implement log cache mechanism; Dynamically adjust the log cache strategy according to changes in log patterns.

8. The method according to claim 1, characterized in that The log mode update instruction and the log level update instruction are sent through the local console or the remote control terminal.

9. The method according to claim 8, characterized in that When sending the update command through the remote control terminal, the following steps are also included: Establish a secure connection between the device and the remote control terminal; Encrypt and transmit update instructions; Authentication and command decryption are performed on the device side.

10. The method according to claim 1, characterized in that The following steps are also included: Periodically save the current log mode and log level; When the system is abnormal, it will automatically restore to the most recently saved log mode and log level.