log4net.ElasticSearch icon indicating copy to clipboard operation
log4net.ElasticSearch copied to clipboard

Add a circuit-breaking behavior

Open lukas-lansky opened this issue 8 years ago • 5 comments

We fight issues with transient failures of our ES setup. Unfortunately, when our ES node is not working properly, log4net ES appender slows down the application radically although logging is definitely not a concern important enough for this slowdown to occur. It would be very useful if the appender could be configured in a circuit breaking fashion so that after a few long waits, it would give up for some time on trying to log.

lukas-lansky avatar Nov 07 '16 12:11 lukas-lansky

@lukas-lansky Unfortunately the blocker is with the log4net lib. All calls to log4net are blocking and are not run on a background thread. I'll check again to see if there is something I can do about this from the appender side of things but it may be a tough problem to solve. Because of this exact scenario I don't recommend using log4net.Elasticsearch in production as the application can really slow down. You could consider logging to text files and using Filebeat to forward directly to Elasticsearch or through Logstash to Elasticsearch.

jptoto avatar Nov 07 '16 14:11 jptoto

Thanks for the answer. I'll see if I found time to look into this for myself. I understand that those problems are tricky, but it also seems to me that solutions to such kinds of problems are reasons why programmers choose to use logging frameworks. Circuit breaker seems like a fitting pattern to reduce amount of blocking caused by malfunctioning counterparty to more reasonable levels -- there may be even better solutions, of course.

lukas-lansky avatar Nov 07 '16 14:11 lukas-lansky

What about using https://github.com/cjbhaines/Log4Net.Async ?

Giganticus avatar Nov 11 '16 09:11 Giganticus

Wow this is interesting, I didn't know about this lib. I'm climbing out from some other priorities but I will be able to check this out shortly. Thanks for the link!

jptoto avatar Nov 11 '16 14:11 jptoto

@jptoto What about using https://github.com/urielha/log4stash ? Won't it be a non blocking behavior for logging ?

mayurjurani avatar Jun 22 '18 18:06 mayurjurani