When bootstrap.servers are not available, stops spring boot app from running #16
Comments
Interesting :) and a bit surprising. Indeed, with that configuration the appender is not supposed to block anything. I'll try to reproduce that behavior in a test tomorrow, but a minimal (realistic) example would also be very welcome (pom + java main). Thanks for your report! |
Oh yeah I see what you mean. Actually it does not really block the application completely but lets just one log message through (join the buffer) like every 60 seconds (which is the default value of This is caused by the fact that the kafka-producer 0.8.2 does not support request timeouts for the send()'s. This feature most likely will be added in kafka 0.9 https://issues.apache.org/jira/browse/KAFKA-2120. I do not see a real workaround here beside a wrapping "async appender" with a bounded queue that keeps one thread hammering on the blocking kafka-producer send-method while throwing away new messages if the bounded queue becomes full (an even more lossy scenario). I guess this could be achieved by putting the KafkaAppender inside an http://logback.qos.ch/manual/appenders.html#AsyncAppender. This problem is definitely worth to be mentioned in the readme. |
I just tested this again, and the kafka-appender definitely stops my spring boot app from accepting requests defined in RestController annotated classes and stops it from registering with Eureka. I followed the example within the logback doc you provided and was able to get around my not-accepting-request issue by wrapping the appender with the AsyncAppender. Thanks for that suggestion.
My only issue now is that my spring boot app hangs on shutdown. I'll try fiddling with maxFlushTime config and see if that helps. ... and it didnt. Not sure what to do about that. |
I currently have no good Idea how to handle that. I think we have to wait for kafka 0.9 (https://issues.apache.org/jira/browse/KAFKA-2120) to solve this in nice way. |
I am interested in this issue as well, since kafka 0.9 is released now and https://issues.apache.org/jira/browse/KAFKA-2120 has been resolved. Thanks. |
I released logback-kafka-appender 0.0.5 with kafka 0.9.0 today. Maybe you can try fiddling with the |
When I start a spring-boot application with a KafkaAppender, and the endpoint is not accessible, then regardless of how I've mucked with the values, the appender stops my application from running.. period. It just sits and waits for the connection and retries and retries.
My config looks like this:
I do not want the logging to stop the system from running. I have other appenders that are running to local files. Please tell me I can configure this behavior somehow (ie.. let the system run and not use kafka appender .. but of course, keep trying to connect).
The text was updated successfully, but these errors were encountered: