logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jacob L. Anawalt" <janaw...@geckosoftware.com>
Subject Re: File system full causes log4cxx to crash
Date Mon, 22 Sep 2008 19:38:51 GMT
On 2008-09-20 11:37, Peter Steele wrote:
> We've experienced several cases of our logging volume becoming full
> during the course of execution of our application. What we would like to
> happen in this case is simply to lose any log further messages that are
> written after the file system becomes full

I wanted to know what would happen to my programs using log4cxx (0.9.7) in this 
case so I wrote a couple of test apps and created a 1MiB block file and mounted 
it as a loop device in /mnt.

First I tried a simple C app using open and blocking write to see what happens. 
By picking a buffer size of 8096 I was able to see full writes, a partial write 
and then an error with perror reporting 'No space left on device'. My code exits 
the loop at this point.

Next I tried a simple C++ log4cxx app that writes to the disk and console via a 
"MyApp" logger. After it fill the disk the app continues to work and continues 
to write to the console. Since the writer is ofstream based, I imagine the bad 
bit was set and further writes just get skipped.

Looking at FileOutputStream::write in svn head I see that if apr_file_write 
doesn't return APR_SUCCESS, it throws an IOException with the write call's 
status. I am not familar enough with the code to see who/what should catch that, 
but to work like 0.9.7 I'd expect it to be caught at some appropriate level to 
disable that particular appender. (Maybe in WriterAppender::append?) If the 
exception is not caught perhaps it is the crash you see.

-- 
Jacob Anawalt
Gecko Software, Inc.
janawalt@geckosoftware.com
435-752-8026

Mime
View raw message