Class ConsoleViewHandler

java.lang.Object
java.util.logging.Handler
org.yamcs.studio.core.ui.logging.ConsoleViewHandler

public class ConsoleViewHandler extends Handler
Log handler that displays messages in the Eclipse Console view.

The MessageConsoleStream description mentions buffering and appears thread-safe, but lockups have been observed if multiple threads try to access the console streams. This handler therefore logs in the UI thread, using the Display that was available on initialization. This is suitable for RCP, but not RAP.

  • Method Details

    • install

      public static ConsoleViewHandler install()
      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.

      Returns:
    • publish

      public void publish(LogRecord record)
      Specified by:
      publish in class Handler
    • flush

      public void flush()
      Specified by:
      flush in class Handler
    • close

      public void close() throws SecurityException
      Usually called by JRE when Logger shuts down, i.e. way after the Eclipse shutdown has already closed the console view
      Specified by:
      close in class Handler
      Throws:
      SecurityException