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

jack_jones 发布于 2014/12/16 15:11
阅读 2K+
收藏 0

云原生2.0展望丨从“小众”到“首选”,推动云原生产业落地华为云作用几何?>>>

@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>

重复输出,不知道为什么


加载中
0
x
xhal
log4j.logger.druid.sql.Statement=debug,appendConsole

改为如下配置:

log4j.logger.druid.sql.Statement=debug
返回顶部
顶部