org.objectweb.util.monolog.api
Interface TopicalLogger

All Superinterfaces:
Handler, Logger
All Known Implementing Classes:
BasicLogger, Logger, LoggerImpl, MonologCategory, MonologCategory

public interface TopicalLogger
extends Logger

A TopicalLogger dispatches events to a set of Handlers. A TopicalLogger is a sort of message router.

A topic is associated with each TopicalLogger. A topic is represented by a dotted string, which is used to build a hierarchical namespace. The latter should typically be aligned with the Java packaging namespace.

The name hierarchy of TopicalLogger allows adding properties inheritance. For example, a TopicalLogger with the "a.b.c" name can inherit of the Handlers list and the level from the "a.b" parent.

Another property for a TopicalLogger is the capacity to have several topics. This is important when a component is used by several other components. This will allow events logged by the shared component to appear for each component using this shared component. A consequence of this property is that a Logger may have several parents

The additivity flag indicates if the current TopicalLogger inherits the handlers of its parents. The default value is true.


Field Summary
 
Fields inherited from interface org.objectweb.util.monolog.api.Handler
APPEND_MODE_ATTRIBUTE, BUFFER_ATTRIBUTE, CONSOLE_HANDLER_TYPE, FILE_HANDLER_TYPE, FILE_NUMBER_ATTRIBUTE, GENERIC_HANDLER_TYPE, JMX_HANDLER_TYPE, LEVEL_ATTRIBUTE, LOGGER_HANDLER_TYPE, MAX_SIZE_ATTRIBUTE, OUTPUT_ATTRIBUTE, PATTERN_ATTRIBUTE, ROLLING_FILE_HANDLER_TYPE
 
Method Summary
 void addHandler(Handler h)
          A TopicalLogger manages a list of Handler instances.
 void addTopic(java.lang.String topic)
          This method allows adding a topic to a TopicalLogger.
 boolean getAdditivity()
          It retrieves the additivity flag for this logger instance.
 Handler[] getHandler()
          It returns the list of the handler associated to this logger.
 Handler getHandler(java.lang.String hn)
          It returns the handler which the name is equals to the parameter
 java.lang.String[] getTopic()
          This method allows getting a topic list of this TopicalLogger.
 java.util.Enumeration getTopics()
          This method allows getting a topic list of this TopicalLogger.
 void removeAllHandlers()
          A TopicalLogger manages a list of Handler instances.
 void removeHandler(Handler h)
          A TopicalLogger manages a list of Handler instances.
 void removeTopic(java.lang.String topic)
          This method allows removing a topic to a TopicalLogger.
 void setAdditivity(boolean a)
          It assigns the additivity flag for this logger instance.
 
Methods inherited from interface org.objectweb.util.monolog.api.Logger
getCurrentIntLevel, getCurrentLevel, isLoggable, isLoggable, isOn, log, log, log, log, log, log, log, log, setIntLevel, setLevel, turnOff, turnOn
 
Methods inherited from interface org.objectweb.util.monolog.api.Handler
getAttribute, getAttributeNames, getName, getType, setAttribute, setName
 

Method Detail

addHandler

public void addHandler(Handler h)
                throws java.lang.Exception
A TopicalLogger manages a list of Handler instances. This method allows adding a handler to this list. The addHandler method returns true only if the Handler did not exist

Throws:
java.lang.Exception

getHandler

public Handler[] getHandler()
It returns the list of the handler associated to this logger.

Returns:
an array of Handler or an empty array.

getHandler

public Handler getHandler(java.lang.String hn)
It returns the handler which the name is equals to the parameter

Returns:
an Handler or a null value.

removeHandler

public void removeHandler(Handler h)
                   throws java.lang.Exception
A TopicalLogger manages a list of Handler instances. This method allows removing a handler to this list.

Throws:
java.lang.Exception

removeAllHandlers

public void removeAllHandlers()
                       throws java.lang.Exception
A TopicalLogger manages a list of Handler instances. This method allows removing all handler.

Throws:
java.lang.Exception

setAdditivity

public void setAdditivity(boolean a)
It assigns the additivity flag for this logger instance.


getAdditivity

public boolean getAdditivity()
It retrieves the additivity flag for this logger instance.


addTopic

public void addTopic(java.lang.String topic)
              throws java.lang.Exception
This method allows adding a topic to a TopicalLogger. This actions change the hierarchical structure, but also the list of handlers. The list of handlers of a TopicalLogger is composed of its handlers and all handlers inherited from its parents. Adding a topic changes the inherited handlers list.

Throws:
java.lang.Exception

getTopic

public java.lang.String[] getTopic()
This method allows getting a topic list of this TopicalLogger.


getTopics

public java.util.Enumeration getTopics()
This method allows getting a topic list of this TopicalLogger. Only kept for the backward compatibility.


removeTopic

public void removeTopic(java.lang.String topic)
                 throws java.lang.Exception
This method allows removing a topic to a TopicalLogger. This actions change the hierarchical structure, but also the list of handlers. The list of handlers of a TopicalLogger is composed of its handlers and all handlers inherited from its parents. Removing a topic changes the inherited handlers list.

Throws:
java.lang.Exception