Package ptolemy.kernel.util
Class LoggerListener
- java.lang.Object
-
- ptolemy.kernel.util.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 voidclose()Close the file handler.voidevent(DebugEvent event)Send a string representation of the event to the log.voidlog(java.util.logging.Level level, java.lang.String message)Send the message to the log.voidmessage(java.lang.String message)Send the message to the log.
-
-
-
Constructor Detail
-
LoggerListener
public LoggerListener(java.lang.String name, java.io.File directory, java.util.logging.Level level) throws IllegalActionExceptionCreate 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 IllegalActionExceptionCreate 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 IllegalActionExceptionCreate 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:
eventin interfaceDebugListener- 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:
messagein interfaceDebugListener- Parameters:
message- The message.
-
-