Skip to content

Instantly share code, notes, and snippets.

@gjp0609
Created September 8, 2021 06:35
Show Gist options
  • Save gjp0609/fb0bdf6de92bc0da34c6b552b4e54b0c to your computer and use it in GitHub Desktop.
Save gjp0609/fb0bdf6de92bc0da34c6b552b4e54b0c to your computer and use it in GitHub Desktop.
log4j2 config
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" monitorInterval="30">
<Properties>
<Property name="APP_NAME" value="webtools"/>
<Property name="LOG_PATH" value="/mnt/c/Files/Logs/Mine/webtools"/>
<Property name="LAYOUT" value="%style{%d{yyyy-MM-dd HH:mm:ss.SSS}}{Cyan} [%-26.26t] %5level %style{[%40.-40c{1.}:%-3.5L]}{Magenta} %m%n"/>
</Properties>
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout disableAnsi="false" pattern="${LAYOUT}"/>
</Console>
<RollingFile name="RollingFile" fileName="${LOG_PATH}/${APP_NAME}.log" filePattern="${LOG_PATH}/${APP_NAME}.%d{yyyy-MM-dd}.%i.log.gz">
<ThresholdFilter level="debug" onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout disableAnsi="false" pattern="${LAYOUT}"/>
<Policies>
<TimeBasedTriggeringPolicy/>
<SizeBasedTriggeringPolicy size="1k"/>
</Policies>
</RollingFile>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="Console"/>
<AppenderRef ref="RollingFile"/>
</Root>
<Logger name="com.onysakura" level="debug" additivity="false">
<AppenderRef ref="Console"/>
<AppenderRef ref="RollingFile"/>
</Logger>
</Loggers>
</Configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment