【问题标题】:Spring JOOQ - Remove Fetched result from consoleSpring JOOQ - 从控制台中删除获取的结果
【发布时间】:2020-04-15 06:01:27
【问题描述】:

我已经浏览了链接:JOOQ with Logback,但我正在从日志中查看获取的结果。我只想保留

  1. 正在执行查询

  2. 移除 JOOQ 标志,只显示版本。

错误:

2019-12-24 10:11:13.500  INFO 8944 --- [nio-8080-exec-1] org.jooq.Constants                       : 

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@  @@        @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@        @@@@@@@@@@
@@@@@@@@@@@@@@@@  @@  @@    @@@@@@@@@@
@@@@@@@@@@  @@@@  @@  @@    @@@@@@@@@@
@@@@@@@@@@        @@        @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@        @@        @@@@@@@@@@
@@@@@@@@@@    @@  @@  @@@@  @@@@@@@@@@
@@@@@@@@@@    @@  @@  @@@@  @@@@@@@@@@
@@@@@@@@@@        @@  @  @  @@@@@@@@@@
@@@@@@@@@@        @@        @@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@  @@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@  Thank you for using jOOQ 3.12.3

2019-12-24 10:11:13.539 DEBUG 8944 --- [nio-8080-exec-1] org.jooq.tools.LoggerListener            : Executing query          : select `test`.`posts`.`ID`, `test`.`posts`.`TITLE`, `test`.`posts`.`CONTENT`, `test`.`posts`.`CREATED_ON` from `test`.`posts`
2019-12-24 10:11:13.605 DEBUG 8944 --- [nio-8080-exec-1] org.jooq.tools.LoggerListener            : Fetched result           : +----+------+--------------+---------------------+
2019-12-24 10:11:13.606 DEBUG 8944 --- [nio-8080-exec-1] org.jooq.tools.LoggerListener            :                          : |  ID|TITLE |CONTENT       |CREATED_ON           |
2019-12-24 10:11:13.606 DEBUG 8944 --- [nio-8080-exec-1] org.jooq.tools.LoggerListener            :                          : +----+------+--------------+---------------------+
2019-12-24 10:11:13.606 DEBUG 8944 --- [nio-8080-exec-1] org.jooq.tools.LoggerListener            :                          : |   1|Post 1|This is post 1|2020-01-03 00:00:00.0|
2019-12-24 10:11:13.606 DEBUG 8944 --- [nio-8080-exec-1] org.jooq.tools.LoggerListener            :                          : |   2|Post 2|This is post 2|2020-01-05 00:00:00.0|
2019-12-24 10:11:13.606 DEBUG 8944 --- [nio-8080-exec-1] org.jooq.tools.LoggerListener            :                          : |   3|Post 3|This is post 3|2020-01-07 00:00:00.0|
2019-12-24 10:11:13.606 DEBUG 8944 --- [nio-8080-exec-1] org.jooq.tools.LoggerListener            :                          : +----+------+--------------+---------------------+
2019-12-24 10:11:13.606 DEBUG 8944 --- [nio-8080-exec-1] org.jooq.tools.LoggerListener            : Fetched row(s)           : 3
2019-12-24 10:11:13.624 DEBUG 8944 --- [nio-8080-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Using 'application/json', given [*/*] and supported [application/json, application/*+json, application/json, application/*+json]
2019-12-24 10:11:13.624 DEBUG 8944 --- [nio-8080-exec-1] o.s.w.s.m.m.a.HttpEntityMethodProcessor  : Writing [[Post [id=1, title=Post 1, content=This is post 1, createdOn=2020-01-03 00:00:00.0], Post [id=2, tit (truncated)...]
2019-12-24 10:11:13.657 DEBUG 8944 --- [nio-8080-exec-1] o.s.web.servlet.DispatcherServlet        : Completed 200 OK

application.properties 供参考

spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/test
spring.datasource.username=root
spring.datasource.password=root

spring.jooq.sql-dialect=MYSQL

#spring.datasource.initialization-mode=always
spring.datasource.continueOnError=true

logging.level.org.springframework.web=DEBUG
logging.level.org.jooq.*=DEBUG

【问题讨论】:

    标签: spring spring-boot jooq


    【解决方案1】:

    关闭徽标记录

    从您的日志中删除徽标的答案已给出here。有几种方法。一种是使用这个系统属性:

    -Dorg.jooq.no-logo=true
    

    this answer by flamezealot 中给出了 Logback 的另一个选项:

    <logger name="org.jooq.Constants" level="warn">
            <appender-ref ref="STDOUT" />
    </logger>
    

    关闭结果记录

    执行日志记录在here。您可以使用关闭它

    Settings settings = new Settings()
        .withExecuteLogging(false);
    

    将这些设置传递给您的Configuration。对于后者,你也可以为 jOOQ 关闭 DEBUG 日志记录:

    logging.level.org.jooq.*=INFO
    

    【讨论】:

      猜你喜欢
      • 2020-08-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-14
      相关资源
      最近更新 更多