title: redirecting Hibernate Error out of my SystemOut.log file
body: <p>I have a little issue with my hibernate logging configuration. 
      In our application, we have two threads trying to put, concurrently, a lock on each row of Database table.
      sometimes, one of those threads tries to lock a row that's already locked. This error is thrown :</p>
  
  <pre><code>[2/24/12 15:00:34:492 CET] 0000003a JDBCException W org.hibernate.util.JDBCExceptionReporter logExceptions SQL Error: 54, SQLState: 61000
  [2/24/12 15:00:34:496 CET] 0000003a JDBCException E org.hibernate.util.JDBCExceptionReporter logExceptions ORA-00054: resource busy and acquire with NOWAIT specified
  </code></pre>
  
  <p>these lines are put in the SystemOut.log files. I'm trying to put them in another file. So in my Log4j configuration file, I created a new appender like this :</p>
  
  <pre><code>&lt;appender name="JDBCExceptionReporter" class="org.apache.log4j.RollingFileAppender"&gt;
      &lt;param name="Encoding" value="UTF-8"/&gt;
      &lt;param name="File" value="JDBCExceptionReporter.log"/&gt;
      &lt;param name="MaxFileSize" value="50000KB"/&gt;
      &lt;param name="MaxBackupIndex" value="5"/&gt;
      &lt;param name="BufferedIO" value="false"/&gt;
      &lt;param name="ImmediateFlush" value="true"/&gt;
      &lt;param name="Append" value="true"/&gt;
      &lt;layout class="org.apache.log4j.PatternLayout"&gt;
          &lt;param name="ConversionPattern" value="%d, %-5p, %X{ORG_NAME}, %X{USER_NAME}, %c - %m%n"/&gt;
          &lt;!-- Use pattern below if it is required to view the log files   --&gt;
          &lt;!-- using LogFactor5--&gt;
          &lt;!--&lt;param name="ConversionPattern" value="[slf5s.start] %d[slf5s.DATE]
              %-5p[slf5s.PRIORITY] %X{ORG_NAME} %X{USER_NAME}
              [slf5s.NDC] %c[slf5s.CATEGORY] - %m[slf5s.MESSAGE] %n"--&gt;
      &lt;/layout&gt;
  &lt;/appender&gt;
  </code></pre>
  
  <p>Finally, I added those loggers just before the root element :</p>
  
  <pre><code>&lt;logger name="org.hibernate" additivity="false"&gt;
      &lt;level value="ALL"/&gt;
      &lt;appender-ref ref="JDBCExceptionReporter"/&gt;
  &lt;/logger&gt;
  &lt;logger name="org.hibernate.type" additivity="false"&gt;
      &lt;level value="ALL"/&gt;
      &lt;appender-ref ref="JDBCExceptionReporter"/&gt;
  &lt;/logger&gt;
  &lt;logger name="org.hibernate.tool.hbm2ddl" additivity="false"&gt;
      &lt;level value="ALL"/&gt;
      &lt;appender-ref ref="JDBCExceptionReporter"/&gt;
  &lt;/logger&gt;
  &lt;logger name="org.hibernate.pretty" additivity="false"&gt;
      &lt;level value="ALL"/&gt;
      &lt;appender-ref ref="JDBCExceptionReporter"/&gt;
  &lt;/logger&gt;
  &lt;logger name="org.hibernate.cache" additivity="false"&gt;
      &lt;level value="ALL"/&gt;
      &lt;appender-ref ref="JDBCExceptionReporter"/&gt;
  &lt;/logger&gt;
  &lt;logger name="org.hibernate.transaction" additivity="false"&gt;
      &lt;level value="ALL"/&gt;
      &lt;appender-ref ref="JDBCExceptionReporter"/&gt;
  &lt;/logger&gt;
  &lt;logger name="org.hibernate.jdbc" additivity="false"&gt;
      &lt;level value="ALL"/&gt;
      &lt;appender-ref ref="JDBCExceptionReporter"/&gt;
  &lt;/logger&gt;
  &lt;logger name="org.hibernate.hql.ast.AST" additivity="false"&gt;
      &lt;level value="ALL"/&gt;
      &lt;appender-ref ref="JDBCExceptionReporter"/&gt;
  &lt;/logger&gt;
  &lt;logger name="org.hibernate.secure" additivity="false"&gt;
      &lt;level value="ALL"/&gt;
      &lt;appender-ref ref="JDBCExceptionReporter"/&gt;
  &lt;/logger&gt;
  &lt;logger name="org.hibernate.SQL" additivity="false"&gt;
      &lt;level value="ALL"/&gt;
      &lt;appender-ref ref="JDBCExceptionReporter"/&gt;
  &lt;/logger&gt;
  </code></pre>
  
  <p>This configuration didn't work and the two lines are always logged in the SystemOut.log and not in my JDBCExceptionReporter.log.
  does anyone have the answer to my problem ?
  thank you for your help.</p>