Logback's "method" Conversion Word outputs question mark "?" when using AsyncAppender

233 Views Asked by At

Logback offers method conversion word however on my machine it outputs only question mark symbol when using AsyncAppender:

2020-09-09 12:14:57.551 IOService.?: Reading network …
2020-09-09 12:14:57.551 SocketIO.?: SOCKET - Writing data…

I'm using relatively simple configuration:

<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
    <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %logger{0}.%method: %msg %n</pattern>
</encoder>

When switching to regular FileAppender (e.g. ch.qos.logback.core.rolling.RollingFileAppender) it works fine.

Is this a known issue?

1

There are 1 best solutions below

0
On BEST ANSWER

I added includeCallerData to the ASYNCSTDOUT appender and it work. There is code:

<appender name="ASYNCSTDOUT" class="ch.qos.logback.classic.AsyncAppender">
    <appender-ref ref="STDOUT"/>
    <includeCallerData>true</includeCallerData>
</appender>

Look there for the original discussion