Commit 6b4bb4d6 authored by Phillip Webb's avatar Phillip Webb

Unify console and file logback patterns

Update the file log pattern to write the thread name after the `---`
separator. The allows both file and console logs to be parsed in the
same way.

Fixes gh-2136
parent df1dede5
...@@ -734,6 +734,7 @@ The following items are output: ...@@ -734,6 +734,7 @@ The following items are output:
* Log Level -- `ERROR`, `WARN`, `INFO`, `DEBUG` or `TRACE`. * Log Level -- `ERROR`, `WARN`, `INFO`, `DEBUG` or `TRACE`.
* Process ID. * Process ID.
* A `---` separator to distinguish the start of actual log messages. * A `---` separator to distinguish the start of actual log messages.
* Thread name -- Enclosed in square brackets (may be truncated for console output).
* Logger name -- This is usually the source class name (often abbreviated). * Logger name -- This is usually the source class name (often abbreviated).
* The log message. * The log message.
......
...@@ -46,7 +46,7 @@ class DefaultLogbackConfiguration { ...@@ -46,7 +46,7 @@ class DefaultLogbackConfiguration {
+ "%clr(:){faint} %m%n%wex"; + "%clr(:){faint} %m%n%wex";
private static final String FILE_LOG_PATTERN = "%d{yyyy-MM-dd HH:mm:ss.SSS} %5p " private static final String FILE_LOG_PATTERN = "%d{yyyy-MM-dd HH:mm:ss.SSS} %5p "
+ "${PID:- } [%t] --- %-40.40logger{39} : %m%n%wex"; + "${PID:- } --- [%t] %-40.40logger{39} : %m%n%wex";
private static final Charset UTF8 = Charset.forName("UTF-8"); private static final Charset UTF8 = Charset.forName("UTF-8");
......
...@@ -10,7 +10,7 @@ initialization performed by Boot ...@@ -10,7 +10,7 @@ initialization performed by Boot
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" /> <conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t{14}]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex"/> <property name="CONSOLE_LOG_PATTERN" value="%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(%5p) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t{14}]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n%wex"/>
<property name="FILE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } [%t] --- %-40.40logger{39} : %m%n%wex"/> <property name="FILE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${PID:- } --- [%t] %-40.40logger{39} : %m%n%wex"/>
<appender name="DEBUG_LEVEL_REMAPPER" class="org.springframework.boot.logging.logback.LevelRemappingAppender"> <appender name="DEBUG_LEVEL_REMAPPER" class="org.springframework.boot.logging.logback.LevelRemappingAppender">
<destinationLogger>org.springframework.boot</destinationLogger> <destinationLogger>org.springframework.boot</destinationLogger>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment