Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
log4j: Route only subpackage to different appender
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN" monitorInterval="30">
<Appenders>
<Console name="ConsoleAppenderA" target="SYSTEM_OUT" follow="true">
<PatternLayout pattern="mainlog> %m%n%ex"/>
</Console>
<Console name="ConsoleAppenderB" target="SYSTEM_OUT" follow="true">
<PatternLayout pattern="sublog> %m%n%ex"/>
</Console>
</Appenders>
<Loggers>
<Logger name="com.example.demo" level="debug" >
<AppenderRef ref="ConsoleAppenderA" />
</Logger>
<Logger name="com.example.demo.sub" level="debug" additivity="false">
<AppenderRef ref="ConsoleAppenderB" />
</Logger>
<Root level="info">
<AppenderRef ref="ConsoleAppender" />
</Root>
</Loggers>
</Configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.