I am trying to run log4jdbc on my Hibernate/MySQL to return sql with execution time with following settings:
Database connection:
hibernate.dialect=org.hydra.webapp.util.MySQL5MyISAMDialect
hibernate.connection.driver_class=net.sf.log4jdbc.DriverSpy
hibernate.connection.url=jdbc\:log4jdbc\:mysql\://localhost/DBDBDB?useUnicode\=true&characterEncoding\=utf-8
hibernate.connection.username=DBDBDB
hibernate.connection.password=DBDBDB
hibernate.connection.show_sql=true
hibernate.use_sql_comments=true
hibernate.generate_statistics=true
hibernate.connection.pool_size=10
dao.type=hibernate
log4j.properties:
log4j.appender.LOG4JDBC.Append=true
log4j.appender.LOG4JDBC.layout=org.apache.log4j.PatternLayout
log4j.appender.LOG4JDBC.layout.ConversionPattern=[LOG4JDBC]: [%d{yyyy-MM-dd HH:mm:ss}] | %m |%n
log4j.appender.LOG4JDBC.datePattern='.'yyyy-MM-dd
log4j.appender.LOG4JDBC.append=true
log4j.appender.LOG4JDBC.Encoding=UTF-8
log4j.appender.LOG4JDBC.File=/PATH/log4jdbc.log
log4j.logger.jdbc.sqlonly=INFO, LOG4JDBC
log4j.logger.jdbc.sqltiming=FATAL
log4j.logger.jdbc.audit=FATAL
log4j.logger.jdbc.resultset=FATAL
log4j.logger.jdbc.connection=FATAL
log4jdbc.properties
log4jdbc.drivers=com.mysql.jdbc.Driver
log4jdbc.sqltiming.warn.threshold=200
log4jdbc.sqltiming.error.threshold=1000
log4jdbc.suppress.generated.keys.exception=true
log4jdbc.trim.sql.extrablanklines=false
However, I cannot get the sql being printed out normally.
In my console, it is full of something like following:
Dec 16, 2013 12:28:36 PM net.sf.log4jdbc.Slf4jSpyLogDelegator methodReturned
INFO: 4. ResultSet.wasNull() returned false
Dec 16, 2013 12:28:36 PM net.sf.log4jdbc.Slf4jSpyLogDelegator methodReturned
INFO: 3. Connection.setAutoCommit(true) returned
Dec 16, 2013 12:28:36 PM net.sf.log4jdbc.Slf4jSpyLogDelegator methodReturned
INFO: 6. ResultSet.getString(measurem4_83_) returned UNDEFINED
and in the generated file, there is tons of:
Cannot create JDBC driver of class 'net.sf.log4jdbc.DriverSpy' for connect URL 'jdbc:log4jdbc:mysql://localhost/DBDBDB?useUnicode=true&characterEncoding=utf-8' |
I have tried for days and still have no success, please help and thanks a lot!!