FileDocCategorySizeDatePackage
OnlyOnceErrorHandler.javaAPI DocApache log4j 1.2.152733Sat Aug 25 00:09:40 BST 2007org.apache.log4j.helpers

OnlyOnceErrorHandler

public class OnlyOnceErrorHandler extends Object implements ErrorHandler
The OnlyOnceErrorHandler implements log4j's default error handling policy which consists of emitting a message for the first error in an appender and ignoring all following errors.

The error message is printed on System.err.

This policy aims at protecting an otherwise working application from being flooded with error messages when logging fails.

author
Ceki Gülcü
since
0.9.0

Fields Summary
final String
WARN_PREFIX
final String
ERROR_PREFIX
boolean
firstTime
Constructors Summary
Methods Summary
public voidactivateOptions()
No options to activate.

  
public voiderror(java.lang.String message, java.lang.Exception e, int errorCode)
Prints the message and the stack trace of the exception on System.err.

 
    error(message, e, errorCode, null);
  
public voiderror(java.lang.String message, java.lang.Exception e, int errorCode, org.apache.log4j.spi.LoggingEvent event)
Prints the message and the stack trace of the exception on System.err.

    if(firstTime) {
      LogLog.error(message, e);
      firstTime = false;
    }
  
public voiderror(java.lang.String message)
Print a the error message passed as parameter on System.err.

    if(firstTime) {
      LogLog.error(message);
      firstTime = false;
    }
  
public voidsetAppender(org.apache.log4j.Appender appender)
Does not do anything.

  
public voidsetBackupAppender(org.apache.log4j.Appender appender)
Does not do anything.

  
public voidsetLogger(org.apache.log4j.Logger logger)
Does not do anything.