diff --git a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java
index dc877fa76a..792f0293de 100644
--- a/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java
+++ b/spring-boot/src/main/java/org/springframework/boot/logging/log4j2/Log4J2LoggingSystem.java
@@ -27,6 +27,7 @@ import org.apache.logging.log4j.core.LoggerContext;
import org.apache.logging.log4j.core.config.Configuration;
import org.apache.logging.log4j.core.config.ConfigurationFactory;
import org.apache.logging.log4j.core.config.ConfigurationSource;
+
import org.springframework.boot.logging.LogLevel;
import org.springframework.boot.logging.LoggingSystem;
import org.springframework.boot.logging.Slf4JLoggingSystem;
@@ -56,8 +57,24 @@ public class Log4J2LoggingSystem extends Slf4JLoggingSystem {
LEVELS = Collections.unmodifiableMap(levels);
}
- public Log4J2LoggingSystem(ClassLoader classLoader) {
- super(classLoader, "log4j2.json", "log4j2.jsn", "log4j2.xml");
+ public Log4J2LoggingSystem(ClassLoader classLoader, boolean fileOutput, boolean consoleOutput) {
+ super(classLoader, fileOutput, consoleOutput);
+ }
+
+ @Override
+ protected String[] getLogFileName(boolean fileOutput, boolean consoleOutput) {
+ if (fileOutput && consoleOutput) {
+ return new String[] { "log4j2-file-console.json", "log4j2-file-console.jsn", "log4j2-file-console.xml" };
+ }
+ else if (fileOutput) {
+ return new String[] { "log4j2-file.json", "log4j2-file.jsn", "log4j2-file.xml" };
+ }
+ else if (consoleOutput) {
+ return new String[] { "log4j2-console.json", "log4j2-console.jsn", "log4j2-console.xml" };
+ }
+ else {
+ return new String[] { "log4j2.json", "log4j2.jsn", "log4j2.xml" };
+ }
}
@Override
diff --git a/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/basic-log4j2.xml b/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/basic-log4j2.xml
new file mode 100644
index 0000000000..d8e113eac3
--- /dev/null
+++ b/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/basic-log4j2.xml
@@ -0,0 +1,25 @@
+
+
+
+ ????
+ [%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${sys:PID} %5p [%t] --- %c{1}: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2-console.xml b/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2-console.xml
new file mode 100644
index 0000000000..2374d828ef
--- /dev/null
+++ b/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2-console.xml
@@ -0,0 +1,27 @@
+
+
+
+ ????
+ /tmp
+ ${sys:LOG_PATH}/spring.log
+ [%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${sys:PID} %5p [%t] --- %c{1}: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2-file-console.xml b/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2-file-console.xml
new file mode 100644
index 0000000000..e2f1bb78a7
--- /dev/null
+++ b/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2-file-console.xml
@@ -0,0 +1,37 @@
+
+
+
+ ????
+ /tmp
+ ${sys:LOG_PATH}/spring.log
+ [%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${sys:PID} %5p [%t] --- %c{1}: %m%n
+
+
+
+
+
+
+
+ ${LOG_PATTERN}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2-file.xml b/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2-file.xml
new file mode 100644
index 0000000000..b1bc0235c0
--- /dev/null
+++ b/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2-file.xml
@@ -0,0 +1,33 @@
+
+
+
+ ????
+ /tmp
+ ${sys:LOG_PATH}/spring.log
+ [%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${sys:PID} %5p [%t] --- %c{1}: %m%n
+
+
+
+
+ ${LOG_PATTERN}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2.xml b/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2.xml
new file mode 100644
index 0000000000..eed5a2c784
--- /dev/null
+++ b/spring-boot/src/main/resources/org/springframework/boot/logging/log4j2/log4j2.xml
@@ -0,0 +1,21 @@
+
+
+
+ ????
+ /tmp
+ ${sys:LOG_PATH}/spring.log
+ [%d{yyyy-MM-dd HH:mm:ss.SSS}] boot%X{context} - ${sys:PID} %5p [%t] --- %c{1}: %m%n
+
+
+
+
+
+
+
+
+
+
+
+
+
+