Package com.jalios.jcms.plugin
Class PluginAppender
java.lang.Object
org.apache.log4j.AppenderSkeleton
com.jalios.jcms.plugin.PluginAppender
- All Implemented Interfaces:
org.apache.log4j.Appender,org.apache.log4j.spi.OptionHandler
public class PluginAppender
extends org.apache.log4j.AppenderSkeleton
A log4j appender that keeps from 5 to 500 LoggingEvent inside a list for each plugins.
It does not need any layout.
It does not need any layout.
<appender name="JCMS" class="com.jalios.jcms.tools.PluginAppender"> <param name="MaximumEventNbr" value="20"/> </appender>
- Since:
- jcms-5.7.0
- Author:
- Jean-Philippe Encausse
-
Field Summary
FieldsFields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappend(org.apache.log4j.spi.LoggingEvent event) voidclose()static PluginAppenderReturn the lastPluginAppenderinstance that was created.getLoggedEventList(String pluginName) Returns a copy of the last logged events matching the given plugin.intReturns the current value of the MaximumEvent option.booleanvoidsetMaximumEventNbr(int size) The MaximumEventNbr option takes a integer between 5 and 500.Methods inherited from class org.apache.log4j.AppenderSkeleton
activateOptions, addFilter, clearFilters, doAppend, finalize, getErrorHandler, getFilter, getFirstFilter, getLayout, getName, getThreshold, isAsSevereAsThreshold, setErrorHandler, setLayout, setName, setThreshold
-
Field Details
-
PREFIX
- See Also:
-
pluginMap
-
-
Constructor Details
-
PluginAppender
public PluginAppender()
-
-
Method Details
-
getLastInstanceCreated
Return the lastPluginAppenderinstance that was created.- Returns:
- a
PluginAppenderinstance or null if noPluginAppenderwas build
-
getLoggedEventList
Returns a copy of the last logged events matching the given plugin.- Parameters:
pluginName- the name of the plugin- Returns:
- a new LinkedList of org.apache.log4j.spi.LoggingEvent, the most recent being the first one.
-
setMaximumEventNbr
public void setMaximumEventNbr(int size) The MaximumEventNbr option takes a integer between 5 and 500. This integer value determines the maximum number of event kept by this appender. -
getMaximumEventNbr
public int getMaximumEventNbr()Returns the current value of the MaximumEvent option. -
append
protected void append(org.apache.log4j.spi.LoggingEvent event) - Specified by:
appendin classorg.apache.log4j.AppenderSkeleton
-
requiresLayout
public boolean requiresLayout() -
close
public void close()
-