Java tomcat - 如何删除 JDBC 调试日志 [英] Java tomcat - how to remove JDBC debug logs

查看:45
本文介绍了Java tomcat - 如何删除 JDBC 调试日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

控制台不断抛出以下日志:

The following log is constantly thrown to the console:

09:36:53.456 [CloseConnectionsTimer] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource

09:36:53.456 [CloseConnectionsTimer] DEBUG o.s.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 1, parameter value [0], value class [java.lang.Long], SQL type -5

09:36:53.456 [CloseConnectionsTimer] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource

09:36:53.472 [CloseConnectionsTimer] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL query

09:36:53.472 [CloseConnectionsTimer] DEBUG o.s.jdbc.core.JdbcTemplate - Executing prepared SQL statement..

09:36:53.472 [CloseConnectionsTimer] DEBUG o.s.jdbc.datasource.DataSourceUtils - Fetching JDBC Connection from DataSource

09:36:53.472 [CloseConnectionsTimer] DEBUG o.s.jdbc.core.StatementCreatorUtils - Setting SQL statement parameter value: column index 1, parameter value [0], value class [java.lang.Integer], SQL type 2

09:36:53.472 [CloseConnectionsTimer] DEBUG o.s.jdbc.datasource.DataSourceUtils - Returning JDBC Connection to DataSource

如何停止这些日志/将日志记录级别更改为 INFO 或 ERROR?

How can i stop these logs/Change the logging level to INFO or ERROR?

推荐答案

您使用的是 Logback 还是 Log4J?您的应用程序中有任何配置文件吗?尝试将其放在 src/main/resources/logback.xml 中:

Are you using Logback or Log4J? Do you have any configuration file in your application? Try placing this in src/main/resources/logback.xml:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>

    <logger name="org.springframework.jdbc" level="INFO" />

    <root level="ALL">
        <appender class="ch.qos.logback.core.ConsoleAppender">
            <encoder>
                <Pattern>%d{HH:mm:ss:SSS} | %-5level | %thread | %logger{20} | %msg%n</Pattern>
            </encoder>
        </appender>
    </root>
</configuration>

如果您已经在应用程序中找到 logback.xml 文件,只需添加 <logger... 行.

If you already found logback.xml file in your application, just add the <logger... line.

但是,如果您在上面的目录中找到 log4j.xml,请改为添加以下行:

However if you found log4j.xml in the directory above, add this lines to it instead:

<logger name="org.springframework.jdbc">
    <level value="INFO"/> 
</logger>

这篇关于Java tomcat - 如何删除 JDBC 调试日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆