public class OnlyOnceErrorHandler extends Object implements org.apache.log4j.spi.ErrorHandler
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 the specified print stream.
This policy aims at protecting an otherwise working application from being flooded with error messages when logging fails.
Constructor and Description |
---|
OnlyOnceErrorHandler() |
Modifier and Type | Method and Description |
---|---|
void |
activateOptions()
No options to activate.
|
void |
error(String message)
Print a the error message passed as parameter on
System.err . |
void |
error(String message,
Exception e,
int errorCode)
Prints the message and the stack trace of the exception on
System.err . |
void |
error(String message,
Exception e,
int errorCode,
org.apache.log4j.spi.LoggingEvent event)
Prints the message and the stack trace of the exception on
System.err . |
void |
setAppender(org.apache.log4j.Appender appender)
Does not do anything.
|
void |
setBackupAppender(org.apache.log4j.Appender appender)
Does not do anything.
|
void |
setLogger(org.apache.log4j.Logger logger)
Does not do anything.
|
static void |
setOutput(PrintStream out) |
public static void setOutput(PrintStream out)
public void setLogger(org.apache.log4j.Logger logger)
setLogger
in interface org.apache.log4j.spi.ErrorHandler
public void activateOptions()
activateOptions
in interface org.apache.log4j.spi.OptionHandler
public void error(String message, Exception e, int errorCode)
System.err
.error
in interface org.apache.log4j.spi.ErrorHandler
public void error(String message, Exception e, int errorCode, org.apache.log4j.spi.LoggingEvent event)
System.err
.error
in interface org.apache.log4j.spi.ErrorHandler
public void error(String message)
System.err
.error
in interface org.apache.log4j.spi.ErrorHandler
public void setAppender(org.apache.log4j.Appender appender)
setAppender
in interface org.apache.log4j.spi.ErrorHandler
public void setBackupAppender(org.apache.log4j.Appender appender)
setBackupAppender
in interface org.apache.log4j.spi.ErrorHandler
Copyright © 2012 JBoss, a division of Red Hat, Inc.. All Rights Reserved.