StructuredArgument keyValue with object that has no json serializer stops logback appender entirely

If you have a log statement that tries to create a keyValue with an object that is not JSON-serializable, the entire log appender is stopped. This seems like a pretty big flaw. One erroneous log statement should not be able to stop all logging for the system. What makes this worse is that unless a StatusListener has been enabled, nothing indicates why logging has stopped.

In my case, we converted to JSON logging and converted some statements to use keyValue. In a couple of cases, we just left them passing in an object itself. With the old logging, this just printed the result from calling toString() on the object. With the new JSON logging, a silent failure occurred, and all logging stopped. This happened because the JSON serialization failure throws an IOException, which then tells logback to stop the appender. A better solution would be to fallback to the toString() method (or anything that doesn't break all logging for the system). I was able to find the error by enabling a StatusListener (and reproduce it in a test), which gave exception below. Is there a way to prevent this kind of "catastrophic" failure to logging?

ERROR in ch.qos.logback.core.rolling.RollingFileAppender[JSON] - IO failure in appender com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) )
at com.fasterxml.jackson.databind.JsonMappingException: No serializer found for class and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) ) at at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:69)
at at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:32)
at at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:130)
at at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:2384)
at at com.fasterxml.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:378)
at at net.logstash.logback.marker.ObjectAppendingMarker.writeFieldValue(ObjectAppendingMarker.java:94)
at at net.logstash.logback.marker.SingleFieldAppendingMarker.writeTo(SingleFieldAppendingMarker.java:86)
at at net.logstash.logback.composite.loggingevent.ArgumentsJsonProvider.writeTo(ArgumentsJsonProvider.java:67)
at at net.logstash.logback.composite.loggingevent.ArgumentsJsonProvider.writeTo(ArgumentsJsonProvider.java:41)
at at net.logstash.logback.composite.JsonProviders.writeTo(JsonProviders.java:77)
at at net.logstash.logback.composite.CompositeJsonFormatter.writeEventToGenerator(CompositeJsonFormatter.java:169)
at at net.logstash.logback.composite.CompositeJsonFormatter.writeEventToOutputStream(CompositeJsonFormatter.java:146)
at at net.logstash.logback.encoder.CompositeJsonEncoder.doEncode(CompositeJsonEncoder.java:73)
at at net.logstash.logback.encoder.CompositeJsonEncoder.doEncode(CompositeJsonEncoder.java:30)
at at ch.qos.logback.core.OutputStreamAppender.writeOut(OutputStreamAppender.java:187)
at at ch.qos.logback.core.FileAppender.writeOut(FileAppender.java:256)
at at ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:212)
at at ch.qos.logback.core.rolling.RollingFileAppender.subAppend(RollingFileAppender.java:228)
at at ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:100)
at at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:84)
at at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:48)
at at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:270)
at at ch.qos.logback.classic.Logger.callAppenders(Logger.java:257)
at at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:421)
at at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
at at ch.qos.logback.classic.Logger.info(Logger.java:591)
at at
...
... Other related code...