문제

I have a many DB integration tests that are using the following annotations for transactional rollback:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations={"classpath:ApplicationContext-DAOs.xml"})
@Transactional

The tests pass, but when I run them Spring deems it necessary to log at INFO level to standard error! It logs things like:

19/11/2010 16:49:11 org.springframework.test.context.TestContextManager
  retrieveTestExecutionListeners
INFO: @TestExecutionListeners is not present for class [class my.SomeDAOTest]:
  using defaults.
etc for many, many lines ...

Where do I turn this off?

도움이 되었습니까?

해결책

You can hide it using log4j. In your log4j.xml, set a logger for spring to warn (or error).

<logger name="org.springframework">
    <level value="warn"/>
</logger>

다른 팁

Spring core is using apache commons logging. In order to configure away from default behavior (writing to stderr) I had to use the bridge component for my particular framework.

I'm using Log4j2, so once I added the bridge from apache commons to log4j2, then spring core respected my settings.

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-jcl</artifactId>
    <version>2.11.2</version>
</dependency>
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top