Logback的”method”转换关键字在使用AsyncAppender时输出问号”?”。

huangapple go评论74阅读模式
英文:

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

问题

Logback提供了method转换关键字,然而在我的机器上,使用AsyncAppender时输出的只是问号符号:

2020-09-09 12:14:57.551 IOService.?: 读取网络中…
2020-09-09 12:14:57.551 SocketIO.?: SOCKET - 正在写入数据…

我正在使用相对简单的配置:

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

当切换到常规的FileAppender(例如ch.qos.logback.core.rolling.RollingFileAppender),它工作正常。

这是否是一个已知问题?

英文:

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:

&lt;encoder class=&quot;ch.qos.logback.classic.encoder.PatternLayoutEncoder&quot;&gt;
    &lt;pattern&gt;%d{yyyy-MM-dd HH:mm:ss.SSS} %logger{0}.%method: %msg %n&lt;/pattern&gt;
&lt;/encoder&gt;

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

Is this a known issue?

答案1

得分: 2

我在 ASYNCSTDOUT appender 中添加了 includeCallerData 并且它起作用了。
以下是代码部分:

&lt;appender name=&quot;ASYNCSTDOUT&quot; class=&quot;ch.qos.logback.classic.AsyncAppender&quot;&gt;
    &lt;appender-ref ref=&quot;STDOUT&quot;/&gt;
    &lt;includeCallerData&gt;true&lt;/includeCallerData&gt;
&lt;/appender&gt;

请在原始的 讨论链接 中查看更多信息。

英文:

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

&lt;appender name=&quot;ASYNCSTDOUT&quot; class=&quot;ch.qos.logback.classic.AsyncAppender&quot;&gt;
    &lt;appender-ref ref=&quot;STDOUT&quot;/&gt;
    &lt;includeCallerData&gt;true&lt;/includeCallerData&gt;
&lt;/appender&gt;

Look there for the original discussion

huangapple
  • 本文由 发表于 2020年9月9日 23:22:12
  • 转载请务必保留本文链接:https://go.coder-hub.com/63814752.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定