| Method from org.apache.log4j.lf5.LF5Appender Detail: |
public void append(LoggingEvent event) {
// Retrieve the information from the log4j LoggingEvent.
String category = event.getLoggerName();
String logMessage = event.getRenderedMessage();
String nestedDiagnosticContext = event.getNDC();
String threadDescription = event.getThreadName();
String level = event.getLevel().toString();
long time = event.timeStamp;
LocationInfo locationInfo = event.getLocationInformation();
// Add the logging event information to a LogRecord
Log4JLogRecord record = new Log4JLogRecord();
record.setCategory(category);
record.setMessage(logMessage);
record.setLocation(locationInfo.fullInfo);
record.setMillis(time);
record.setThreadDescription(threadDescription);
if (nestedDiagnosticContext != null) {
record.setNDC(nestedDiagnosticContext);
} else {
record.setNDC("");
}
if (event.getThrowableInformation() != null) {
record.setThrownStackTrace(event.getThrowableInformation());
}
try {
record.setLevel(LogLevel.valueOf(level));
} catch (LogLevelFormatException e) {
// If the priority level doesn't match one of the predefined
// log levels, then set the level to warning.
record.setLevel(LogLevel.WARN);
}
if (_logMonitor != null) {
_logMonitor.addMessage(record);
}
}
Appends a LoggingEvent record to the
LF5Appender. |
public void close() {
}
This method is an empty implementation of the close() method inherited
from the org.apache.log4j.Appender interface. |
public boolean equals(LF5Appender compareTo) {
// If both reference the same LogBrokerMonitor, they are equal.
return _logMonitor == compareTo.getLogBrokerMonitor();
}
The equals method compares two LF5Appenders and determines whether
they are equal. Two Appenders will be considered equal
if, and only if, they both contain references to the same
LogBrokerMonitor. |
protected static synchronized LogBrokerMonitor getDefaultInstance() {
if (_defaultLogMonitor == null) {
try {
_defaultLogMonitor =
new LogBrokerMonitor(LogLevel.getLog4JLevels());
_finalizer = new AppenderFinalizer(_defaultLogMonitor);
_defaultLogMonitor.setFrameSize(getDefaultMonitorWidth(),
getDefaultMonitorHeight());
_defaultLogMonitor.setFontSize(12);
_defaultLogMonitor.show();
} catch (SecurityException e) {
_defaultLogMonitor = null;
}
}
return _defaultLogMonitor;
}
|
protected static int getDefaultMonitorHeight() {
return (3 * getScreenHeight()) / 4;
}
|
protected static int getDefaultMonitorWidth() {
return (3 * getScreenWidth()) / 4;
}
|
public LogBrokerMonitor getLogBrokerMonitor() {
return _logMonitor;
}
|
protected static int getScreenHeight() {
try {
return Toolkit.getDefaultToolkit().getScreenSize().height;
} catch (Throwable t) {
return 600;
}
}
|
protected static int getScreenWidth() {
try {
return Toolkit.getDefaultToolkit().getScreenSize().width;
} catch (Throwable t) {
return 800;
}
}
|
public static void main(String[] args) {
new LF5Appender();
}
|
public boolean requiresLayout() {
return false;
}
Returns a value that indicates whether this appender requires a
Layout. This method always returns false.
No layout is required for the LF5Appender. |
public void setCallSystemExitOnClose(boolean callSystemExitOnClose) {
_logMonitor.setCallSystemExitOnClose(callSystemExitOnClose);
}
This method is used to set the property that controls whether
the LogBrokerMonitor is hidden or closed when a user
exits
the monitor. By default, the LogBrokerMonitor will 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, the LogBrokerMonitor will call System.exit(0)
and will shut down swing thread and the virtual machine. |
public void setMaxNumberOfRecords(int maxNumberOfRecords) {
_defaultLogMonitor.setMaxNumberOfLogRecords(maxNumberOfRecords);
}
|