org.csstudio.logging.ui
Class ConsoleViewHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by org.csstudio.logging.ui.ConsoleViewHandler

public class ConsoleViewHandler
extends java.util.logging.Handler

Log handler that displays messages in the Eclipse Console view.

Author:
Kay Kasemir, Alexander Will - Author of org.csstudio.platform.ui.internal.console.Console that was used with Log4j

Method Summary
static void addToLogger()
          Add console view to the (root) logger.
 void close()
          Usually called by JRE when Logger shuts down, i.e.
 void flush()
          
 void publish(java.util.logging.LogRecord record)
          
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

addToLogger

public static void addToLogger()
Add console view to the (root) logger.

To be called from Eclipse application's WorkbenchWindowAdvisor.postWindowCreate(). Calling it earlier is not possible because the necessary console view infrastructure is not available, yet.

Calling it much later means log messages are lost.

Only the first call has an effect. Subsequent calls as they can happen when opening multiple windows of the same Eclipse instance will have no effect.


publish

public void publish(java.util.logging.LogRecord record)

Specified by:
publish in class java.util.logging.Handler

flush

public void flush()

Specified by:
flush in class java.util.logging.Handler

close

public void close()
           throws java.lang.SecurityException
Usually called by JRE when Logger shuts down, i.e. way after the Eclipse shudown has already closed the console view

Specified by:
close in class java.util.logging.Handler
Throws:
java.lang.SecurityException