0 Replies Latest reply on Feb 21, 2005 12:22 AM by grungy

    Log4j Hibernate debug messges

      Hi,

      I'm using Jboss 4.0.0 and hibernate 2.1.8 deployed as a har archive.
      I used to managed hibernate session myself i.e closing and opening them.
      but now i'm using HibernateContext to do that. For transactions i'm using CMT as i'm using ejbs


      Before using HibernateContext, each time something goes wrong when updating the database (constraints violation ...)
      or the hibernate mapping was not properly used, i get an exception with an explicit message about the error.
      Now that i'm using HibernateContext, this does not happen anymore and the only message that i get each time i commit the transaction is:

      [TransactionSynch] Error fushing session.

      This becomes very difficult to debug.

      I went through jboss and hibernate forum/docs to find a solution on how to configure the log4j.xml file to display hibernate
      debug messages, i couldn't find a solution though.

      I configured the threshold of the console appender to DEBUG,


      <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
       <errorHandler class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
       <param name="Target" value="System.out"/>
       <param name="Threshold" value="DEBUG"/>
       <layout class="org.apache.log4j.PatternLayout">
       <param name="ConversionPattern" value="%d %-5p [%c] %m%n"/>
       </layout>
       </appender>
      
       <root>
       <appender-ref ref="CONSOLE"/>
       </root>



      I added the following categories but still, nothing gets displayed.


      <category name="net.sf.hibernate">
       <priority value="DEBUG"/>
       </category>
      
      
       <category name="org.jboss.hibernate">
       <priority value="DEBUG"/>
       </category>
      
       <category name="org.jboss.resource">
       <priority value="DEBUG"/>
       </category>
      
       <category name="org.jboss">
       <priority value="DEBUG"/>
       </category>


      I even tried to use the TRACE level for my categories, no luck though

      Is there a way to around this problem ? i really tried for days everything i could do.

      btw is there a way to for hibernate log.properties file ???


      thx in advance