<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">I would suggest you look at <a href="http://flume.apache.org/FlumeUserGuide.html" class="">http://flume.apache.org/FlumeUserGuide.html</a> and specifically <a href="http://flume.apache.org/FlumeUserGuide.html#file-channel" class="">http://flume.apache.org/FlumeUserGuide.html#file-channel</a>. Flume has an embedded agent <a href="http://flume.apache.org/FlumeDeveloperGuide.html#embedded-agent" class="">http://flume.apache.org/FlumeDeveloperGuide.html#embedded-agent</a> that you can use that handles all of this for you. The Log4j FlumeAppender does this but it also supports a lighter-weight version that you could copy as well. It uses BerkelyDB and writes the event to it before passing the event to another thread where it uses the Flume RPC client to send the event off. You could copy just the BerkelyDB logic and tie it to another delivery mechanism if you want. The code for that is at <a href="https://github.com/apache/logging-log4j2/blob/master/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumePersistentManager.java" class="">https://github.com/apache/logging-log4j2/blob/master/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumePersistentManager.java</a> and the main portion of the appender is at <a href="https://github.com/apache/logging-log4j2/blob/master/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAppender.java" class="">https://github.com/apache/logging-log4j2/blob/master/log4j-flume-ng/src/main/java/org/apache/logging/log4j/flume/appender/FlumeAppender.java</a> so you can see how they tie together. The FlumeAppender supports any valid Layout so the answer to how the stack trace is passed would be “it depends”.</div><div class=""><br class=""></div><div class="">Ralph</div><br class=""><div><blockquote type="cite" class=""><div class="">On Jun 2, 2017, at 11:44 AM, Oleksandr Gavenko <<a href="mailto:gavenkoa@gmail.com" class="">gavenkoa@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">On Fri, Jun 2, 2017 at 9:02 PM, Ralph Goers <<a href="mailto:rgoers@apache.org" class="">rgoers@apache.org</a>> wrote:<br class=""><blockquote type="cite" class="">I created the FlumeAppender for Log4j with just this purpose in mind. The FlumeAppender will write the log event to local disk and then returns control to the application.<br class="">At this point eventual delivery is guaranteed.<br class=""></blockquote>Can you share how do you serialize log event?<br class=""><a href="https://logback.qos.ch/apidocs/ch/qos/logback/classic/spi/ILoggingEvent.html" class="">https://logback.qos.ch/apidocs/ch/qos/logback/classic/spi/ILoggingEvent.html</a><br class="">interface has simple fields along with complex, like:<br class=""><br class="">* MCD (which I definitely will use)<br class="">* StackTraceElement[]<br class=""><br class="">Is that some CSV format? How do you handle control characters and new lines?<br class=""><br class="">My end destination works with JSON format, I can stop with this serialization.<br class=""><br class=""><blockquote type="cite" class="">A background thread reads the events that have been written to disk and forwards them on to another Apache Flume node.<br class="">When that node confirms it has accepted them the event is deleted from local disk.<br class="">The FlumeAppender has the ability to fail over to alternate Flume nodes.<br class="">If none are available the events will simply stay on disk until it is full.<br class=""></blockquote><br class="">Originally I thought about complex solution that asynchronously send<br class="">to network unless remote host down or event buffer is full because of<br class="">load.<br class=""><br class="">In later case write to disc and later try to deliver saved data.<br class=""><br class="">On application shutdown saving to disk can be much faster then trying<br class="">to deliver logging events to external server.<br class=""><br class="">What I wander is how do you manage saved events. In single file or<br class="">several? How do you discover file for processing? How do you split<br class="">logging events? How do you keep pointers for not yet processes events?<br class="">_______________________________________________<br class="">logback-user mailing list<br class="">logback-user@qos.ch<br class="">http://mailman.qos.ch/mailman/listinfo/logback-user</div></div></blockquote></div><br class=""></body></html>