I have a web application that dumps logging information in a file using log4j RollingFileAppender. The application is currently configured to dump only WARN and higher logging information so that the disk I/O do not impact performance on the server.
However, I would like to know the last X debug information when an error occurs. Is there a way to configure log4j to dump the last 25 lines of debug information, as well as the error, in a file?
I presume this can be done using a custom appender. I tried searching for an example and could not find one.