be.ugent.caagt.swirl.logging

Class JListLogHandler


public class JListLogHandler
extends Handler

Log handler which outputs its log records to a JList, where new records end up at the top.

The simplest way to use this class is by adding the following statement to the start of the application

    JListLogHandler.createDialog ("Log window", "");
 
This will make a window pop up with all logged messages, as soon as a message of a sufficiently high level (a warning, by default) is sent to the loggin system.

Configuration: By default the handler is initialized using the following LogManager configuration properties.

Constructor Summary

JListLogHandler(JList jlist)
Create a log handler which shall send its output to the given list.

Method Summary

void
close()
static JDialog
createLoggingDialog(String title, String loggerName)
Create a dialog which contains a list which is handled by a new handler, registered to the named logger of the application (use the empty string for the root logger).
protected void
drawAttention()
Draw attention to the logging window.
void
flush()
Level
getPopupLevel()
Retrieve the popup log level, i.e., the minimum level for which the handler will try to draw the attention of the user by sounding a beep, making the parent window of the list visible and moving it to the front.
void
publish(LogRecord record)
void
setPopupLevel(Level popupLevel)
Set the popup log level.

Constructor Details

JListLogHandler

public JListLogHandler(JList jlist)
Create a log handler which shall send its output to the given list.

Method Details

close

public void close()
            throws SecurityException

createLoggingDialog

public static JDialog createLoggingDialog(String title,
                                          String loggerName)
Create a dialog which contains a list which is handled by a new handler, registered to the named logger of the application (use the empty string for the root logger). Initially this dialog is not visible to the application.

drawAttention

protected void drawAttention()
Draw attention to the logging window.

flush

public void flush()

getPopupLevel

public Level getPopupLevel()
Retrieve the popup log level, i.e., the minimum level for which the handler will try to draw the attention of the user by sounding a beep, making the parent window of the list visible and moving it to the front.

publish

public void publish(LogRecord record)

setPopupLevel

public final void setPopupLevel(Level popupLevel)
Set the popup log level.