简体   繁体   English

Jooq无法记录SQL查询

[英]Jooq not able to log SQL queries

I am using Jooq along with JAX-RS to create a REST API. 我将Jooq和JAX-RS一起使用来创建REST API。 I have the following dependencies in my maven pom file log4j 1.2.7 and jooq 3.9.4 I have put the log4j.properties file in resources folder. 我的maven pom文件log4j 1.2.7jooq 3.9.4具有以下依赖项,我已将log4j.properties文件放入resources文件夹中。 Here are the contents of the file: 这是文件的内容:

log4j.rootLogger=DEBUG, stdout, file
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

log4j.appender.file=org.apache.log4j.RollingFileAppender
log4j.appender.file.File=/home/ps06756/log4j-application.log
log4j.appender.file.MaxFileSize=5MB
log4j.appender.file.MaxBackupIndex=10
log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n

Still, Jooq is not logging the SQL statemennts being executed. 尽管如此,Jooq仍未记录正在执行的SQL状态菜单。 How should I correct this problem. 我应该如何纠正这个问题。

Please check if you have logback or slf4j on your classpath as that is the first logger the JooqLogger tries to find on the classpath. 请检查您的类路径上是否有logbackslf4j ,因为这是JooqLogger尝试在类路径上找到的第一个记录器。 If it fails it tries log4j and after that it falls to java.util.logger . 如果失败,则尝试log4j ,然后落入java.util.logger

When it does find logback or slf4j but you don't have any configuration you will not see anything being logged. 当它确实找到logbackslf4j但您没有任何配置时,您将看不到任何记录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM