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

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

Introduction

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

Prototype

String CONSOLE_LOG_PATTERN

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

Click Source Link

Document

The name of the System property that contains the console log pattern.

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 w  ww .java  2 s .  c  o m
    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 environmentPropertiesIgnoreUnresolvablePlaceholders() {
    // gh-7719/*from w w w .  java2s  .  com*/
    TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
            "logging.pattern.console=console ${doesnotexist}");
    this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader());
    assertThat(System.getProperty(LoggingSystemProperties.CONSOLE_LOG_PATTERN))
            .isEqualTo("console ${doesnotexist}");
}

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

@Test
public void environmentPropertiesResolvePlaceholders() {
    TestPropertySourceUtils.addInlinedPropertiesToEnvironment(this.context,
            "logging.pattern.console=console ${pid}");
    this.initializer.initialize(this.context.getEnvironment(), this.context.getClassLoader());
    assertThat(System.getProperty(LoggingSystemProperties.CONSOLE_LOG_PATTERN))
            .isEqualTo(this.context.getEnvironment().getProperty("logging.pattern.console"));
}