Hibernate and log4j
gleenders Jan 9, 2009 10:32 AMI'm currently struggling a little bit with the combination of hibernate and logging in the jbp-jpd-3.2.3 suite. I'm not really familiar with log4j and all I want to do is to log the DML statements (but also nothing more or less then that).
I haven't touched the logging setting in hibernate.cfg.xml because I'm pretty sure they are just fine , but I include them just for completeness.
<!-- logging properties (begin) === <property name="hibernate.show_sql">true</property> <property name="hibernate.format_sql">true</property> <property name="hibernate.use_sql_comments">true</property> ==== logging properties (end) -->
To adapt log4j I've copied the log4j.xml file from the folder: jbpm-jpdl-3.2.3\deploy to jbpm-jpdl-3.2.3\server\server\jbpm\conf and renamed it to jboss-log4j.xml.
I also changed the file a little bit according to my requirements, But the logger still shows me the wrong information --> the transaction info is still shown and on the other hand it misses the binding parameters information.
Can some help me to configure log4j? Thanks.
jboss-log4j.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false"> <!-- Usage: replace the log4j.xml file in the conf directory of your jboss server configuration with this file Contents: This configuration file will log only to standard output and it will put the jBPM logs to level TRACE. --> <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="TRACE"/> <layout class="org.apache.log4j.PatternLayout"> <!-- The default pattern: Date Priority [Category] Message\n --> <param name="ConversionPattern" value="%d{ABSOLUTE} %-5p [%c{1}] %m%n"/> </layout> </appender> <!-- <category name="org.jbpm"><priority value="INFO"/></category> --> <category name="org.apache"><priority value="INFO"/></category> <category name="org.apache.myfaces"><priority value="TRACE"/></category> <category name="org.jboss"><priority value="INFO"/></category> <category name="org.hibernate"><priority value="INFO"/></category> <category name="org.hibernate.SQL"><priority value="DEBUG"/></category> <category name="org.hibernate.transaction"><priority value="INFO"/></category> <category name="org.hibernate.type"><priority value="DEBUG"/></category> <category name="net.sf"><priority value="INFO"/></category> <root> <appender-ref ref="CONSOLE"/> </root> </log4j:configuration>
Log snapshot:
.JDBCTransaction@1dd040a 16:14:10,801 DEBUG [DbPersistenceService] closing hibernate session 16:14:10,801 DEBUG [Services] closing service 'tx': org.jbpm.tx.TxService@f60f20 16:14:10,801 DEBUG [JobExecutorThread] obtained lock on jobs: [] 16:14:10,801 DEBUG [JbpmContextInfo] creating jbpm context with service factories '[message, tx, sc eduler, authentication, persistence, logging]' 16:14:10,801 DEBUG [JbpmContext] creating org.jbpm.JbpmContext@5b38d6 16:14:10,817 DEBUG [DbPersistenceServiceFactory] creating persistence service 16:14:10,817 DEBUG [DbPersistenceService] creating hibernate session 16:14:10,817 DEBUG [DbPersistenceService] beginning hibernate transaction 16:14:10,817 DEBUG [DbPersistenceService] begun hibernate transaction org.hibernate.transaction.JDB Transaction@179d47f 16:14:10,817 DEBUG [SQL] select * from ( select job0_.ID_ as ID1_26_, job0_.VERSION_ as VERSION3_26 , job0_.DUEDATE_ as DUEDATE4_26_, job0_.PROCESSINSTANCE_ as PROCESSI5_26_, job0_.TOKEN_ as TOKEN6_2 _, job0_.TASKINSTANCE_ as TASKINST7_26_, job0_.ISSUSPENDED_ as ISSUSPEN8_26_, job0_.ISEXCLUSIVE_ as ISEXCLUS9_26_, job0_.LOCKOWNER_ as LOCKOWNER10_26_, job0_.LOCKTIME_ as LOCKTIME11_26_, job0_.EXCEPT ON_ as EXCEPTION12_26_, job0_.RETRIES_ as RETRIES13_26_, job0_.NAME_ as NAME14_26_, job0_.REPEAT_ a REPEAT15_26_, job0_.TRANSITIONNAME_ as TRANSIT16_26_, job0_.ACTION_ as ACTION17_26_, job0_.GRAPHEL MENTTYPE_ as GRAPHEL18_26_, job0_.GRAPHELEMENT_ as GRAPHEL19_26_, job0_.NODE_ as NODE20_26_, job0_. LASS_ as CLASS2_26_ from JBPM_JOB job0_ where (job0_.LOCKOWNER_ is null or job0_.LOCKOWNER_=?) and ob0_.RETRIES_>0 and job0_.ISSUSPENDED_<>1 order by job0_.DUEDATE_ asc ) where rownum <= ? 16:14:10,817 DEBUG [JbpmContext] closing jbpmContext org.jbpm.JbpmContext@5b38d6 16:14:10,817 DEBUG [Services] closing service 'persistence': org.jbpm.persistence.db.DbPersistenceS rvice@56291a 16:14:10,817 DEBUG [DbPersistenceService] committing hibernate transaction org.hibernate.transactio .JDBCTransaction@179d47f 16:14:10,817 DEBUG [DbPersistenceService] closing hibernate session 16:14:10,817 DEBUG [Services] closing service 'tx': org.jbpm.tx.TxService@a4911d