Application Log Record Optimization via Code Injection

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Existing application program log record generation methods consume significant hardware resources and reduce application program performance due to large log file storage and frequent IO operations, often resulting in loss of important information and requiring complex modifications to the program code.

Innovation Solution

The method involves identifying the original log method, separating character string parameters into constant and variable parts, establishing a correspondence flag, and constructing an optimized log method through code injection, which reduces storage size and IO operations by recording constant information once and variable information only when needed.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Loss of information

If the original log method records all log information to the log file, then the log information is complete and intact, but the storage size increases and IO operations become frequent

Engineering Contradiction:
Improvelog information integrityVSAvoidlog file storage size
Core Design Contradiction:
Loss of informationVSQuantity of substance

Solution Approach 1:

The patent segments the log information into two distinct parts: constant information (log template) and variable information (dynamic parameters). The constant part is extracted and stored separately in a memory buffer, while only the variable part is written to the log file during each logging operation. This segmentation reduces the amount of data written to disk while preserving complete log information integrity.

Inventive Principle:
Principle #1Segmentation

2Loss of information

If the original log method records all log information to the log file, then the log information is complete and intact, but the IO operations become frequent and performance decreases

Engineering Contradiction:
Improvelog information integrityVSAvoidapplication program execution speed
Core Design Contradiction:
Loss of informationVSProductivity

Solution Approach 1:

By segmenting log information into constant and variable parts, the patent eliminates redundant writing of constant data to disk. The constant log template is loaded once into memory, and only variable parameters are appended during logging operations, significantly reducing IO frequency and improving application performance.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent performs preliminary action by pre-loading the constant log template into a memory buffer before actual logging operations occur. This preparation eliminates the need to repeatedly write the same constant information to disk, reducing IO operations and improving execution speed.

Inventive Principle:
Principle #10Preliminary action

3Productivity

If the log file size is reduced by not recording constant information, then storage size and IO operations decrease, but the log information becomes incomplete

Engineering Contradiction:
Improvelogging operation efficiencyVSAvoidlog information completeness
Core Design Contradiction:
ProductivityVSLoss of information

Solution Approach 1:

The patent introduces an intermediary mechanism - a memory buffer that stores the constant log template. This buffer acts as a mediator between the logging system and the log file, allowing constant information to be retained in memory while only variable information is persisted to disk. The complete log information is reconstructed by combining data from both the buffer and the log file.

Inventive Principle:
Principle #24Intermediary (Mediator)

4Quantity of substance

If the existing program code and log record mechanism are modified to reduce log file size, then storage efficiency improves, but the complexity of modification increases

Engineering Contradiction:
Improvelog file storage sizeVSAvoidcode modification complexity
Core Design Contradiction:
Quantity of substanceVSDevice complexity

Solution Approach 1:

The patent implements a self-service mechanism where the logging system automatically identifies, extracts, and separates constant and variable information from log statements without requiring manual code modification. The system autonomously builds the constant information buffer and handles the separation logic, eliminating the need for complex manual code changes while achieving log file size reduction.

Inventive Principle:
Principle #25Self-service

Data Source

PatentUS8949799B2Program log record optimization
Publication Date: 2015.02.03 INTERNATIONAL BUSINESS MACHINE CORPORATION
  • US8949799B2 patent drawing
  • US8949799B2 patent drawing
  • US8949799B2 patent drawing

AI summary

The present invention relates to application program logs. In particular, the invention relates to a method and a system in which an original log method of an application program is optimized and newly injected to the application program. According to one aspect of the present invention, there is provided a method for optimizing an application program log record, comprising: identifying an original log method of an application program; separating a character string parameter in the original log method into a constant part and a variable part; establishing a correspondence flag between the constant part and the variable part; constituting an optimized log method by the constant part, the variable part and the correspondence flag; and replacing the original log method with the optimized log method through a code injection. With the above method, the hard disk storage amount of the log record and the IO operation frequency can be reduced.