Skip to content

"transfer-log" RollingFile Appender

This appender manages file transfer logs with automatic file rotation.

Configuration example:

xml
<RollingFile name="transfer-log" fileName="logs/transfers.log" filePattern="logs/transfers-%d{yyyy-MM-dd}.log">
    <ThresholdFilter level="INFO"/>
    <PatternLayout pattern="%d %-5p %m%n"/>
    <Policies>
        <SizeBasedTriggeringPolicy size="1000KB"/>
    </Policies>
    <DefaultRolloverStrategy max="100"/>
</RollingFile>

Example Log :

text
2025-02-06 15:28:15,342 INFO  a9d4ff0b-c88c-4291-b11d-6f9470666f9b Upload ready from my-user to my-user. Document name: /seattle.jpg, size: 191307

Log details:

  1. 2025-02-06 15:28:15,342 : Date and time of the log
  2. INFO : Log level
  3. a9d4ff0b-c88c-4291-b11d-6f9470666f9b : User session identifier (from MDC)
  4. Upload ready from my-user to my-user. Document name: /seattle.jpg, size: 191307 : Log message

This log is associated with the "Transfer Log" extension. It will not be filled without the extention being activated in the application.

Basic Configuration

  • Name: transfer-log
  • Output file: logs/transfers.log
  • Archive file pattern: logs/transfers-[DATE].log

Log Format

The pattern %d %-5p %m%n defines the following format:

  • %d : Log date and time
  • %-5p : Log level (DEBUG, INFO, ERROR...) aligned to 5 characters
  • %m : Log message
  • %n : Line break

Rotation Policy

  • SizeBasedTriggeringPolicy: 1000KB (1MB) per file
  • DefaultRolloverStrategy: Maximum 100 archive files
  • Rotation creates a new file when:
    • Current file reaches 1MB
    • A new day begins (based on date pattern)

Filter

  • ThresholdFilter: Minimum level INFO
  • Only messages of level INFO or higher (WARN, ERROR, FATAL) will be recorded
  • DEBUG level messages will be ignored
  • Minimalist format particularly suitable for:
    • File transfer operations monitoring
    • Quick transfer event analysis
    • Maintaining substantial history (100 files)

References