Parameter name: header
Type: String
Description: the optional header string to include at the top of each log file
With the following log4j2.xml configuration:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | <?xml version="1.0" encoding="UTF-8"?> <Configuration status="WARN" monitorInterval="20"> <Appenders> <RollingRandomAccessFile name="file" fileName="logs/app.log" filePattern="logs/app-%d_%i.log.gz"> <PatternLayout> <header> Version: ${env:APP_RELEASE_VERSION} </header> <pattern>%message%n</pattern> </PatternLayout> <Policies> <OnStartupTriggeringPolicy/> </Policies> </RollingRandomAccessFile> </Appenders> <Loggers> <Root level="debug"> <AppenderRef ref="file"/> </Root> </Loggers> </Configuration> |