Package com.jalios.jcms.tools
Class JCMSAppender
- java.lang.Object
-
- org.apache.log4j.AppenderSkeleton
-
- com.jalios.jcms.tools.JCMSAppender
-
- All Implemented Interfaces:
org.apache.log4j.Appender,org.apache.log4j.spi.OptionHandler
public class JCMSAppender extends org.apache.log4j.AppenderSkeletonA log4j appender that keeps from 5 to 500 LoggingEvent inside a list.
It does not need any layout.
<appender name="JCMS" class="com.jalios.jcms.tools.JCMSAppender"> <param name="MaximumEventNbr" value="20"/> </appender>
- Since:
- jcms-5.5
- Author:
- Olivier Jaquemet
-
-
Constructor Summary
Constructors Constructor Description JCMSAppender()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidappend(org.apache.log4j.spi.LoggingEvent event)voidclose()static JCMSAppendergetLastInstanceCreated()Return the lastJCMSAppenderinstance that was created.java.util.ListgetLoggedEventList()Returns a copy of the last logged events.java.util.ListgetLoggedEventList(org.apache.log4j.Level level)Returns a copy of the last logged events matching the given Level.intgetMaximumEventNbr()Returns the current value of the MaximumEvent option.booleanrequiresLayout()voidsetMaximumEventNbr(int size)The MaximumEventNbr option takes a integer between 5 and 500.
-
-
-
Method Detail
-
getLastInstanceCreated
public static JCMSAppender getLastInstanceCreated()
Return the lastJCMSAppenderinstance that was created.- Returns:
- a
JCMSAppenderinstance or null if noJCMSAppenderwas build
-
getLoggedEventList
public java.util.List getLoggedEventList()
Returns a copy of the last logged events.- Returns:
- a new LinkedList of org.apache.log4j.spi.LoggingEvent, the most recent being the first one.
-
getLoggedEventList
public java.util.List getLoggedEventList(org.apache.log4j.Level level)
Returns a copy of the last logged events matching the given Level.- 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()
-
-