Example usage for org.springframework.boot.logging LoggingSystemProperties LOG_FILE

List of usage examples for org.springframework.boot.logging LoggingSystemProperties LOG_FILE

Introduction

In this page you can find the example usage for org.springframework.boot.logging LoggingSystemProperties LOG_FILE.

Prototype

String LOG_FILE

To view the source code for org.springframework.boot.logging LoggingSystemProperties LOG_FILE.

Click Source Link

Document

The name of the System property that contains the log file.

Usage

From source file:org.springframework.boot.context.logging.LoggingApplicationListenerTests.java

@After
public void clear() {
    LoggingSystem loggingSystem = LoggingSystem.get(getClass().getClassLoader());
    loggingSystem.setLogLevel("ROOT", LogLevel.INFO);
    loggingSystem.cleanUp();/*from  ww w.  j  a  v  a2 s  .  c om*/
    System.clearProperty(LoggingSystem.class.getName());
    System.clearProperty(LoggingSystemProperties.LOG_FILE);
    System.clearProperty(LoggingSystemProperties.LOG_PATH);
    System.clearProperty(LoggingSystemProperties.PID_KEY);
    System.clearProperty(LoggingSystemProperties.EXCEPTION_CONVERSION_WORD);
    System.clearProperty(LoggingSystemProperties.CONSOLE_LOG_PATTERN);
    System.clearProperty(LoggingSystemProperties.FILE_LOG_PATTERN);
    System.clearProperty(LoggingSystemProperties.LOG_LEVEL_PATTERN);
    System.clearProperty(LoggingSystem.SYSTEM_PROPERTY);
    if (this.context != null) {
        this.context.close();
    }
}

From source file:org.springframework.boot.context.logging.LoggingApplicationListenerTests.java

@Test
public void systemPropertiesAreSetForLoggingConfiguration() {
    TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
            "logging.exception-conversion-word=conversion", "logging.file=target/log", "logging.path=path",
            "logging.pattern.console=console", "logging.pattern.file=file", "logging.pattern.level=level");
    this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader());
    assertThat(System.getProperty(LoggingSystemProperties.CONSOLE_LOG_PATTERN)).isEqualTo("console");
    assertThat(System.getProperty(LoggingSystemProperties.FILE_LOG_PATTERN)).isEqualTo("file");
    assertThat(System.getProperty(LoggingSystemProperties.EXCEPTION_CONVERSION_WORD)).isEqualTo("conversion");
    assertThat(System.getProperty(LoggingSystemProperties.LOG_FILE)).isEqualTo("target/log");
    assertThat(System.getProperty(LoggingSystemProperties.LOG_LEVEL_PATTERN)).isEqualTo("level");
    assertThat(System.getProperty(LoggingSystemProperties.LOG_PATH)).isEqualTo("path");
    assertThat(System.getProperty(LoggingSystemProperties.PID_KEY)).isNotNull();
}

From source file:org.springframework.boot.context.logging.LoggingApplicationListenerTests.java

@Test
public void logFilePropertiesCanReferenceSystemProperties() {
    TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context, "logging.file=target/${PID}.log");
    this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader());
    assertThat(System.getProperty(LoggingSystemProperties.LOG_FILE))
            .isEqualTo("target/" + new ApplicationPid().toString() + ".log");
}