The default logs an error message once afaik.

unfortunately, in java there is no metod to detect the volume space remaining.


logging to console is very slow imho.   for a server this affects performance.




----- Original Message -----
From: "Keith Schomburg" <[EMAIL PROTECTED]>
To: "Log4J Users List" <[EMAIL PROTECTED]>
Sent: Wednesday, February 27, 2002 12:33 PM
Subject: RE: How may I catch an IOException when there disk space has run out
for a FileAppender?


> > -----Original Message-----
> > From: T Master [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, February 27, 2002 1:57 PM
> > To: Log4J Users List
> > Subject: Re: How may I catch an IOException when there disk space has
> > run out for a FileAppender?
> >
> >
> > Hi.
> >
> > I've not encountered the buffering.
> > When a log message cannot be written ( insufficient diskspace) then the
> > appenders errorHandler is invoked.
>
> I am presently not specifying my own error handler.  What does the
> default error handler do?
>
> >
> > I wrote my own to display the error msg to another specified
> > Appender only.
> > Trivial process.
> >
>
> This may be why you are not seeing the same behavior as I am
> related to messages being buffered until disk space is freed up.
>
> > It all depends on your logging policy.  Do you want to
> > auto-delete old log files to make space available?
> > In my case, all log files are important and must never be
> > auto-deleted by my application.
>
> I'm presently using the RollingFileAppender which will, after
> MaxBackupIndex is reached, throw away the oldest backup
> log file.  This works great until you run out of disk space :-)
>
> What would be nice is to specify some threshold such that
> if available disk space is detected to be at some level (e.g.
> less than 5% of available, less than 50MB, etc.) then switch
> over to an alternate Appender such as console until sufficient
> disk space is available to continue logging to a file.  This has
> the advantage of preventing your application from being the
> guilty party that used up the last remaining disk space and
> thus the one that caused other applications to fail due to
> insufficient disk space.  This is more of a proactive rather
> than reactive approach.
>
> >
> > Perhaps a backup volume could be specified.
> > Or auto-zipping of log files to make more space (though in the
> > end, all spcae
> > will still be used, and the memory requirements of zipping are a
> > lot imho);
> >
> > T Master
> >
> >
> > ----- Original Message -----
> > From: "Keith Schomburg" <[EMAIL PROTECTED]>
> > To: "Log4j" <[EMAIL PROTECTED]>
> > Sent: Wednesday, February 27, 2002 11:14 AM
> > Subject: RE: How may I catch an IOException when there disk space
> > has run out
> > for a FileAppender?
> >
> >
> > >
> > > What is the behavior of log4j when there is not more available disk
> > > space?  Will log4j buffer up messages until sufficient disk space
> > > is freed up or will it silently drop messages?
> > >
> > > We have recently run into this problem as well.  The behavior that
> > > appeared to be occurring was that messages that were unable to
> > > be logged due to insufficient disk space were buffered up and later
> > > written out when disk space was freed up.  If this is the actual
> > > behavior of log4j this seems a little dangerous in that it could then
> > > not only exhaust disk space but heap space as well due to buffered
> > > log messages.
> > >
> > > Keith
> > >
> > > > -----Original Message-----
> > > > From: Ceki Gülcü
> > > > Subject: Re: How may I catch an IOException when there disk
> > space has run
> > > > out for a FileAppender?
> > > > Date: Fri, 18 Jan 2002 15:39:52 -0800
> > > >
> > > > T Master,
> > > >
> > > > Have you considered ErrorHandlers? You can atttach an ErrorHandler
> > > > to any appender. See for example FallbackErrorHandler.
> > > >
> > > > http://jakarta.apache.org/log4j/docs/api/org/apache/log4j/varia/Fa
> > > > llbackErro
> > > > rHandler.html
> > > >
> > > > Regards, Ceki
> > > >
> > > > ps: My name is Ceki not Ceiki. Thank you.
> > > >
> > > > At 14:18 18.01.2002 -0700, you wrote:
> > > > >Ceiki,
> > > > >
> > > > >Do you have an answer for the problem below?
> > > > >
> > > > >If there was a listener allowed, then I could change the file paths
> > > > >(assuming i had a spare disk to use).
> > > > >
> > > > >T Master.
> > > > >
> > > > >
> > > > >----- Original Message -----
> > > > >From: "T Master" <[EMAIL PROTECTED]>
> > > > >To: <[EMAIL PROTECTED]>
> > > > >Sent: Thursday, January 17, 2002 6:32 PM
> > > > >Subject: How may I catch an IOException when there disk
> > space has run out
> > > > >for a FileAppender?
> > > > >
> > > > >
> > > > >> 1. How may I catch an exception thrown when there disk space
> > > > has run out
> > > > >for
> > > > >> a FileAppender?
> > > > >>
> > > > >> 2.  It would be nice to register a listener (imho) for
> > when diskspace
> > > > runs
> > > > >> out.
> > > > >>
> > > > >>
> > > > >>
> > > > >> Console Output  from such a scenario:
> > > > >>
> > > > >> log4j:ERROR Failed to flush writer,
> > > > >> java.io.IOException: There is not enough space on the disk
> > > > >>         at java.io.FileOutputStream.writeBytes(Native Method)
> > > > >>         at
> > java.io.FileOutputStream.write(FileOutputStream.java:212)
> > > > >>         at
> > > > >> java.io.OutputStreamWriter.flushBuffer(OutputStreamWriter.java:230)
> > > > >>         at
> > > > java.io.OutputStreamWriter.flush(OutputStreamWriter.java:244)
> > > > >>         at
> > > > org.apache.log4j.helpers.QuietWriter.flush(QuietWriter.java:49)
> > > > >>         at
> > > > >> org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:309)
> > > > >>         at
> > > > >>
> > org.apache.log4j.RollingFileAppender.subAppend(RollingFileAppender.ja
> > > > >> va:294)
> > > > >>         at
> > > > org.apache.log4j.WriterAppender.append(WriterAppender.java:157)
> > > > >>         at
> > > > >>
> > org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:251)
> > > > >>
> > > > >>         at
> > > > >>
> > org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders
> > > > >> (AppenderAttachableImpl.java:57)
> > > > >>         at
> > org.apache.log4j.Category.callAppenders(Category.java:255)
> > > > >>         at org.apache.log4j.Category.forcedLog(Category.java:445)
> > > > >>         at org.apache.log4j.Category.info(Category.java:704)
> > > > >>
> > > > >>
> > > > >> --
> > > > >> To unsubscribe, e-mail:
> > > > ><mailto:[EMAIL PROTECTED]>
> > > > >> For additional commands, e-mail:
> > > > ><mailto:[EMAIL PROTECTED]>
> > > > >>
> > > > >
> > > > >
> > > > >--
> > > > >To unsubscribe, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > > >For additional commands, e-mail:
> > > > <mailto:[EMAIL PROTECTED]>
> > > >
> > > > --
> > > > Ceki Gülcü - http://qos.ch
> > > >
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > <mailto:[EMAIL PROTECTED]>
> > > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:[EMAIL PROTECTED]>
> > For additional commands, e-mail:
> <mailto:[EMAIL PROTECTED]>
> >
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
> --
> To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to