title: How to set Spring logging level while testing?
body: <p>My Spring Boot testing stack is Maven + Surefire + JUnit4. I am annotating the tests with <code>@RunWith(SpringJUnit4ClassRunner.class)</code>.</p>
  
  <p>I have <code>application.properties</code> in my project root with this line:</p>
  
  <pre><code>logging.level.root=INFO
  </code></pre>
  
  <p>This controls the logging when running the Spring boot app and it works on normal runs.</p>
  
  <p>However, whenever I run any JUnit4 tests, I am spammed by pages of DEBUG output like this:</p>
  
  <pre><code>....
  17:43:20.500 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'autoConfigurationReport'
  17:43:20.500 [main] DEBUG org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader - Registered bean definition for imported class 'org.springframework.boot.autoconfigure.jackson.JacksonAutoConfiguration$JacksonObjectMapperConfiguration'
  17:43:20.501 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'org.springframework.boot.autoconfigure.condition.BeanTypeRegistry'
  17:43:20.502 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Returning cached instance of singleton bean 'autoConfigurationReport'
  ....
  </code></pre>
  
  <p>All this spam makes it almost impossible to see the actually relevant parts. How can I apply the logging levels to test output?</p>
  
  <p>I haven't set any logging explicitly, and according to the docs Logback is used by default.</p>