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/07/25 12:04:36 UTC

Notify if logging media runs out of space

Hi all,

In our application, if the (logging) media is full, the user should get
prompted to either replace the media or move logging to another drive.

I did write a custom errorhandler (see code snippet below). But it doesn't
seem to work - I might have done a silly mistake...

Any hints towards solving my problem are appreciated.

Donat


class LogFileErrorHandler implements org.apache.log4j.spi.ErrorHandler {

...

public void error(String message, Exception e, int errorCode) {

  if (e instanceof FileIOException) {
    // close the file first by removing the FileAppender
    LogManager.shutdown();
            
    // show message to change media
    ...
            
    // make sure a new and empty media has been inserted
    ...        
    
    // continue logging by reinitializing log4j
    log = Logger.getRootLogger();
    // add custom LogFileErrorHandler to all FileAppenders
    ...
  }

}


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>