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

Ton van Bart tonvanbart at gmail.com
Wed Jul 5 23:14:53 CEST 2023


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20230705/cc4de1b8/attachment.htm>


More information about the logback-user mailing list