Class LogMonitorAdapter
- java.lang.Object
-
- org.apache.log4j.lf5.util.LogMonitorAdapter
-
public class LogMonitorAdapter extends java.lang.ObjectLogMonitorAdapter facilitates the usage of the LogMonitor
-
-
Field Summary
Fields Modifier and Type Field Description private LogLevel_defaultLevelprivate LogBrokerMonitor_logMonitorstatic intJDK14_LOG_LEVELSstatic intLOG4J_LOG_LEVELS
-
Constructor Summary
Constructors Modifier Constructor Description privateLogMonitorAdapter(java.util.List userDefinedLevels)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddMessage(LogRecord record)Adds a LogRecord to the LogMonitor.LogLevelgetDefaultLevel()Gets the default LogLevel for the Adapter.protected static intgetDefaultMonitorHeight()protected static intgetDefaultMonitorWidth()protected static intgetScreenHeight()protected static intgetScreenWidth()LogLevelgetSevereLevel()Gets the current Severe LogLevelvoidlog(java.lang.String category, java.lang.String message)Log a message to the Monitor and use the default LogLevel.voidlog(java.lang.String category, LogLevel level, java.lang.String message)Log a message to the Monitor.voidlog(java.lang.String category, LogLevel level, java.lang.String message, java.lang.String NDC)Log a message to the Monitor.voidlog(java.lang.String category, LogLevel level, java.lang.String message, java.lang.Throwable t)Log a message to the Monitor.voidlog(java.lang.String category, LogLevel level, java.lang.String message, java.lang.Throwable t, java.lang.String NDC)Log a complete message to the Monitor.static LogMonitorAdapternewInstance(int loglevels)Creates an instance of LogMonitorAdapter using the log levels inticated by the parameter.static LogMonitorAdapternewInstance(java.util.List userDefinedLevels)Creates an instance of LogMonitorAdapter using the specified LogLevels.static LogMonitorAdapternewInstance(LogLevel[] userDefined)Creates an instance of LogMonitorAdapter using the specified LogLevels.voidsetDefaultLevel(LogLevel level)Set the default log level to be used when logging messages without specifying a LogLevel.voidsetMaxNumberOfRecords(int maxNumberOfRecords)Set the maximum number of records to be displayed in the monitorvoidsetSevereLevel(LogLevel level)Sets the Severe LogLevel.
-
-
-
Field Detail
-
LOG4J_LOG_LEVELS
public static final int LOG4J_LOG_LEVELS
- See Also:
- Constant Field Values
-
JDK14_LOG_LEVELS
public static final int JDK14_LOG_LEVELS
- See Also:
- Constant Field Values
-
_logMonitor
private LogBrokerMonitor _logMonitor
-
_defaultLevel
private LogLevel _defaultLevel
-
-
Method Detail
-
newInstance
public static LogMonitorAdapter newInstance(int loglevels)
Creates an instance of LogMonitorAdapter using the log levels inticated by the parameter. Log4J and JDK1.4 both have default LogLevels which are set but these levels can be overriden.
- Parameters:
loglevels- An integer representing either Log4J or JDK1.4 logging levels- Returns:
- LogMonitorAdapter
-
newInstance
public static LogMonitorAdapter newInstance(LogLevel[] userDefined)
Creates an instance of LogMonitorAdapter using the specified LogLevels. The first LogLevel in the array is used as the default LogLevel unless changed using the setDefaultLevel method.
- Parameters:
userDefined- An array of user defined LogLevel objects.- Returns:
- LogMonitorAdapter
-
newInstance
public static LogMonitorAdapter newInstance(java.util.List userDefinedLevels)
Creates an instance of LogMonitorAdapter using the specified LogLevels. The first LogLevel in the List is used as the default LogLevel unless changed using the setDefaultLevel method.
- Parameters:
userDefinedLevels- A list of user defined LogLevel objects.- Returns:
- LogMonitorAdapter
-
addMessage
public void addMessage(LogRecord record)
Adds a LogRecord to the LogMonitor.
- Parameters:
record- The LogRecord object to be logged in the logging monitor.
-
setMaxNumberOfRecords
public void setMaxNumberOfRecords(int maxNumberOfRecords)
Set the maximum number of records to be displayed in the monitor
- Parameters:
maxNumberOfRecords-
-
setDefaultLevel
public void setDefaultLevel(LogLevel level)
Set the default log level to be used when logging messages without specifying a LogLevel.
- Parameters:
level-
-
getDefaultLevel
public LogLevel getDefaultLevel()
Gets the default LogLevel for the Adapter.
- Returns:
- LogLevel
-
setSevereLevel
public void setSevereLevel(LogLevel level)
Sets the Severe LogLevel.
- Parameters:
level-
-
getSevereLevel
public LogLevel getSevereLevel()
Gets the current Severe LogLevel
- Returns:
- LogLevel
-
log
public void log(java.lang.String category, LogLevel level, java.lang.String message, java.lang.Throwable t, java.lang.String NDC)Log a complete message to the Monitor.
- Parameters:
category- The category to be usedlevel- The log level to apply to the messagemessage- The messaget- The throwable content of the messageNDC- The NDC really only applies to Log4J and the parameter can usually be ignored.
-
log
public void log(java.lang.String category, java.lang.String message)Log a message to the Monitor and use the default LogLevel.
- Parameters:
category- The category to be usedmessage- The message
-
log
public void log(java.lang.String category, LogLevel level, java.lang.String message, java.lang.String NDC)Log a message to the Monitor.
- Parameters:
category- The category to be usedlevel- The log level to apply to the messagemessage- The messageNDC-
-
log
public void log(java.lang.String category, LogLevel level, java.lang.String message, java.lang.Throwable t)Log a message to the Monitor.
- Parameters:
category- The category to be usedlevel- The log level to apply to the messagemessage- The messaget- The throwable content of the message
-
log
public void log(java.lang.String category, LogLevel level, java.lang.String message)Log a message to the Monitor.
- Parameters:
category- The category to be usedlevel- The log level to apply to the messagemessage- The message
-
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()
-
-