I'm looking into the idea of creating a new logger to hold log statements internally until an error occurs.
So in the system I'm working on, it is a sequence process (no parallel work, with a set start point and end point). I'd like to have my info() lines buffered in memory & at the end if an error occurs, flush them out, or if its a success then don't bother logging them.
I'm not too worried about memory use, its only 15 lines at a time (across several classes). But since it can process 100's of items a second(each creating 15 lines), the logging can become verbose with data that isn't that needed.
The other option it to log to one main file, which can be tailed. Then if an error occurs, flush the last buffer to an ERROR log.
Does anyone know of a SLF4J-LogWriter or LOG4J-Appender that does this already before I go creating my own?
I can see http://sling.apache.org (org.apache.sling.scripting.core.impl.LogWriter) already does something similar, but will probably required me to hack the code out.
Thanks Jeff Porter