From 295dc65b789b71ce520d4689379d2c32bbb30e7a Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Thu, 11 Feb 2016 18:55:20 +0000 Subject: [PATCH] Fix LoggingSystem tests following System property changes --- .../boot/logging/LoggingApplicationListener.java | 6 +++--- .../boot/logging/AbstractLoggingSystemTests.java | 6 ++++-- .../boot/logging/LoggingApplicationListenerTests.java | 4 ++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java index dcc45363d8c..6122c5499f9 100644 --- a/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java +++ b/spring-boot/src/main/java/org/springframework/boot/logging/LoggingApplicationListener.java @@ -120,17 +120,17 @@ public class LoggingApplicationListener implements GenericApplicationListener { public static final String LOG_PATH = "LOG_PATH"; /** - * The name of the System property that contains the console log pattern + * The name of the System property that contains the console log pattern. */ public static final String CONSOLE_LOG_PATTERN = "CONSOLE_LOG_PATTERN"; /** - * The name of the System property that contains the file log pattern + * The name of the System property that contains the file log pattern. */ public static final String FILE_LOG_PATTERN = "FILE_LOG_PATTERN"; /** - * The name of the System property that contains the log level pattern + * The name of the System property that contains the log level pattern. */ public static final String LOG_LEVEL_PATTERN = "LOG_LEVEL_PATTERN"; diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/AbstractLoggingSystemTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/AbstractLoggingSystemTests.java index 275c801e95d..01724c44524 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/AbstractLoggingSystemTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/AbstractLoggingSystemTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2014 the original author or authors. + * Copyright 2012-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,7 +62,9 @@ public abstract class AbstractLoggingSystemTests { } protected final LogFile getLogFile(String file, String path) { - return new LogFile(file, path); + LogFile logFile = new LogFile(file, path); + logFile.applyToSystemProperties(); + return logFile; } protected final String tmpDir() { diff --git a/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java b/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java index ce047c0e801..d7ef3c6e94a 100644 --- a/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/logging/LoggingApplicationListenerTests.java @@ -426,7 +426,7 @@ public class LoggingApplicationListenerTests { @Test public void systemPropertiesAreSetForLoggingConfiguration() { EnvironmentTestUtils.addEnvironment(this.context, - "logging.exception-conversion-word=conversion", "logging.file=file", + "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(), @@ -435,7 +435,7 @@ public class LoggingApplicationListenerTests { assertThat(System.getProperty("FILE_LOG_PATTERN"), is(equalTo("file"))); assertThat(System.getProperty("LOG_EXCEPTION_CONVERSION_WORD"), is(equalTo("conversion"))); - assertThat(System.getProperty("LOG_FILE"), is(equalTo("file"))); + assertThat(System.getProperty("LOG_FILE"), is(equalTo("target/log"))); assertThat(System.getProperty("LOG_LEVEL_PATTERN"), is(equalTo("level"))); assertThat(System.getProperty("LOG_PATH"), is(equalTo("path"))); assertThat(System.getProperty("PID"), is(not(nullValue())));