3 ms·
That depends on where the ringbuffer is placed. If you're placing the ringbuffer inside an appender, then the appender's encoder will format. However, if the
by wsargent 6y ago
That depends on where the ringbuffer is placed.
If you're placing the ringbuffer inside an appender, then the appender's encoder will format. However, if the ringbuffer itself is an appender, then you can store the logging events as is until it's time to dump them -- this is the approach in terse-logback [1]
Another option is to put the ringbuffer BEFORE sending it to the logging framework, so it's never processed by SLF4J at all. This means that it's more accessible to the application, at the cost of losing the initial timestamp of the logging event. This is the approach taken in Blindsight. [2]
Shout out to Bunyan, which is (AFAIK) the only server side logging framework that has ringbuffers out of the box. [3]
[1] https://tersesystems.github.io/terse-logback/guide/ringbuffer/ https://tersesystems.github.io/terse-logback/guide/ringbuffe...
[2] https://tersesystems.github.io/blindsight/usage/buffer.html https://tersesystems.github.io/blindsight/usage/buffer.html
[3] https://github.com/trentm/node-bunyan#raw--ringbuffer-stream https://github.com/trentm/node-bunyan#raw--ringbuffer-stream