[logback-user] Custom appender: output of addWarn() not showing
Ceki Gülcü
ceki at qos.ch
Thu Jul 6 13:00:36 CEST 2023
Hello Ton,
Have you tried adding a statusListener on the command line?
See 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
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
> https://mailman.qos.ch/cgi-bin/mailman/listinfo/logback-user
More information about the logback-user
mailing list