gpt4 book ai didi

spring - 使用 log4j 显示 jdbc 事务事件

转载 作者:行者123 更新时间:2023-12-05 01:08:39 25 4
gpt4 key购买 nike

我想查看Spring中的事务事件,例如:

TransactionInterceptor] - Getting transaction for x.y.service.FooService.insertFoo
<!-- the transactional advice kicks in here... -->
[DataSourceTransactionManager] - Creating new transaction with name [x.y.service.FooService.insertFoo]
[DataSourceTransactionManager] - Acquired Connection
[org.apache.commons.dbcp.PoolableConnection@a53de4] for JDBC transaction

<!-- the insertFoo(..) method from DefaultFooService throws an exception... -->
[RuleBasedTransactionAttribute] - Applying rules to determine whether transaction should
rollback on java.lang.UnsupportedOperationException
[TransactionInterceptor] - Invoking rollback for transaction on x.y.service.FooService.insertFoo
due to throwable [java.lang.UnsupportedOperationException]

而我配置的log4j.properties如下:
log4j.rootCategory=INFO, stdout

log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %t %c{2}:%L - %m%n

log4j.logger.org.springframework.transactions=DEBUG

但是它不会产生上述输出。为了显示交易事件,我缺少哪个属性?

最佳答案


 log4j.logger.org.springframework.jdbc.datasource.DataSourceTransactionManager=DEBUG  

引用
Transaction log4j

关于spring - 使用 log4j 显示 jdbc 事务事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16838316/

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