Methods Summary |
---|
public void | activateOptions()Derived appenders should override this method if option structure
requires it.
|
public void | addFilter(org.apache.log4j.spi.Filter newFilter)Add a filter to end of the filter list.
if(headFilter == null) {
headFilter = tailFilter = newFilter;
} else {
tailFilter.setNext(newFilter);
tailFilter = newFilter;
}
|
protected abstract void | append(org.apache.log4j.spi.LoggingEvent event)Subclasses of AppenderSkeleton should implement this
method to perform actual logging. See also {@link #doAppend
AppenderSkeleton.doAppend} method.
|
public void | clearFilters()Clear the filters chain.
headFilter = tailFilter = null;
|
public synchronized void | doAppend(org.apache.log4j.spi.LoggingEvent event)This method performs threshold checks and invokes filters before
delegating actual logging to the subclasses specific {@link
AppenderSkeleton#append} method.
if(closed) {
LogLog.error("Attempted to append to closed appender named ["+name+"].");
return;
}
if(!isAsSevereAsThreshold(event.getLevel())) {
return;
}
Filter f = this.headFilter;
FILTER_LOOP:
while(f != null) {
switch(f.decide(event)) {
case Filter.DENY: return;
case Filter.ACCEPT: break FILTER_LOOP;
case Filter.NEUTRAL: f = f.getNext();
}
}
this.append(event);
|
public void | finalize()Finalize this appender by calling the derived class'
close method.
// An appender might be closed then garbage collected. There is no
// point in closing twice.
if(this.closed)
return;
LogLog.debug("Finalizing appender named ["+name+"].");
close();
|
public org.apache.log4j.spi.ErrorHandler | getErrorHandler()Return the currently set {@link ErrorHandler} for this
Appender.
return this.errorHandler;
|
public org.apache.log4j.spi.Filter | getFilter()Returns the head Filter.
return headFilter;
|
public final org.apache.log4j.spi.Filter | getFirstFilter()Return the first filter in the filter chain for this
Appender. The return value may be null if no is
filter is set.
return headFilter;
|
public org.apache.log4j.Layout | getLayout()Returns the layout of this appender. The value may be null.
return layout;
|
public final java.lang.String | getName()Returns the name of this FileAppender.
return this.name;
|
public org.apache.log4j.Priority | getThreshold()Returns this appenders threshold level. See the {@link
#setThreshold} method for the meaning of this option.
return threshold;
|
public boolean | isAsSevereAsThreshold(org.apache.log4j.Priority priority)Check whether the message level is below the appender's
threshold. If there is no threshold set, then the return value is
always true .
return ((threshold == null) || priority.isGreaterOrEqual(threshold));
|
public synchronized void | setErrorHandler(org.apache.log4j.spi.ErrorHandler eh)Set the {@link ErrorHandler} for this Appender.
if(eh == null) {
// We do not throw exception here since the cause is probably a
// bad config file.
LogLog.warn("You have tried to set a null error-handler.");
} else {
this.errorHandler = eh;
}
|
public void | setLayout(org.apache.log4j.Layout layout)Set the layout for this appender. Note that some appenders have
their own (fixed) layouts or do not use one. For example, the
{@link org.apache.log4j.net.SocketAppender} ignores the layout set
here.
this.layout = layout;
|
public void | setName(java.lang.String name)Set the name of this Appender.
this.name = name;
|
public void | setThreshold(org.apache.log4j.Priority threshold)Set the threshold level. All log events with lower level
than the threshold level are ignored by the appender.
In configuration files this option is specified by setting the
value of the Threshold option to a level
string, such as "DEBUG", "INFO" and so on.
this.threshold = threshold;
|