Class LoggerListener

  • All Implemented Interfaces:
    DebugListener

    public class LoggerListener
    extends java.lang.Object
    implements DebugListener
    A debug listener that sends messages using Java's Logger API.
    Since:
    Ptolemy II 10.0
    Version:
    $Id$
    Author:
    Edward A. Lee
    Pt.AcceptedRating:
    Red (cxh)
    Pt.ProposedRating:
    Yellow (eal)
    • Constructor Summary

      Constructors 
      Constructor Description
      LoggerListener​(java.lang.String name)
      Create a logger.
      LoggerListener​(java.lang.String name, java.io.File directory)
      Create a logger.
      LoggerListener​(java.lang.String name, java.io.File directory, java.util.logging.Level level)
      Create a logger.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close the file handler.
      void event​(DebugEvent event)
      Send a string representation of the event to the log.
      void log​(java.util.logging.Level level, java.lang.String message)
      Send the message to the log.
      void message​(java.lang.String message)
      Send the message to the log.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • LoggerListener

        public LoggerListener​(java.lang.String name,
                              java.io.File directory,
                              java.util.logging.Level level)
                       throws IllegalActionException
        Create a logger.
        Parameters:
        name - The name for this logger. This should normally be a fully qualified classname or full name of the object being listened to.
        directory - The directory in which to store the log file, or null to use the system temporary directory.
        level - The logger level.
        Throws:
        IllegalActionException - If the log file cannot be opened.
      • LoggerListener

        public LoggerListener​(java.lang.String name,
                              java.io.File directory)
                       throws IllegalActionException
        Create a logger. This constructor creates a logger that logs all messages, and stores the log in system temporary directory (where ever that is).
        Parameters:
        name - The name for this logger. This should normally be a fully qualified classname or full name of the object being listened to.
        directory - The directory in which to store the log file, or null to use the system temporary directory.
        Throws:
        IllegalActionException - If the log file cannot be opened.
      • LoggerListener

        public LoggerListener​(java.lang.String name)
                       throws IllegalActionException
        Create a logger. This constructor creates a logger that logs all messages, and stores the log in system temporary directory (whereever that is).
        Parameters:
        name - The name for this logger. This should normally be a fully qualified classname or full name of the object being listened to.
        Throws:
        IllegalActionException - If the log file cannot be opened.
    • Method Detail

      • close

        public void close()
        Close the file handler.
      • event

        public void event​(DebugEvent event)
        Send a string representation of the event to the log.
        Specified by:
        event in interface DebugListener
        Parameters:
        event - The event.
      • log

        public void log​(java.util.logging.Level level,
                        java.lang.String message)
        Send the message to the log.
        Parameters:
        level - The level of the message.
        message - The message.
      • message

        public void message​(java.lang.String message)
        Send the message to the log.
        Specified by:
        message in interface DebugListener
        Parameters:
        message - The message.