log4net.ElasticSearch
log4net.ElasticSearch copied to clipboard
Add a circuit-breaking behavior
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 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.
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.
What about using https://github.com/cjbhaines/Log4Net.Async ?
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 What about using https://github.com/urielha/log4stash ? Won't it be a non blocking behavior for logging ?