cz.cuni.amis.pogamut.base.utils.logging
Class LogPublisher

java.lang.Object
  extended by cz.cuni.amis.pogamut.base.utils.logging.LogPublisher
All Implemented Interfaces:
ILogPublisher
Direct Known Subclasses:
JMXLogPublisher, LogPublisher.ConsolePublisher, LogPublisher.FilePublisher, NetworkLogPublisher

public abstract class LogPublisher
extends java.lang.Object
implements ILogPublisher

Implementation for the ILogPublisher interface that contains a Formatter for the LogRecords.

As default SimpleFormatter from the java.logging API is used.

Contains two default implementations ConsolePublisher and FilePublisher.


Nested Class Summary
static class LogPublisher.ConsolePublisher
           
static class LogPublisher.FilePublisher
           
 
Field Summary
protected  java.util.logging.Formatter formatter
           
 
Constructor Summary
LogPublisher()
           
LogPublisher(java.util.logging.Formatter formatter)
           
LogPublisher(IAgentId name)
           
 
Method Summary
abstract  void close()
          From JavaDoc API:
abstract  void flush()
          From JavaDoc API:
 java.util.logging.Formatter getFormatter()
           
 void publish(java.util.logging.LogRecord record)
          From JavaDoc API:
abstract  void publish(java.util.logging.LogRecord record, java.lang.String formattedMsg)
           
 void setFormatter(java.util.logging.Formatter formatter)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

formatter

protected java.util.logging.Formatter formatter
Constructor Detail

LogPublisher

public LogPublisher()

LogPublisher

public LogPublisher(IAgentId name)

LogPublisher

public LogPublisher(java.util.logging.Formatter formatter)
Method Detail

getFormatter

public java.util.logging.Formatter getFormatter()

setFormatter

public void setFormatter(java.util.logging.Formatter formatter)

close

public abstract void close()
                    throws java.lang.SecurityException
Description copied from interface: ILogPublisher
From JavaDoc API:

Close the Handler and free all associated resources.

The close method will perform a flush and then close the Handler. After close has been called this Handler should no longer be used. Method calls may either be silently ignored or may throw runtime exceptions.

Specified by:
close in interface ILogPublisher
Throws:
java.lang.SecurityException - if a security manager exists and if the caller does not have LoggingPermission("control").

flush

public abstract void flush()
Description copied from interface: ILogPublisher
From JavaDoc API:

Flush any buffered output.

Specified by:
flush in interface ILogPublisher

publish

public abstract void publish(java.util.logging.LogRecord record,
                             java.lang.String formattedMsg)

publish

public void publish(java.util.logging.LogRecord record)
Description copied from interface: ILogPublisher
From JavaDoc API:

Publish a LogRecord.

The logging request was made initially to a Logger object, which initialized the LogRecord and forwarded it here.

The Handler is responsible for formatting the message, when and if necessary. The formatting should include localization.


Specified by:
publish in interface ILogPublisher
Parameters:
record - description of the log event. A null record is silently ignored and is not published