Spring应用程序日志重复

时间:2017-09-08 02:56:02

标签: java spring hibernate logging

我在这里有一个愚蠢的问题。我正在构建一个基于Spring hibernate的Web应用程序。当我运行测试时,日志似乎显示为double。但不是所有的。它看起来像下面。

ItemsSource

如果您查看ComboBox,它只会显示一次。但其他人都是重复的。这是正常还是我错过了什么?

这是我的log4j配置

SelectedItem

下面是我的pom.xml

2017-09-08 10:27:47,443  INFO [main] (PropertiesLoaderSupport.java:177) -   Loading properties file from class path resource [application.properties]
2017-09-08 10:27:48,249  INFO [main] (EhCacheManagerFactoryBean.java:100) - Initializing EHCache CacheManager
2017-09-08 10:27:49,397  INFO [main] (EhCacheManagerFactoryBean.java:100) - Initializing EHCache CacheManager
2017-09-08 10:27:49,421 DEBUG [main] (EhCacheFactoryBean.java:329) -    Creating new EHCache cache region 'aclCache'
2017-09-08 10:28:00,643  INFO [main] (TransactionFactoryFactory.java:62) -  Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory
2017-09-08 10:28:00,643  INFO [main] (TransactionFactoryFactory.java:62) -  Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory
2017-09-08 10:28:00,644  INFO [main] (TransactionManagerLookupFactory.java:80) -    No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2017-09-08 10:28:00,644  INFO [main] (TransactionManagerLookupFactory.java:80) -    No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
2017-09-08 10:28:09,697 DEBUG [main] (AbstractFallbackTransactionAttributeSource.java:106) -    Adding transactional method 'count' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT,readOnly; ''
2017-09-08 10:28:10,240 DEBUG [main] (AbstractFallbackTransactionAttributeSource.java:106) -    Adding transactional method 'loadUserByUsername' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
2017-09-08 10:28:10,378 DEBUG [main] (AbstractFallbackTransactionAttributeSource.java:106) -    Adding transactional method 'checkPermission' with attribute: PROPAGATION_REQUIRED,ISOLATION_DEFAULT; ''
2017-09-08 10:28:11,618 DEBUG [main] (JDBCTransaction.java:82) -    begin
2017-09-08 10:28:11,618 DEBUG [main] (JDBCTransaction.java:82) -    begin
2017-09-08 10:28:11,619 DEBUG [main] (JDBCTransaction.java:87) -    current autocommit status: false
2017-09-08 10:28:11,619 DEBUG [main] (JDBCTransaction.java:87) -    current autocommit status: false

1 个答案:

答案 0 :(得分:0)

事实证明 additivity 属性是问题。当我设置为false时,日志只出现一次。