At the moment I'm using the logger like this:
Code:
public static org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger("net.sf.hibernate");
logger.error("test");
This way I use the same logger as Hibernate.
My logs and the logs from Hibernate are mixed into 1 file.
Can I split this? So log files are created for the hibernate logs and different files are created for my logs.
My log4j.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="console" class="org.apache.log4j.ConsoleAppender">
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%5p - (%F:%L) - %m%n" />
</layout>
<filter class="org.apache.log4j.varia.LevelRangeFilter">
<param name="LevelMin" value="WARN" />
</filter>
</appender>
<appender name="fileAppender" class="org.apache.log4j.RollingFileAppender">
<param name="file" value="logs/log4j.log" />
<param name="MaxFileSize" value="5MB" />
<param name="MaxBackupIndex" value="10" />
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%5p - (%F:%L) - %m%n" />
</layout>
</appender>
<root>
<priority value="ALL" />
<appender-ref ref="console" />
<appender-ref ref="fileAppender" />
</root>
</log4j:configuration>