gpt4 book ai didi

Java tomcat - 如何删除 JDBC 调试日志

转载 作者:行者123 更新时间:2023-11-28 22:22:53 31 4
gpt4 key购买 nike

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

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?

最佳答案

您使用的是 Logback 还是 Log4J?您的应用程序中是否有任何配置文件?尝试将其放在 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...行。

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

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

关于Java tomcat - 如何删除 JDBC 调试日志,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7157199/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com