title: How to set environment-variable in SpringBootTest for logback?
body: <p>How to set environment variable for SpringBootTest for logback configuration?
  <br><strong>Logback configuration error</strong> occurs when using a environment variable in logback.xml.</p>
  <p>In logback.xml,</p>
  <pre><code>&lt;appender name=&quot;plainLogsToFile&quot; class=&quot;ch.qos.logback.core.rolling.RollingFileAppender&quot;&gt;
      &lt;file&gt;/${LOG_PATH}/service.log&lt;/file&gt;
  </code></pre>
  <p>This is the test-class:</p>
  <pre><code>@RunWith(SpringRunner.class)
  @SpringBootTest(classes = Application.class)
  public class MyTestClass {
  //tests here
  }
  </code></pre>
  <p>Following exception is reported:</p>
  <pre><code>openFile(/LOG_PATH_IS_UNDEFINED/service.log,true) call failed. java.io.FileNotFoundException: /LOG_PATH_IS_UNDEFINED/service.log (No such file or directory)
      at org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:162)
      at org.springframework.boot.logging.logback.LogbackLoggingSystem.reinitialize(LogbackLoggingSystem.java:208)
      at org.springframework.boot.logging.AbstractLoggingSystem.initializeWithConventions(AbstractLoggingSystem.java:74)
      at org.springframework.boot.logging.AbstractLoggingSystem.initialize(AbstractLoggingSystem.java:59)
      at org.springframework.boot.logging.logback.LogbackLoggingSystem.initialize(LogbackLoggingSystem.java:115)
      at org.springframework.boot.logging.LoggingApplicationListener.initializeSystem(LoggingApplicationListener.java:303)
      at org.springframework.boot.logging.LoggingApplicationListener.initialize(LoggingApplicationListener.java:276)
      at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEnvironmentPreparedEvent(LoggingApplicationListener.java:239)
      at org.springframework.boot.logging.LoggingApplicationListener.onApplicationEvent(LoggingApplicationListener.java:212)
      at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172)
  </code></pre>
  <p>I used ways to set property values explicitly using <strong>@TestPropertySource</strong> , <strong>@ActiveProfiles(&quot;test&quot;)</strong> , <strong>@SpringBootTest(... , properties ={})</strong> .
  <br>But, logback only refers system environment variables.
  <br>I am concerned only about test execution.
  <br>Some way to ignore the logback also appreciated.</p>