druid会重复打印日志信息,怎么回事呢?

发布于 2021-12-02 08:05:36 字数 3514 浏览 726 评论 1

@wenshao 你好,想跟你请教个问题:

没有配置filters,只有proxyFilters

<property name="proxyFilters">
			<list>
				<ref bean="stat-filter"/>
				<ref bean="wall-filter"/>
				<ref bean="log-filter"/>
			</list>
		</property>

	<bean id="stat-filter" class="com.alibaba.druid.filter.stat.StatFilter">
		<property name="slowSqlMillis" value="3000" />
		<property name="logSlowSql" value="true" />
	</bean>	
	<bean id="wall-filter" class="com.alibaba.druid.wall.WallFilter">
		<property name="dbType" value="mysql" />
		<property name="logViolation" value="true"/>
		<property name="throwException" value="false"/>
	</bean>
	<bean id="log-filter" class="com.alibaba.druid.filter.logging.Log4jFilter">
		<property name="statementExecutableSqlLogEnable" value="false" />
		<property name="resultSetLogEnabled" value="false" />
	</bean>



log4j.properties:

log4j.logger.druid.sql=error,appendConsole
log4j.logger.druid.sql.DataSource=error,appendConsole
log4j.logger.druid.sql.Connection=error,appendConsole
log4j.logger.druid.sql.Statement=debug,appendConsole
log4j.logger.druid.sql.ResultSet=error,appendConsole




输出的日志信息:

2014-12-16 15:10:28,611 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000} created. select * from u_resource where enabled = 1>
2014-12-16 15:10:28,611 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000} created. select * from u_resource where enabled = 1>
2014-12-16 15:10:28,611 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000} created. select * from u_resource where enabled = 1>
2014-12-16 15:10:28,618 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000} Parameters : []>
2014-12-16 15:10:28,618 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000} Parameters : []>
2014-12-16 15:10:28,618 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000} Parameters : []>
2014-12-16 15:10:28,618 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000} Types : []>
2014-12-16 15:10:28,618 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000} Types : []>
2014-12-16 15:10:28,618 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000} Types : []>
2014-12-16 15:10:28,622 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000, rs-50000} query executed. 5.499854 millis. select * from u_resource where enabled = 1>
2014-12-16 15:10:28,622 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000, rs-50000} query executed. 5.499854 millis. select * from u_resource where enabled = 1>
2014-12-16 15:10:28,622 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000, rs-50000} query executed. 5.499854 millis. select * from u_resource where enabled = 1>
2014-12-16 15:10:28,630 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000} closed>
2014-12-16 15:10:28,630 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000} closed>
2014-12-16 15:10:28,630 DEBUG [druid.sql.Statement] - <{conn-10001, pstmt-20000} closed>

重复输出,不知道为什么


如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

三月梨花 2021-12-04 04:36:42
log4j.logger.druid.sql.Statement=debug,appendConsole

改为如下配置:

log4j.logger.druid.sql.Statement=debug
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文