Create a gist now

Instantly share code, notes, and snippets.

Embed
?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Console Appender -->
<appender name="stdout-appender" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.EnhancedPatternLayout">
<param name="ConversionPattern" value="%-5p | %d{MM-dd-yyyy HH:mm:ss.SSS} | %t | %c(0) - %m%n"/>
</layout>
</appender>
<!-- Syslog Appender -->
<appender name="syslog-appender" class="org.apache.log4j.net.SyslogAppender">
<param name="SyslogHost" value="33.33.33.20:5117"/>
<param name="Facility" value="USER"/>
<param name="FacilityPrinting" value="true"/>
<layout class="org.apache.log4j.EnhancedPatternLayout">
<!-- notice the ConversionPattern is the same with the difference of %m%throwable%n
which prints the stack trace as a single %m escaping the control characters -->
<param name="ConversionPattern" value="%-5p | %d{MM-dd-yyyy HH:mm:ss.SSS} | %t | %c(0) - %m%throwable%n"/>
</layout>
</appender>
<logger name="stdout-log4j-test" additivity="false">
<level value="trace"/>
<appender-ref ref="stdout-appender"/>
</logger>
<logger name="syslog-log4j-test" additivity="false">
<level value="trace"/>
<appender-ref ref="syslog-appender"/>
</logger>
<root>
<level value="info"/>
<appender-ref ref="stdout-appender"/>
</root>
</log4j:configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment