Class TestAppender
- java.lang.Object
-
- org.apache.log4j.AppenderSkeleton
-
- org.apache.log4j.WriterAppender
-
- com.atlassian.confluence.impl.logging.log4j.appender.TestAppender
-
- All Implemented Interfaces:
org.apache.log4j.Appender
,org.apache.log4j.spi.OptionHandler
public class TestAppender extends org.apache.log4j.WriterAppender
-
-
Constructor Summary
Constructors Constructor Description TestAppender()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
activateOptions()
void
append(org.apache.log4j.spi.LoggingEvent loggingEvent)
void
close()
void
disableLogger(String className)
void
enableLogger(String className)
static @NonNull TestAppender
getInstance()
String
getLeastRecentMessageForLogger(String loggerName)
Gets the first unread message for the given loggerName.-
Methods inherited from class org.apache.log4j.WriterAppender
checkEntryConditions, closeWriter, createWriter, getEncoding, getImmediateFlush, requiresLayout, reset, setEncoding, setErrorHandler, setImmediateFlush, setWriter, shouldFlush, subAppend, writeFooter, writeHeader
-
-
-
-
Method Detail
-
enableLogger
public void enableLogger(String className)
-
disableLogger
public void disableLogger(String className)
-
getInstance
public static @NonNull TestAppender getInstance()
- Since:
- 7.14
-
activateOptions
public void activateOptions()
- Specified by:
activateOptions
in interfaceorg.apache.log4j.spi.OptionHandler
- Overrides:
activateOptions
in classorg.apache.log4j.WriterAppender
- Since:
- 7.14
-
close
public void close()
- Specified by:
close
in interfaceorg.apache.log4j.Appender
- Overrides:
close
in classorg.apache.log4j.WriterAppender
-
append
public void append(org.apache.log4j.spi.LoggingEvent loggingEvent)
- Overrides:
append
in classorg.apache.log4j.WriterAppender
-
getLeastRecentMessageForLogger
public String getLeastRecentMessageForLogger(String loggerName)
Gets the first unread message for the given loggerName. Returns null if no messages have been recorded against the specified logger since the last read.- Parameters:
loggerName
- logger to read message from- Returns:
- the first unread message, or null if no new messages
-
-