Skip to content

Commit

Permalink
feat: update logback format to include milliseconds & align messages
Browse files Browse the repository at this point in the history
  • Loading branch information
xeruf committed Jan 25, 2021
1 parent e7ebe59 commit d711ffd
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
9 changes: 4 additions & 5 deletions helpers/test-client/src/logback-tests.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>

<!-- This config should be released with the app as "logback.xml". -->
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_DIRECTORY:-log}/game_server.log</file>
<file>${LOG_DIRECTORY:-log}/testclient.log</file>

<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>${LOG_DIRECTORY:-log}/game_server.%i.log.gz</FileNamePattern>
<FileNamePattern>${LOG_DIRECTORY:-log}/testclient.%i.log.gz</FileNamePattern>
<MinIndex>1</MinIndex>
<MaxIndex>5</MaxIndex>
</rollingPolicy>
Expand All @@ -18,12 +17,12 @@
</triggeringPolicy>

<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss} %-5level %logger{36} - %msg%n</Pattern>
<Pattern>%d{HH:mm:ss.SSS} %-5level %36logger{36} - %msg%n</Pattern>
</layout>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout>
<pattern>%d{HH:mm:ss} %-5level %logger{36} - %msg%n</pattern>
<pattern>%.-11d{HH:mm:ss.SSS} %-5level %36logger{36} - %msg%n</pattern>
</layout>
</appender>

Expand Down
8 changes: 3 additions & 5 deletions server/configuration/logback-production.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@
<configuration>
<!-- This config should be used in production mode, logging only to stdout which is handled by docker. -->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{36} - %msg%n
</Pattern>
</layout>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d{yy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %36logger{36} - %msg%n</pattern>
</layout>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
Expand Down
6 changes: 3 additions & 3 deletions server/configuration/logback-release.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
</triggeringPolicy>

<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss} %-5level %logger{36} - %msg%n</Pattern>
<Pattern>%d{HH:mm:ss.SSS} %-5level %36logger{36} - %msg%n</Pattern>
</layout>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout>
<pattern>%d{HH:mm:ss} %-5level %logger{36} - %msg%n</pattern>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%.-11d{HH:mm:ss.SSS} %-5level %36logger{36} - %msg%n</pattern>
</layout>
</appender>

Expand Down
2 changes: 1 addition & 1 deletion server/configuration/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm:ss} %-5level %logger{36} - %msg%n</Pattern>
<Pattern>%d{HH:mm:ss.SSS} %-5level %36logger{36} - %msg%n</Pattern>
</layout>
</appender>

Expand Down

0 comments on commit d711ffd

Please sign in to comment.