Details
-
Improvement
-
Resolution: Duplicate
-
Minor
-
None
-
None
-
None
-
Operating System: Linux
Platform: PC
-
151
Description
Have appender implement the java.io.Flushable interface, or a logback-specific interface if preferred, so that we can call Appender.flush() to manually flush the appender's writer. Not all appenders would have this, only those that implement Flushable.
This would be useful in the context where buffered IO is used, but we still want to ensure a flush is made at specific intervals. For instance, in development I create a Spring bean that listens to application events, and force-flushes logback after each http request has been processed by my application, ensuring that I always see all the error logs when something fails.
I have accomplished by subclassing RollingFileAppender to implement Flushable, quite simply like this:
public void flush() throws IOException
Attachments
Issue Links
- duplicates
-
LOGBACK-271 introduce FlushableAppender
- Resolved