在我的项目上运行Junt测试每个代码行执行两次,如下面的堆栈跟踪:
TransactionAspectSupport - Getting transaction for [it.stasbranger.spidly.service.PostsServiceImpl.findPostsByPrimaryKey]
22 apr 2013 21:10:39 TRACE [main] TransactionAspectSupport - Getting transaction for [it.stasbranger.spidly.service.PostsServiceImpl.findPostsByPrimaryKey]
22 apr 2013 21:10:39 DEBUG [main] AbstractPlatformTransactionManager - Participating in existing transaction
22 apr 2013 21:10:39 DEBUG [main] AbstractPlatformTransactionManager - Participating in existing transaction
22 apr 2013 21:10:39 TRACE [main] TransactionAspectSupport - Getting transaction for [it.stasbranger.spidly.dao.PostsDAOImpl.findPostsByPrimaryKey]
22 apr 2013 21:10:39 TRACE [main] TransactionAspectSupport - Getting transaction for [it.stasbranger.spidly.dao.PostsDAOImpl.findPostsByPrimaryKey]
22 apr 2013 21:10:39 TRACE [main] TransactionSynchronizationManager - Retrieved value [org.springframework.orm.jpa.EntityManagerHolder@1a6c891] for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@b9b8d9] bound to thread [main]
22 apr 2013 21:10:39 TRACE [main] TransactionSynchronizationManager - Retrieved value [org.springframework.orm.jpa.EntityManagerHolder@1a6c891] for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@b9b8d9] bound to thread [main]
22 apr 2013 21:10:39 TRACE [main] TransactionSynchronizationManager - Retrieved value [org.springframework.orm.jpa.EntityManagerHolder@1a6c891] for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@b9b8d9] bound to thread [main]
22 apr 2013 21:10:39 TRACE [main] TransactionSynchronizationManager - Retrieved value [org.springframework.orm.jpa.EntityManagerHolder@1a6c891] for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@b9b8d9] bound to thread [main]
22 apr 2013 21:10:39 TRACE [main] TransactionAspectSupport - Completing transaction for [it.stasbranger.spidly.dao.PostsDAOImpl.findPostsByPrimaryKey]
22 apr 2013 21:10:39 TRACE [main] TransactionAspectSupport - Completing transaction for [it.stasbranger.spidly.dao.PostsDAOImpl.findPostsByPrimaryKey]
22 apr 2013 21:10:39 TRACE [main] TransactionAspectSupport - Completing transaction for [it.stasbranger.spidly.service.PostsServiceImpl.findPostsByPrimaryKey]
22 apr 2013 21:10:39 TRACE [main] TransactionAspectSupport - Completing transaction for [it.stasbranger.spidly.service.PostsServiceImpl.findPostsByPrimaryKey]
22 apr 2013 21:11:31 TRACE [main] TransactionAspectSupport - Completing transaction for [it.stasbranger.spidly.social.FacebookServiceImpl.storePostsFromPages]
22 apr 2013 21:11:31 TRACE [main] TransactionAspectSupport - Completing transaction for [it.stasbranger.spidly.social.FacebookServiceImpl.storePostsFromPages]
22 apr 2013 21:11:31 DEBUG [main] AbstractPlatformTransactionManager - Participating in existing transaction
22 apr 2013 21:11:31 DEBUG [main] AbstractPlatformTransactionManager - Participating in existing transaction
22 apr 2013 21:11:31 TRACE [main] TransactionAspectSupport - Getting transaction for [it.stasbranger.spidly.social.FacebookServiceImpl.storePostsFromPages]
22 apr 2013 21:11:31 TRACE [main] TransactionAspectSupport - Getting transaction for [it.stasbranger.spidly.social.FacebookServiceImpl.storePostsFromPages]
22 apr 2013 21:11:31 DEBUG [main] AbstractPlatformTransactionManager - Participating in existing transaction
22 apr 2013 21:11:31 DEBUG [main] AbstractPlatformTransactionManager - Participating in existing transaction
22 apr 2013 21:11:31 TRACE [main] TransactionAspectSupport - Getting transaction for [it.stasbranger.spidly.service.TagServiceImpl.findTagsByUserprofileId]
22 apr 2013 21:11:31 TRACE [main] TransactionAspectSupport - Getting transaction for [it.stasbranger.spidly.service.TagServiceImpl.findTagsByUserprofileId]
22 apr 2013 21:11:31 DEBUG [main] AbstractPlatformTransactionManager - Participating in existing transaction
22 apr 2013 21:11:31 DEBUG [main] AbstractPlatformTransactionManager - Participating in existing transaction
22 apr 2013 21:11:31 TRACE [main] TransactionAspectSupport - Getting transaction for [it.stasbranger.spidly.dao.TagDAOImpl.findTagByUserProfileId]
22 apr 2013 21:11:31 TRACE [main] TransactionAspectSupport - Getting transaction for [it.stasbranger.spidly.dao.TagDAOImpl.findTagByUserProfileId]
22 apr 2013 21:11:31 TRACE [main] TransactionSynchronizationManager - Retrieved value [org.springframework.orm.jpa.EntityManagerHolder@1a6c891] for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@b9b8d9] bound to thread [main]
22 apr 2013 21:11:31 TRACE [main] TransactionSynchronizationManager - Retrieved value [org.springframework.orm.jpa.EntityManagerHolder@1a6c891] for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@b9b8d9] bound to thread [main]
22 apr 2013 21:11:31 TRACE [main] TransactionSynchronizationManager - Retrieved value [org.springframework.orm.jpa.EntityManagerHolder@1a6c891] for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@b9b8d9] bound to thread [main]
22 apr 2013 21:11:31 TRACE [main] TransactionSynchronizationManager - Retrieved value [org.springframework.orm.jpa.EntityManagerHolder@1a6c891] for key [org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean@b9b8d9] bound to thread [main]
在Tomcat server.xml中,禁用了autodeploy。 建议?
提前致谢!
# STDOUT appender
log4j.appender.STDOUT=org.apache.log4j.ConsoleAppender
log4j.appender.STDOUT.layout=org.apache.log4j.PatternLayout
log4j.appender.STDOUT.layout.ConversionPattern=%d{dd MMM yyyy HH\:mm\:ss} %p [%t] %C{1} - %m\n
# use the STDOUT appender. set the level to ERROR.
log4j.rootLogger=STDOUT
log4j.category.atomikos=WARN, STDOUT
log4j.category.org.springframework=WARN, STDOUT
#log4j.category.org.springframework.transaction=ERROR, STDOUT
# use this category for skyway / spring util output
log4j.category.org.skyway.spring.util=WARN, STDOUT
# Direct log messages to a log file
log4j.logger.social=INFO, social
log4j.appender.social=org.apache.log4j.RollingFileAppender
log4j.appender.social.File=/home/###############
log4j.appender.social.File=spidly.log
log4j.appender.social.layout=org.apache.log4j.PatternLayout
log4j.appender.social.layout.ConversionPattern=%d %p [%t] %C{1} - %m\n
log4j.appender.social.MaxFileSize=1MB
log4j.appender.social.MaxBackupIndex=10
# temp log for rss
log4j.logger.rss=INFO, rss
log4j.appender.rss=org.apache.log4j.RollingFileAppender
log4j.appender.rss.File=/home/#######################
log4j.appender.rss.File=rss.log
log4j.appender.rss.layout=org.apache.log4j.PatternLayout
log4j.appender.rss.layout.ConversionPattern=%d %p [%t] %C{1} - %m\n
log4j.appender.rss.MaxFileSize=1MB
log4j.appender.rss.MaxBackupIndex=10
答案 0 :(得分:3)
您可能有重复的日志追加器。检查你的log4j配置(或者使用logback或其他任何东西)。
请参阅Log4j appender或Logback appender。
同时尝试通过设置系统属性-Dlog4j.debug=true