Skip to content

Instantly share code, notes, and snippets.

@hkarakose
Created August 9, 2017 16:14
Show Gist options
  • Save hkarakose/af67bb2ae553a4db1df7d41525b7cab1 to your computer and use it in GitHub Desktop.
Save hkarakose/af67bb2ae553a4db1df7d41525b7cab1 to your computer and use it in GitHub Desktop.
Log4j Configuration
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="FILE" class="org.apache.log4j.DailyRollingFileAppender">
<errorHandler class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/>
<param name="File" value="/var/log/tomcat7/chat.log"/>
<param name="Append" value="true"/>
<param name="Threshold" value="INFO"/>
<param name="DatePattern" value="'.'yyyy-MM-dd-a"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
</layout>
</appender>
<appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d %5p [%X{sessionId}] %c{1} - %m%n"/>
</layout>
</appender>
<root>
<!--<appender-ref ref="FILE"/>-->
<appender-ref ref="CONSOLE"/>
</root>
</log4j:configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment