You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by "Wullschleger, Donat" <Do...@siemens.co.uk> on 2002/08/01 09:48:04 UTC

RE: RollingFileAppender disk full handling

Colin,

I tried a similar thing with the DailyRollingFileAppender (or for test
purposes just with the FileAppender). My aim was to ask the user to replace
the media if it is full with a new one or choose another location for the
logfile. To detect an exception or another error condition, I did add a
custom errorhandler (as Kevin suggested). But I stumbled when I wanted to
close the logfile and open a new one afterwards - I just couldn't find a
solution as 'reset' and 'close' also close the logger (and not only the
file) and after calling these functions log4j issues errormessages on the
console...

If you get any further, I would appreciate to hearing from you. 

Donat

P.S. please find below a code fragment of how I added the custem
errorhandler (LogFileErrorHandler) to all FileAppenders.

// Add custom errorhandler to all FileAppenders
Enumeration eapp = LogManager.getRootLogger().getAllAppenders();
        
for (Enumeration e = eapp;e.hasMoreElements();) {
   Object obj = e.nextElement();
   if (obj instanceof FileAppender) {
       FileAppender fa = (FileAppender) obj;
       LogFileErrorHandler lfh = new LogFileErrorHandler();
       fa.setErrorHandler(lfh);
    }
}



-----Original Message-----
From: Kevin Steppe [mailto:ksteppe@pacbell.net]
Sent: Wednesday, July 31, 2002 9:35 PM
To: Log4J Users List
Subject: Re: RollingFileAppender disk full handling


Colin,
    log4j does not throw exceptions.  However, the RollingFileAppender 
-should- make calls to the errorHandler.  Implement your own 
ErrorHandler and you should be able to get those notifications.

Kevin


Colin MacDonald wrote:

>Hi all!  In my application, I need to know if log4j failed to write a log
>message.
>
>I'm using RollingFileAppender, and from looking at the source, it catches
>exceptions and just writes to console.  I'm writing transaction audit logs,
>so if I can't write to the log (disk full, or whatever) I want to abort the
>transaction.  Note that the log writing is done first; it doesn't need to
>part of an atomic transaction.
>
>First, is my reading of the code correct?  Will the code that calls log4j
>not get an exception?
>
>Second, any ideas on how to work around this?  Custom appender?  It seems
>like a waste to re-implement RollingFileAppender.
>
>Thanks for any help on this!
>
>-----------------------------------------------------------------
>Colin MacDonald  |  Software Developer  |  Templar Corporation  |
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.380 / Virus Database: 213 - Release Date: 7/24/2002
>
>
>--
>To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
>For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


This communication contains information which is confidential and may be
legally privileged and is for the exclusive use of the addressee(s). If you
are not a named addressee please contact the sender immediately, and delete
the communication from your system. You are hereby notified that any
disclosure, distribution or copying of this communication, in whole or in
part, is strictly prohibited.  Any views or opinions presented are solely
those of the author and do not necessarily represent those of the Company,
its directors or officers unless otherwise specifically stated. The Company
is not responsible for any reliance placed on the information contained
herein and excludes all liability. Any information / data received by the
Company in this communication may be retained and used for business purposes
in accordance with the Data Protection Act 1998 and consent for the same
shall be deemed given, unless specifically stated otherwise. 

(c)Copyright 2002 Siemens Metering Limited All Rights Reserved. 

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Are there any browser based configuration tools for log4j config files?

Posted by Eric Gilbertson <er...@pervasivesec.com>.
Log4J Users:

Anyone know of an browser based tool for the editing of XML based
log4j configuration files? Ideally this tool would provide a tree view of the
category hierarchy with the ability to modify appenders and category settings.
Searching the archives I did come across "configLog4j" (free download 
available
at www.jahpy.de/configLog4j), but this wasn't quite what I was looking for.

TIA,

Eric Gilbertson
ericg.gilbertson@pervasivesec.com



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: RollingFileAppender disk full handling

Posted by Colin MacDonald <co...@templarcorp.com>.
> -----Original Message-----
>
> My aim was to ask the user to replace
> the media if it is full with a new one or choose another location for the
> logfile.

Yeah, my case should be simpler than that.  If I can't write the log, I'll
probably just spit something to console and exit.

> To detect an exception or another error condition, I did add a
> custom errorhandler (as Kevin suggested).

I'll take a stab at that.  Thanks for the code snippet - that may well
simplify things for me.

Thanks!

-----------------------------------------------------------------
Colin MacDonald  |  Software Developer  |  Templar Corporation  |
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.380 / Virus Database: 213 - Release Date: 7/24/2002


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>