Skip to content

Instantly share code, notes, and snippets.

@martinlau
Created December 4, 2012 00:48
Show Gist options
  • Save martinlau/4199473 to your computer and use it in GitHub Desktop.
Save martinlau/4199473 to your computer and use it in GitHub Desktop.
portal-log4j-ext.xml configuration for logging hibernate statements
<?xml version="1.0"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<appender name="SQL_FILE" class="org.apache.log4j.rolling.RollingFileAppender">
<rollingPolicy class="org.apache.log4j.rolling.TimeBasedRollingPolicy">
<param name="FileNamePattern" value="@liferay.home@/logs/sql.%d{yyyy-MM-dd}.log" />
</rollingPolicy>
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}:%L] %m%n" />
</layout>
</appender>
<logger name="org.hibernate.SQL">
<level value="TRACE" />
<appender-ref ref="SQL_FILE" />
</logger>
<logger name="org.hibernate.type">
<level value="TRACE" />
<appender-ref ref="SQL_FILE" />
</logger>
</log4j:configuration>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment