spring - log4j configuration in Hibernate -
i want show sql queries executed ihbernate in logs.
this current log4j configuration:
<?xml version="1.0" encoding="utf-8" ?> <!doctype log4j:configuration system "log4j.dtd"> <log4j:configuration xmlns:log4j='http://jakarta.apache.org/log4j/'> <appender name="ca" class="org.apache.log4j.consoleappender"> <layout class="org.apache.log4j.patternlayout"> <param name="conversionpattern" value="%d{dd-mm-yyyy hh:mm:ss,sss} [%t] %-5p %c %x - %m%n" /> </layout> </appender> <root> <level value="info" /> <appender-ref ref="ca" /> </root> <logger name="org.hibernate.sql" additivity="false"> <level value="debug" /> <appender-ref ref="ca" /> </logger> <logger name="org.hibernate.hql" additivity="false"> <level value="debug" /> <appender-ref ref="ca" /> </logger> <logger name="org.hibernate.stat" additivity="false"> <level value="trace" /> <appender-ref ref="ca" /> </logger> </log4j:configuration>
but still getting nulls org.hibernate.stat.internal.concurrentstatisticsimpl
:
08-11-2016 09:54:39,318 [http-bio-8080-exec-8] debug org.hibernate.stat.internal.concurrentstatisticsimpl - hhh000117: hql: null, time: 1ms, rows: 4
how can log full sql instead of hql: null
?
to log executed queries added following logj4-configuration:
<!-- log hibernate sql statements without parameters --> <logger name="org.hibernate.sql" additivity="false"> <level value="debug" /> <appender-ref ref="console" /> </logger> <!-- add logging of parameters of sql statements --> <logger name="org.hibernate.type.descriptor.sql" additivity="false"> <level value="trace" /> <appender-ref ref="console" /> </logger>
Comments
Post a Comment