Known Direct Subclasses
OneShotLogger |
An Log4J logger wrapper than will only log 1 times After maxTimes number of calls
the logger silently discards thee logging output. |
|
Class Overview
An Log4J logger wrapper than will only log N times. After maxTimes number of calls
the logger silently discards the logging output.
The logging is done via a delegate Logger
You might use it a bit like this
private static final Logger log = Logger.getLogger(MyObject.class);
private final Logger oneShotParseErrorLog = new NShotLogger(log,1);
...
...
if (parseErrorOnSomethingThatWeOnlywanToReportOnce == true) {
oneShotParseErrorLog.log("Things seem quite screwy in your config");
}
Note that the logger is not static. If the object in question is a PICO managed singleton
then you will want to use a non static so that the logger will log again if the PICO world is
torn down and brought back up again.
Summary
Public Constructors |
|
NShotLogger(Logger delegateLogger, int maxTimes)
Creates a NShotLogger that will only output log data if it has been called maxTimes or less.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
|
Public Constructors
public
NShotLogger
(Logger delegateLogger, int maxTimes)
Creates a NShotLogger that will only output log data if it has been called maxTimes or less.
Parameters
delegateLogger
| the delegate Logger that will do the actual logging |
maxTimes
| the maximum number of times that the logger can output logging data. |
Public Methods
public
Logger
getDelegateLogger
()
Returns
- the underlying delegate Logger
public
boolean
isDebugEnabled
()
public
boolean
isEnabledFor
(Priority priority)
public
boolean
isInfoEnabled
()