Im using the JOOQ library to generate and perform SQL queries. For debugging reasons I want to see what queries exactly are performed without looking at the changing database every time. I think the jooq framework should show lots of informations about queries and their effects if the log level is set to debug. I use log4j2 for logging, and it is set to debug using the following configuration:
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="DEBUG" packages="ch.fhnw.ima.doggait">
<appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
</Console>
</appenders>
<loggers>
<root level="DEBUG">
<appender-ref ref="Console"/>
</root>
</loggers>
</configuration>
Unfortunally It looks like JOOQ uses another logger, which is set to info. This is an example output:
2015-09-29 10:15:04,064 DEBUG Shutdown.. 2015-09-29 10:15:04,065 DEBUG LoggerCo.. 2015-09-29 10:15:04,111 DEBUG Using d... 10:15:04.116 [Test worker] DEBUG ch.fh.. Sep 29, 2015 10:15:04 AM org.jooq.tools.JooqLogger info INFORMATION: @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@....
You can see the first few lines are logged in debug mode by log4j2, but Jooq uses JooqLogger in level info. I load both libraries using gradle:
compile group: 'com.google.inject', name: 'guice-parent', version: '3.0'
compile group: 'com.google.inject.extensions', name: 'guice-persist', version: '3.0'
compile group: 'org.hibernate', name: 'hibernate-entitymanager', version: '4.3.8.Final'
compile group: 'com.h2database', name: 'h2', version: '1.4.185'
compile group: 'org.apache.commons', name: 'commons-math3', version: '3.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.0.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.0.2'
compile group: 'org.hamcrest', name: 'hamcrest-all', version: '1.3'
compile group: 'org.apache.pdfbox', name: 'pdfbox', version: '1.8.10'
compile group: 'postgresql', name:'postgresql', version:'9.0-801.jdbc4'
compile group: 'org.jooq', name:'jooq', version:'3.6.3'
compile group: 'org.jooq', name:'jooq-meta', version:'3.6.3'
compile group: 'org.jooq', name:'jooq-codegen', version:'3.6.3'
testCompile 'junit:junit:4.11'
Does somebody know why jooq does not use log4j2 as the default logger, or how I can set it to log in debug level?