Skip to content

Instantly share code, notes, and snippets.

@rjdkolb
Created Jun 9, 2016
Embed
What would you like to do?
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" name="API" monitorInterval="30">
<Appenders>
<RollingRandomAccessFile name="CatchAll" fileName="logs/all.log" immediateFlush="false" append="true" FilePattern="logs/$${date:yyyy-MM}/all-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout>
<Pattern>%d %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
<SizeBasedTriggeringPolicy size="2 GB"/>
</Policies>
<DefaultRolloverStrategy max="20"/>
</RollingRandomAccessFile>
<RollingRandomAccessFile name="Audit" fileName="logs/audit.log" immediateFlush="false" append="true" FilePattern="logs/$${date:yyyy-MM}/audit-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout>
<Pattern>%d %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
<SizeBasedTriggeringPolicy size="2 GB"/>
</Policies>
<DefaultRolloverStrategy max="20"/>
</RollingRandomAccessFile>
<RollingRandomAccessFile name="Fault" fileName="logs/fault.log" immediateFlush="false" append="true" FilePattern="logs/$${date:yyyy-MM}/fault-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout>
<Pattern>%d %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
<SizeBasedTriggeringPolicy size="2 GB"/>
</Policies>
<DefaultRolloverStrategy max="20"/>
</RollingRandomAccessFile>
<RollingRandomAccessFile name="LegacyAudit" fileName="logs/webservices.log" immediateFlush="false" append="true" FilePattern="logs/$${date:yyyy-MM}/webservices-%d{yyyy-MM-dd}-%i.log.gz">
<PatternLayout>
<Pattern>%d %m%n</Pattern>
</PatternLayout>
<Policies>
<TimeBasedTriggeringPolicy interval="1" modulate="true" />
<SizeBasedTriggeringPolicy size="2 GB"/>
</Policies>
<DefaultRolloverStrategy max="20"/>
</RollingRandomAccessFile>
</Appenders>
<!-- Don't forget to set system property for Async
-DLog4jContextSelector=org.apache.logging.log4j.core.async.AsyncLoggerContextSelector
to make all loggers asynchronous. -->
<Loggers>
<Root level="OFF">
<AppenderRef ref="CatchAll"/>
</Root>
<Logger name="io.r3k.log4j2test.XApp" level="trace">
<AppenderRef ref="Audit"/>
</Logger>
<Logger name="io.r3k.log4j2test.YApp" level="trace">
<AppenderRef ref="LegacyAudit"/>
</Logger>
<Logger name="io.r3k.log4j2test.FApp" level="trace">
<AppenderRef ref="Fault"/>
</Logger>
</Loggers>
</Configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment