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
This commit is contained in:
Phillip Webb 2014-12-12 19:05:37 -08:00
parent df1dede57f
commit 6b4bb4d654
3 changed files with 3 additions and 2 deletions

View File

@ -734,6 +734,7 @@ The following items are output:
* Log Level -- `ERROR`, `WARN`, `INFO`, `DEBUG` or `TRACE`.
* Process ID.
* 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).
* The log message.

View File

@ -46,7 +46,7 @@ class DefaultLogbackConfiguration {
+ "%clr(:){faint} %m%n%wex";
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");

View File

@ -10,7 +10,7 @@ initialization performed by Boot
<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="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">
<destinationLogger>org.springframework.boot</destinationLogger>