org.objectweb.util.monolog.wrapper.javaLog
Class Logger

java.lang.Object
  extended by java.util.logging.Logger
      extended by org.objectweb.util.monolog.wrapper.javaLog.Logger
All Implemented Interfaces:
Handler, Logger, TopicalLogger

public class Logger
extends Logger
implements TopicalLogger

Is an extension of the java.util.logging.Logger class used to wrap Monolog on the logging system provided in the JDK since the 1.4 version.

Author:
S.Chassande-Barrioz

Field Summary
protected  Logger inner
          This fieds is the real logger.
 
Fields inherited from class java.util.logging.Logger
global, GLOBAL_LOGGER_NAME
 
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
 
Constructor Summary
protected Logger(Logger inner)
          Builds a a Logger with an inner logger
protected Logger(String name, String resName)
          Builds a Logger without inner logger (==> inner = this)
 
Method Summary
 void addHandler(Handler handler)
           
 void addHandler(Handler h)
          A TopicalLogger manages a list of Handler instances.
 void addTopic(String topic)
          This method allows adding a topic to a TopicalLogger.
 boolean getAdditivity()
          It retrieves the additivity flag for this logger instance.
 Object getAttribute(String name)
          It retrieves the value of an attribute value of the handler.
 String[] getAttributeNames()
          It retrieves the attributes of the handler
 int getCurrentIntLevel()
           
 Level getCurrentLevel()
           
 Handler[] getHandler()
          Get the Handlers associated with this logger.
 Handler getHandler(String hn)
          It returns the handler which the name is equals to the parameter
 String[] getTopic()
          This method allows getting a topic list of this TopicalLogger.
 Enumeration getTopics()
          This method allows getting a topic list of this TopicalLogger.
 String getType()
          It retrieves the Handler type
 boolean isLoggable(int l)
           
 boolean isLoggable(Level l)
           
 boolean isOn()
           
 void log(int l, Object o)
           
 void log(int level, Object o, Object location, Object method)
           
 void log(int l, Object o, Throwable t)
           
 void log(int level, Object o, Throwable t, Object location, Object method)
           
 void log(Level l, Object o)
           
 void log(Level l, Object o, Object location, Object method)
           
 void log(Level l, Object o, Throwable t)
           
 void log(Level l, Object o, Throwable t, Object location, Object method)
           
 void removeAllHandlers()
          A TopicalLogger manages a list of Handler instances.
 void removeHandler(Handler h)
          A TopicalLogger manages a list of Handler instances.
 void removeTopic(String topic)
          This method allows removing a topic to a TopicalLogger.
 void setAdditivity(boolean a)
          It assigns the additivity flag for this logger instance.
 Object setAttribute(String name, Object value)
          It assigns an attributte to the handler.
 void setIntLevel(int level)
           
 void setLevel(Level l)
           
 void setName(String name)
          It assigns the name of the handler
 void turnOff()
           
 void turnOn()
           
 
Methods inherited from class java.util.logging.Logger
config, entering, entering, entering, exiting, exiting, fine, finer, finest, getAnonymousLogger, getAnonymousLogger, getFilter, getHandlers, getLevel, getLogger, getLogger, getName, getParent, getResourceBundle, getResourceBundleName, getUseParentHandlers, info, isLoggable, log, log, log, log, log, logp, logp, logp, logp, logrb, logrb, logrb, logrb, removeHandler, setFilter, setLevel, setParent, setUseParentHandlers, severe, throwing, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.objectweb.util.monolog.api.Handler
getName
 

Field Detail

inner

protected Logger inner
This fieds is the real logger. In some cases inner is equal to this.

Constructor Detail

Logger

protected Logger(Logger inner)
Builds a a Logger with an inner logger

Parameters:
inner - the real logger

Logger

protected Logger(String name,
                 String resName)
Builds a Logger without inner logger (==> inner = this)

Parameters:
name - is the loggerName
resName - is the resource bundle name
Method Detail

addHandler

public void addHandler(Handler handler)
Overrides:
addHandler in class Logger

setName

public void setName(String name)
It assigns the name of the handler

Specified by:
setName in interface Handler

getType

public String getType()
It retrieves the Handler type

Specified by:
getType in interface Handler

getAttributeNames

public String[] getAttributeNames()
It retrieves the attributes of the handler

Specified by:
getAttributeNames in interface Handler

getAttribute

public Object getAttribute(String name)
It retrieves the value of an attribute value of the handler.

Specified by:
getAttribute in interface Handler
Parameters:
name - is an attribute name

setAttribute

public Object setAttribute(String name,
                           Object value)
It assigns an attributte to the handler.

Specified by:
setAttribute in interface Handler
Parameters:
name - is the attribute name
value - is the attribute value
Returns:
the old value is the attribute was already defined

addHandler

public void addHandler(Handler h)
                throws 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

Specified by:
addHandler in interface TopicalLogger
Throws:
Exception

getHandler

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

Specified by:
getHandler in interface TopicalLogger
Parameters:
hn - is the handler name
Returns:
an Handler or a null value.

getHandler

public Handler[] getHandler()
Get the Handlers associated with this logger.

Specified by:
getHandler in interface TopicalLogger
Returns:
an array of all registered Handlers

removeHandler

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

Specified by:
removeHandler in interface TopicalLogger
Throws:
Exception

removeAllHandlers

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

Specified by:
removeAllHandlers in interface TopicalLogger
Throws:
Exception

setAdditivity

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

Specified by:
setAdditivity in interface TopicalLogger

getAdditivity

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

Specified by:
getAdditivity in interface TopicalLogger

addTopic

public void addTopic(String topic)
              throws 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.

Specified by:
addTopic in interface TopicalLogger
Throws:
Exception

getTopic

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

Specified by:
getTopic in interface TopicalLogger

getTopics

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

Specified by:
getTopics in interface TopicalLogger

removeTopic

public void removeTopic(String topic)
                 throws 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.

Specified by:
removeTopic in interface TopicalLogger
Throws:
Exception

setIntLevel

public void setIntLevel(int level)
Specified by:
setIntLevel in interface Logger

setLevel

public void setLevel(Level l)
Specified by:
setLevel in interface Logger

getCurrentIntLevel

public int getCurrentIntLevel()
Specified by:
getCurrentIntLevel in interface Logger

getCurrentLevel

public Level getCurrentLevel()
Specified by:
getCurrentLevel in interface Logger

isLoggable

public boolean isLoggable(int l)
Specified by:
isLoggable in interface Logger

isLoggable

public boolean isLoggable(Level l)
Specified by:
isLoggable in interface Logger

isOn

public boolean isOn()
Specified by:
isOn in interface Logger

log

public void log(int l,
                Object o)
Specified by:
log in interface Logger

log

public void log(Level l,
                Object o)
Specified by:
log in interface Logger

log

public void log(int l,
                Object o,
                Throwable t)
Specified by:
log in interface Logger

log

public void log(Level l,
                Object o,
                Throwable t)
Specified by:
log in interface Logger

log

public void log(int level,
                Object o,
                Object location,
                Object method)
Specified by:
log in interface Logger

log

public void log(Level l,
                Object o,
                Object location,
                Object method)
Specified by:
log in interface Logger

log

public void log(int level,
                Object o,
                Throwable t,
                Object location,
                Object method)
Specified by:
log in interface Logger

log

public void log(Level l,
                Object o,
                Throwable t,
                Object location,
                Object method)
Specified by:
log in interface Logger

turnOn

public void turnOn()
Specified by:
turnOn in interface Logger

turnOff

public void turnOff()
Specified by:
turnOff in interface Logger


Copyright © 2012 OW2 Consortium. All Rights Reserved.