FileAppender and flushing

In a very simple intro-style prototype using logback, I've got a rolling file appender logging correctly to a file. However, I don't see the log lines immediately; however, they do show up when I close my java app. This means things are getting buffered. But I can't find something like Logger.flush() or any flush method as a work my way back up the inheritance tree. How do I ensure immediate flushing? Thanks.

Doug, The file appender does a flush after every line, so I'm not sure why this behaviour occurs. My theory is that the file is being written to just fine, but windows (you are on windows right?) doesn't notice the changes and does notify tail programs. Try a reloading he log file in a text editor and you'll see it updating fine. David On 5 Jul 2011, at 21:10, "Beyer, Doug" <doug.beyer@troppussoftware.com> wrote:
In a very simple intro-style prototype using logback, I’ve got a rolling file appender logging correctly to a file.
However, I don’t see the log lines immediately; however, they do show up when I close my java app. This means things are getting buffered.
But I can’t find something like Logger.flush() or any flush method as a work my way back up the inheritance tree.
How do I ensure immediate flushing?
Thanks.
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user

I can confirm that this is an issue on windows where the last modified timestamp does not get updated properly (while the outputstream is open). The size does change though, so checking for last modified + size should get you all the taily goodness. On 8 July 2011 12:22, David Roussel <nabble@diroussel.xsmail.com> wrote:
Doug,
The file appender does a flush after every line, so I'm not sure why this behaviour occurs. My theory is that the file is being written to just fine, but windows (you are on windows right?) doesn't notice the changes and does notify tail programs. Try a reloading he log file in a text editor and you'll see it updating fine.
David
On 5 Jul 2011, at 21:10, "Beyer, Doug" <doug.beyer@troppussoftware.com> wrote:
In a very simple intro-style prototype using logback, I’ve got a rolling file appender logging correctly to a file.****
** **
However, I don’t see the log lines immediately; however, they do show up when I close my java app. This means things are getting buffered.****
** **
But I can’t find something like Logger.flush() or any flush method as a work my way back up the inheritance tree.****
** **
How do I ensure immediate flushing?****
** **
Thanks.****
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
_______________________________________________ Logback-user mailing list Logback-user@qos.ch http://qos.ch/mailman/listinfo/logback-user
participants (3)
-
Alex Vb
-
Beyer, Doug
-
David Roussel