Example usage for org.springframework.boot.logging LoggingSystem SYSTEM_PROPERTY

List of usage examples for org.springframework.boot.logging LoggingSystem SYSTEM_PROPERTY

Introduction

In this page you can find the example usage for org.springframework.boot.logging LoggingSystem SYSTEM_PROPERTY.

Prototype

String SYSTEM_PROPERTY

To view the source code for org.springframework.boot.logging LoggingSystem SYSTEM_PROPERTY.

Click Source Link

Document

A System property that can be used to indicate the LoggingSystem to use.

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 w  w.jav  a 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 closingContextCleansUpLoggingSystem() {
    System.setProperty(LoggingSystem.SYSTEM_PROPERTY, TestCleanupLoggingSystem.class.getName());
    multicastEvent(new ApplicationStartingEvent(this.springApplication, new String[0]));
    TestCleanupLoggingSystem loggingSystem = (TestCleanupLoggingSystem) ReflectionTestUtils
            .getField(this.initializer, "loggingSystem");
    assertThat(loggingSystem.cleanedUp).isFalse();
    multicastEvent(new ContextClosedEvent(this.context));
    assertThat(loggingSystem.cleanedUp).isTrue();
}

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

@Test
public void closingChildContextDoesNotCleanUpLoggingSystem() {
    System.setProperty(LoggingSystem.SYSTEM_PROPERTY, TestCleanupLoggingSystem.class.getName());
    multicastEvent(new ApplicationStartingEvent(this.springApplication, new String[0]));
    TestCleanupLoggingSystem loggingSystem = (TestCleanupLoggingSystem) ReflectionTestUtils
            .getField(this.initializer, "loggingSystem");
    assertThat(loggingSystem.cleanedUp).isFalse();
    GenericApplicationContext childContext = new GenericApplicationContext();
    childContext.setParent(this.context);
    multicastEvent(new ContextClosedEvent(childContext));
    assertThat(loggingSystem.cleanedUp).isFalse();
    multicastEvent(new ContextClosedEvent(this.context));
    assertThat(loggingSystem.cleanedUp).isTrue();
    childContext.close();//from  ww w. j ava  2  s . c  o m
}

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

@Test
public void applicationFailedEventCleansUpLoggingSystem() {
    System.setProperty(LoggingSystem.SYSTEM_PROPERTY, TestCleanupLoggingSystem.class.getName());
    multicastEvent(new ApplicationStartingEvent(this.springApplication, new String[0]));
    TestCleanupLoggingSystem loggingSystem = (TestCleanupLoggingSystem) ReflectionTestUtils
            .getField(this.initializer, "loggingSystem");
    assertThat(loggingSystem.cleanedUp).isFalse();
    multicastEvent(new ApplicationFailedEvent(this.springApplication, new String[0],
            new GenericApplicationContext(), new Exception()));
    assertThat(loggingSystem.cleanedUp).isTrue();
}