title: How to show SQL parameters in Hibernate log?
body: <p>In my hibernate.cfg.xml, I have the following:</p>
  
  <pre><code>&lt;property name="show_sql"&gt;true&lt;/property&gt;
  </code></pre>
  
  <p>In my log4j.xml, I have the following:</p>
  
  <pre><code>&lt;logger name="org.hibernate" additivity="false"&gt;
      &lt;level value="TRACE"/&gt;
      &lt;appender-ref ref="hbn_log"/&gt;
  &lt;/logger&gt;
  
  &lt;category name="org.hibernate.SQL" additivity="false"&gt;
      &lt;priority value="TRACE"/&gt;
      &lt;appender-ref ref="hbn_log"/&gt;
  &lt;/category&gt;
  
  &lt;category name="org.hibernate.type" additivity="false"&gt;
      &lt;priority value="TRACE"/&gt;
      &lt;appender-ref ref="hbn_log"/&gt;
  &lt;/category&gt;
  
  &lt;logger name="org.hibernate.type.descriptor.sql.BasicBinder"&gt; 
      &lt;level value="TRACE"/&gt;
      &lt;appender-ref ref="hbn_log"/&gt;
  &lt;/logger&gt;
  
  &lt;logger name="org.hibernate.event.def.DefaultLoadEventListener" additivity="true"&gt;
      &lt;level value="all"/&gt;
      &lt;appender-ref ref="hbn_log"/&gt;
  &lt;/logger&gt;
  
  &lt;logger name="org.hibernate.cache.ReadWriteCache" additivity="true"&gt;
     &lt;level value="all"/&gt;
     &lt;appender-ref ref="hbn_log"/&gt;
  &lt;/logger&gt;
  
  &lt;appender name="hbn_log" class="com.adventnet.management.log.NMSRollingFileAppender"&gt;
     &lt;param name="File" value="logs/hbn.txt"/&gt;
         &lt;param name="MaxFileSize" value="1MB"/&gt;
         &lt;param name="MaxBackupIndex" value="10"/&gt;
     &lt;layout class="org.apache.log4j.PatternLayout"&gt;
                   &lt;param name="ConversionPattern" value="[%d{dd MMM yyyy HH:mm:ss:SSS}] %-5c{2}: %m%n"/&gt;
     &lt;/layout&gt;
     &lt;param name="Threshold" value="TRACE"/&gt;
  &lt;/appender&gt;
  </code></pre>
  
  <p>In my stdout.txt, I can see that it logs the SQL statement:</p>
  
  <pre><code>[13 Apr 2013 22:03:59:199] SYS_OUT: Hibernate: select this_.EMSID as EMSID195_0_, this_.COUNTER as COUNTER195_0_, this_.TIMESTAMP as TIMESTAMP195_0_, this_.UPDATETYPE as UPDATETYPE195_0_, this_.OBJECTTYPE as OBJECTTYPE195_0_, this_.OBJECTID as OBJECTID195_0_, this_.OBJECT as OBJECT195_0_ from WebNmsDB.UpdateData this_ where this_.EMSID=?
  </code></pre>
  
  <p>But I want it to also log the parameter for the SQL, and it's not showing it.</p>
  
  <p>Another thing is that the appender is defined to log to hbn.txt, but the SQL statement gets logged to stdout.txt and not hbn.txt.  I don't know why that's happening.</p>