Skip to content

Commit

Permalink
fix: switch to async. log appender
Browse files Browse the repository at this point in the history
The default configuration for logback currently is using blocking appenders which, in Vert.x, is generally discouraged. Switching to logbacks AsyncAppender interface, for unblocking the logging threads.
  • Loading branch information
kristian authored and pk-work committed Mar 29, 2021
1 parent d340192 commit 880b338
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
10 changes: 8 additions & 2 deletions resources/config/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<pattern>%d{HH:mm:ss.SSS} [%thread] {%marker} %level %logger - %msg%n</pattern>
</encoder>
</appender>
<appender name="ASYNC_STDOUT" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="STDOUT" />
</appender>

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_DIR}/neonbee.log</file>
Expand All @@ -21,10 +24,13 @@
<pattern>%d{HH:mm:ss.SSS} [%thread] {%marker} %level %logger - %msg%n</pattern>
</encoder>
</appender>
<appender name="ASYNC_FILE" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="FILE" />
</appender>

<!-- Configure so that it outputs to both console and log file, default log level is WARNING -->
<root level="INFO">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
<appender-ref ref="ASYNC_STDOUT" />
<appender-ref ref="ASYNC_FILE" />
</root>
</configuration>
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
<pattern>%d{HH:mm:ss.SSS} [%thread] {%marker} %level %logger - %msg%n</pattern>
</encoder>
</appender>
<appender name="ASYNC_STDOUT" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="STDOUT" />
</appender>

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_DIR}/neonbee.log</file>
Expand All @@ -21,10 +24,13 @@
<pattern>%d{HH:mm:ss.SSS} [%thread] {%marker} %level %logger - %msg%n</pattern>
</encoder>
</appender>
<appender name="ASYNC_FILE" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="FILE" />
</appender>

<!-- Configure so that it outputs to both console and log file, default log level is WARNING -->
<root level="DEBUG">
<appender-ref ref="STDOUT" />
<appender-ref ref="FILE" />
<appender-ref ref="ASYNC_STDOUT" />
<appender-ref ref="ASYNC_FILE" />
</root>
</configuration>

0 comments on commit 880b338

Please sign in to comment.