"gateway-log" RollingFile Appender
This appender manages gateway logs with automatic file rotation.
Configuration example:
xml
<Appenders>
<RollingFile name="gateway-log" fileName="logs/gateway.log" filePattern="logs/gateway-%d{yyyy-MM-dd}.log">
<PatternLayout pattern="%d %-5p [%t][%c][%X{MDC_USER}][%X{MDC_SESSION}] - %m%n"/>
<Policies>
<SizeBasedTriggeringPolicy size="256MB"/>
</Policies>
<DefaultRolloverStrategy max="10"/>
</RollingFile>
</Appenders>
Example Log :
text
2025-02-06 15:15:29,546 INFO [Main][com.okiok.babelone.ssh.maverick.SSH2ServerDaemon][][] - SSH server configuration complete.
Log details:
2025-02-06 15:15:29,546
: Date and time of the logINFO
: Log level[Main]
: Thread name[com.okiok.babelone.ssh.maverick.SSH2ServerDaemon][][]
: Class name generating the log- SSH server configuration complete.
: Log message
Basic Configuration
- Name:
gateway-log
- Output file:
logs/gateway.log
- Archive file pattern:
logs/gateway-[DATE].log
Log Format
The pattern %d %-5p [%t][%c][%X{MDC_USER}][%X{MDC_SESSION}] - %m%n
defines the following format:
%d
: Log date and time%-5p
: Log level (DEBUG, INFO, ERROR...) aligned to 5 characters[%t]
: Thread name[%c]
: Class name generating the log[%X{MDC_USER}]
: Username (from MDC)[%X{MDC_SESSION}]
: Session identifier (from MDC)%m
: Log message%n
: Line break
Rotation Policy
- SizeBasedTriggeringPolicy: 256MB per file
- DefaultRolloverStrategy: Maximum 10 archive files
- Rotation creates a new file when:
- Current file reaches 256MB
- A new day begins (based on date pattern)
Characteristics
- Format particularly suitable for:
- Gateway operations monitoring
- User session analysis for the different protocols.
- Connection issues diagnosis
- User actions auditing through the gateway