I am now at the point of attempting to implement this listener, but I’m having
trouble with it.
With some elisions, my logback.xml looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="5 seconds" debug="true">
<include file=".../baselogback.xml"/>
<appender name="ASYNC" class="ch.qos.logback.classic.AsyncAppender">
<appender-ref ref="STDOUT" />
<listener
class="net.logstash.logback.appender.listener.FailureSummaryLoggingAppenderListener"/>
<discardingThreshold>0</discardingThreshold>
<queueSize>256</queueSize>
<includeCallerData>false</includeCallerData>
<neverBlock>false</neverBlock>
</appender>
<logger name="..." level="DEBUG" additivity="false">
<appender-ref ref="ASYNC"/>
</logger>
<logger name="..." level="DEBUG" additivity="false">
<appender-ref ref="STDOUT"/>
</logger>
<root level="INFO">
<appender-ref ref="STDOUT"/>
</root>
</configuration>
I tested the async appender before I added the listener, and it seemed to be
basically working (although I’m not certain how I verify from the logs that
it’s actually asynchronous).
I then added the listener as above. When I start my service with this, I get
the following:
Logging system failed to initialize using configuration from '.../logback.xml'
java.lang.IllegalStateException: Logback configuration error detected:
ERROR in ch.qos.logback.core.joran.spi.Interpreter@5:101 - no applicable action
for [listener], current ElementPath is [[configuration][appender][listener]]
ERROR in ch.qos.logback.core.joran.spi.Interpreter@5:101 - no applicable action
for [listener], current ElementPath is [[configuration][appender][listener]]
at
org.springframework.boot.logging.logback.LogbackLoggingSystem.loadConfiguration(LogbackLoggingSystem.java:169)
I don’t understand what is wrong here.
From: logback-user <[email protected]> On Behalf Of Will Sargent
Sent: Sunday, May 23, 2021 3:50 AM
To: logback users list <[email protected]>
Subject: Re: [logback-user] Looking for details about AsyncAppender properties
You can report failure to log with an appender listener.
https://github.com/logstash/logstash-logback-encoder/blob/master/src/main/java/net/logstash/logback/appender/listener/FailureSummaryLoggingAppenderListener.java<https://urldefense.com/v3/__https:/github.com/logstash/logstash-logback-encoder/blob/master/src/main/java/net/logstash/logback/appender/listener/FailureSummaryLoggingAppenderListener.java__;!!BhdT!zwLb2IBXPlOE_S18efHOAwlRxSrCqtisf48mb3qFZWAaIii4Z9ziT5SffDv0sA$>
https://github.com/logstash/logstash-logback-encoder<https://urldefense.com/v3/__https:/github.com/logstash/logstash-logback-encoder__;!!BhdT!zwLb2IBXPlOE_S18efHOAwlRxSrCqtisf48mb3qFZWAaIii4Z9ziT5RNGmCTQA$>
On May 23, 2021, at 2:26 AM, David Roussel
<[email protected]<mailto:[email protected]>> wrote:
David
On 23 May 2021, at 01:24, KARR, DAVID <[email protected]<mailto:[email protected]>>
wrote:
I guess that will likely be 800k for each AsyncAppender (queueSize of 100000).
That could be significant, or not.
That’s just for the array. The data will be bigger. But weather it’s worth it
depends on the risk of data loss of logs.
And the problem with loosing log lines is that it is hard to spot. Most teams
never look for missing log lines. And if they thought some were missing it
would be hard to prove if and why it occurred.
So what do you use logs for? Diagnostics in case of a problem? Or do they feed
MI reporting?
David
_______________________________________________
logback-user mailing list
[email protected]<mailto:[email protected]>
http://mailman.qos.ch/mailman/listinfo/logback-user<https://urldefense.com/v3/__http:/mailman.qos.ch/mailman/listinfo/logback-user__;!!BhdT!zwLb2IBXPlOE_S18efHOAwlRxSrCqtisf48mb3qFZWAaIii4Z9ziT5QylXlM7w$>
_______________________________________________
logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user