Package org.apache.log4j.lf5
Class LF5Appender
- java.lang.Object
-
- org.apache.log4j.AppenderSkeleton
-
- org.apache.log4j.lf5.LF5Appender
-
- All Implemented Interfaces:
Appender,OptionHandler
public class LF5Appender extends AppenderSkeleton
LF5Appenderlogs events to a swing based logging console. The swing console supports turning categories on and off, multiple detail level views, as well as full text searching and many other capabilties.- Author:
- Brent Sprecher
-
-
Field Summary
Fields Modifier and Type Field Description protected static org.apache.log4j.lf5.viewer.LogBrokerMonitor_defaultLogMonitorprotected static AppenderFinalizer_finalizerprotected org.apache.log4j.lf5.viewer.LogBrokerMonitor_logMonitor-
Fields inherited from class org.apache.log4j.AppenderSkeleton
closed, errorHandler, headFilter, layout, name, tailFilter, threshold
-
-
Constructor Summary
Constructors Constructor Description LF5Appender()Constructs aLF5Appenderusing the default instance of theLogBrokerMonitor.LF5Appender(org.apache.log4j.lf5.viewer.LogBrokerMonitor monitor)Constructs aLF5Appenderusing an instance of aLogBrokerMonitorsupplied by the user.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(LoggingEvent event)Appends aLoggingEventrecord to theLF5Appender.voidclose()This method is an empty implementation of the close() method inherited from theorg.apache.log4j.Appenderinterface.booleanequals(LF5Appender compareTo)The equals method compares two LF5Appenders and determines whether they are equal.protected static org.apache.log4j.lf5.viewer.LogBrokerMonitorgetDefaultInstance()protected static intgetDefaultMonitorHeight()protected static intgetDefaultMonitorWidth()org.apache.log4j.lf5.viewer.LogBrokerMonitorgetLogBrokerMonitor()protected static intgetScreenHeight()protected static intgetScreenWidth()static voidmain(java.lang.String[] args)booleanrequiresLayout()Returns a value that indicates whether this appender requires aLayout.voidsetCallSystemExitOnClose(boolean callSystemExitOnClose)This method is used to set the property that controls whether theLogBrokerMonitoris hidden or closed when a user exits the monitor.voidsetMaxNumberOfRecords(int maxNumberOfRecords)-
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 Detail
-
_logMonitor
protected org.apache.log4j.lf5.viewer.LogBrokerMonitor _logMonitor
-
_defaultLogMonitor
protected static org.apache.log4j.lf5.viewer.LogBrokerMonitor _defaultLogMonitor
-
_finalizer
protected static AppenderFinalizer _finalizer
-
-
Constructor Detail
-
LF5Appender
public LF5Appender()
Constructs aLF5Appenderusing the default instance of theLogBrokerMonitor. This constructor shouldalways be preferred over theLF5Appender(LogBrokerMonitor monitor)constructor, unless you need to spawn additional log monitoring windows.
-
LF5Appender
public LF5Appender(org.apache.log4j.lf5.viewer.LogBrokerMonitor monitor)
Constructs aLF5Appenderusing an instance of aLogBrokerMonitorsupplied by the user. This constructor should only be used when you need to spawn additional log monitoring windows.- Parameters:
monitor- An instance of aLogBrokerMonitorcreated by the user.
-
-
Method Detail
-
append
public void append(LoggingEvent event)
Appends aLoggingEventrecord to theLF5Appender.- Specified by:
appendin classAppenderSkeleton- Parameters:
event- TheLoggingEventto be appended.
-
close
public void close()
This method is an empty implementation of the close() method inherited from theorg.apache.log4j.Appenderinterface.
-
requiresLayout
public boolean requiresLayout()
Returns a value that indicates whether this appender requires aLayout. This method always returns false. No layout is required for theLF5Appender.
-
setCallSystemExitOnClose
public void setCallSystemExitOnClose(boolean callSystemExitOnClose)
This method is used to set the property that controls whether theLogBrokerMonitoris hidden or closed when a user exits the monitor. By default, theLogBrokerMonitorwill hide itself when the log window is exited, and the swing thread will continue to run in the background. If this property is set to true, theLogBrokerMonitorwill call System.exit(0) and will shut down swing thread and the virtual machine.- Parameters:
callSystemExitOnClose- A boolean value indicating whether to call System.exit(0) when closing the log window.
-
equals
public boolean equals(LF5Appender compareTo)
The equals method compares two LF5Appenders and determines whether they are equal. TwoAppenderswill be considered equal if, and only if, they both contain references to the sameLogBrokerMonitor.- Parameters:
compareTo- A boolean value indicating whether the two LF5Appenders are equal.
-
getLogBrokerMonitor
public org.apache.log4j.lf5.viewer.LogBrokerMonitor getLogBrokerMonitor()
-
main
public static void main(java.lang.String[] args)
-
setMaxNumberOfRecords
public void setMaxNumberOfRecords(int maxNumberOfRecords)
-
getDefaultInstance
protected static org.apache.log4j.lf5.viewer.LogBrokerMonitor getDefaultInstance()
- Returns:
- The default instance of the
LogBrokerMonitor.
-
getScreenWidth
protected static int getScreenWidth()
- Returns:
- the screen width from Toolkit.getScreenSize() if possible, otherwise returns 800
- See Also:
Toolkit
-
getScreenHeight
protected static int getScreenHeight()
- Returns:
- the screen height from Toolkit.getScreenSize() if possible, otherwise returns 600
- See Also:
Toolkit
-
getDefaultMonitorWidth
protected static int getDefaultMonitorWidth()
-
getDefaultMonitorHeight
protected static int getDefaultMonitorHeight()
-
-