[logback-user] Custom appender: output of addWarn() not showing

Ceki Gülcü ceki at qos.ch
Fri Jul 7 16:09:15 CEST 2023


Glad to help.

If there are any errors or warnings during first configuration, the
status messages will be printed at the end of first configuration.
However, no status messages will be printed after first configuration.

Installing a status listener will print status messages during the
lifetime of the application.

Anyway, this is explained in the documentation I mentioned previously.

-- 
Ceki Gülcü

Sponsoring SLF4J/logback/reload4j at https://github.com/sponsors/qos-ch

On 7/7/2023 2:53 PM, Ton van Bart via logback-user wrote:
> Thank you for the tip, that was very helpful!
> TBH I wasn't aware of StatusListeners... I added an
> OnConsoleStatusListener in logback.xml, as I mentioned this appender is
> added to Kafka Connect - which we have running in Kubernetes - and
> messages started showing up (albeit with a delay, which I think is due
> to fact that I'm logging in the callback passed to Kafka produce().
> So, for my understanding, any statuses added during appender start() are
> picked up and shown, but statuses added during append() are not shown
> _unless_ you explicitly add a status listener, is that correct?
> 
> Thanks again for your help, kind regards, Ton
> 
> 
> On Thu, Jul 6, 2023 at 1:00 PM Ceki Gülcü via logback-user
> <logback-user at qos.ch <mailto:logback-user at qos.ch>> wrote:
> 
>     Hello Ton,
> 
>     Have you tried adding a statusListener on the command line?
> 
>     See
>     https://logback.qos.ch/manual/configuration.html#logback.statusLC
>     <https://logback.qos.ch/manual/configuration.html#logback.statusLC>
> 
>     StatusListeners should work the same way in logback version 1.2.
> 
>     Let us know if this helps,
> 
>     -- 
>     Ceki Gülcü
> 
>     Sponsoring SLF4J/logback/reload4j at
>     https://github.com/sponsors/qos-ch <https://github.com/sponsors/qos-ch>
> 
>     On 7/5/2023 11:14 PM, Ton van Bart via logback-user wrote:
>     > Hello,
>     > I have created a custom Logback appender which sends the log
>     events to a
>     > Kafka topic. In order to verify if producing to Kafka was
>     successful, I
>     > check the result and do an addWarn("Failed to produce logging", e) if
>     > there was an exception.
>     > Similarly, I tried to add an addInfo("produced offset:" +
>     > matadata.offset()) when a produce is successful.
>     >
>     > I'm using this appender in Kafka Connect, where I have wrapped it
>     in an
>     > AsyncAppender; however, neither message is showing. I also tried
>     > printing to System.out / System.err from within the appender with the
>     > same (lack of) result: during start up of Connect, I do see addInfo()
>     > messages, but during normal processing, everything goes silent. No
>     > messages appear on the topic so I assume something went wrong; when
>     > testing the setup in a local docker compose, it works, so there
>     must be
>     > some problem somewhere.
>     >
>     > I understand that this may be due to the combination with Kafka
>     Connect,
>     > my question is: should I expect addInfo() etc. to show up in normal
>     > appender processing (i.e. calling it from within append() or is this
>     > internal logging for use only in appender start() ? What would be the
>     > standard way for an appender to report errors during append()?
>     >
>     > Note: due to circumstances beyond my control, I'm currently stuck on
>     > Logback 1.2.11 .
>     >
>     > Thanks in advance for any tips, kind regards, Ton
>     >
>     > _______________________________________________
>     > logback-user mailing list
>     > logback-user at qos.ch <mailto:logback-user at qos.ch>
>     > https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user
>     <https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user>
>     _______________________________________________
>     logback-user mailing list
>     logback-user at qos.ch <mailto:logback-user at qos.ch>
>     https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user
>     <https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user>
> 
> 
> _______________________________________________
> logback-user mailing list
> logback-user at qos.ch
> https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user


More information about the logback-user mailing list