{"action":"created","issue":{"url":"https://api.github.com/repos/logstash/logstash-logback-encoder/issues/190","repository_url":"https://api.github.com/repos/logstash/logstash-logback-encoder","labels_url":"https://api.github.com/repos/logstash/logstash-logback-encoder/issues/190/labels{/name}","comments_url":"https://api.github.com/repos/logstash/logstash-logback-encoder/issues/190/comments","events_url":"https://api.github.com/repos/logstash/logstash-logback-encoder/issues/190/events","html_url":"https://github.com/logstash/logstash-logback-encoder/issues/190","id":186827722,"number":190,"title":"StructuredArgument keyValue with object that has no json serializer stops logback appender entirely","user":{"login":"naisbitt","id":1154382,"avatar_url":"https://avatars.githubusercontent.com/u/1154382?v=3","gravatar_id":"","url":"https://api.github.com/users/naisbitt","html_url":"https://github.com/naisbitt","followers_url":"https://api.github.com/users/naisbitt/followers","following_url":"https://api.github.com/users/naisbitt/following{/other_user}","gists_url":"https://api.github.com/users/naisbitt/gists{/gist_id}","starred_url":"https://api.github.com/users/naisbitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naisbitt/subscriptions","organizations_url":"https://api.github.com/users/naisbitt/orgs","repos_url":"https://api.github.com/users/naisbitt/repos","events_url":"https://api.github.com/users/naisbitt/events{/privacy}","received_events_url":"https://api.github.com/users/naisbitt/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-11-02T15:08:25Z","updated_at":"2016-11-04T17:10:36Z","closed_at":null,"body":"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 (nothing is logged after this). 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.\r\n\r\nIn 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.\r\n\r\nERROR 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) )\r\nat 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) )\tat at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.failForEmpty(UnknownSerializer.java:69)\r\nat at com.fasterxml.jackson.databind.ser.impl.UnknownSerializer.serialize(UnknownSerializer.java:32)\r\nat at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:130)\r\nat at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:2384)\r\nat at com.fasterxml.jackson.core.base.GeneratorBase.writeObject(GeneratorBase.java:378)\r\nat at net.logstash.logback.marker.ObjectAppendingMarker.writeFieldValue(ObjectAppendingMarker.java:94)\r\nat at net.logstash.logback.marker.SingleFieldAppendingMarker.writeTo(SingleFieldAppendingMarker.java:86)\r\nat at net.logstash.logback.composite.loggingevent.ArgumentsJsonProvider.writeTo(ArgumentsJsonProvider.java:67)\r\nat at net.logstash.logback.composite.loggingevent.ArgumentsJsonProvider.writeTo(ArgumentsJsonProvider.java:41)\r\nat at net.logstash.logback.composite.JsonProviders.writeTo(JsonProviders.java:77)\r\nat at net.logstash.logback.composite.CompositeJsonFormatter.writeEventToGenerator(CompositeJsonFormatter.java:169)\r\nat at net.logstash.logback.composite.CompositeJsonFormatter.writeEventToOutputStream(CompositeJsonFormatter.java:146)\r\nat at net.logstash.logback.encoder.CompositeJsonEncoder.doEncode(CompositeJsonEncoder.java:73)\r\nat at net.logstash.logback.encoder.CompositeJsonEncoder.doEncode(CompositeJsonEncoder.java:30)\r\nat at ch.qos.logback.core.OutputStreamAppender.writeOut(OutputStreamAppender.java:187)\r\nat at ch.qos.logback.core.FileAppender.writeOut(FileAppender.java:256)\r\nat at ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:212)\r\nat at ch.qos.logback.core.rolling.RollingFileAppender.subAppend(RollingFileAppender.java:228)\r\nat at ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:100)\r\nat at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:84)\r\nat at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:48)\r\nat at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:270)\r\nat at ch.qos.logback.classic.Logger.callAppenders(Logger.java:257)\r\nat at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:421)\r\nat at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)\r\nat at ch.qos.logback.classic.Logger.info(Logger.java:591)\r\nat at \r\n... \r\n... Other related code..."},"comment":{"url":"https://api.github.com/repos/logstash/logstash-logback-encoder/issues/comments/258491231","html_url":"https://github.com/logstash/logstash-logback-encoder/issues/190#issuecomment-258491231","issue_url":"https://api.github.com/repos/logstash/logstash-logback-encoder/issues/190","id":258491231,"user":{"login":"naisbitt","id":1154382,"avatar_url":"https://avatars.githubusercontent.com/u/1154382?v=3","gravatar_id":"","url":"https://api.github.com/users/naisbitt","html_url":"https://github.com/naisbitt","followers_url":"https://api.github.com/users/naisbitt/followers","following_url":"https://api.github.com/users/naisbitt/following{/other_user}","gists_url":"https://api.github.com/users/naisbitt/gists{/gist_id}","starred_url":"https://api.github.com/users/naisbitt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/naisbitt/subscriptions","organizations_url":"https://api.github.com/users/naisbitt/orgs","repos_url":"https://api.github.com/users/naisbitt/repos","events_url":"https://api.github.com/users/naisbitt/events{/privacy}","received_events_url":"https://api.github.com/users/naisbitt/received_events","type":"User","site_admin":false},"created_at":"2016-11-04T17:10:36Z","updated_at":"2016-11-04T17:10:36Z","body":"@philsttr Sounds great.  I did end up finding and implementing the JsonGeneratorDecorator workaround like you mention.  It just took me a **long** time to track it down and then find that solution (so it would be great if we could eliminate that work and frustration for anyone else) 😄 "}}
{"actor":{"display_login":"naisbitt"}}