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

java.lang.Object
  extended by java.util.logging.Handler
      extended by org.objectweb.util.monolog.wrapper.javaLog.GenericHandler
All Implemented Interfaces:
Handler
Direct Known Subclasses:
JMXGenericHandler

public class GenericHandler
extends java.util.logging.Handler
implements Handler

Is a generic handler implementation used to wrapper java.util.logging.Handler instance.

Author:
S.Chassande-Barrioz

Field Summary
 java.util.logging.Handler handler
          The real handler
protected  java.lang.String name
          The name of the handler
protected  java.lang.String type
          the type of the handler (see org.objectweb.util.monolog.api.Handler for the possible values)
 
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
GenericHandler()
           
GenericHandler(java.lang.String name)
           
GenericHandler(java.lang.String name, java.util.logging.Handler h)
          builds a generic handler since a real handler.
GenericHandler(java.lang.String name, java.lang.String type)
          Builds a generic handler with its name and the type.
 
Method Summary
 void close()
          Close the Handler and free all associated resources.
 void flush()
          Flush any buffered output.
 java.lang.Object getAttribute(java.lang.String name)
          It retrieves the value of an attribute value of the handler.
 java.lang.String[] getAttributeNames()
          It retrieves the attributes of the handler
 java.lang.String getEncoding()
          Return the character encoding for this Handler.
 java.util.logging.Filter getFilter()
          Get the current Filter for this Handler.
 java.util.logging.Formatter getFormatter()
          Return the Formatter for this Handler.
 java.util.logging.Level getLevel()
          Get the log level specifying which messages will be logged by this Handler.
 java.lang.String getName()
          It retrieves the name of the handler
 java.lang.String getType()
          It retrieves the Handler type
 boolean isLoggable(java.util.logging.LogRecord record)
          Check if this Handler would actually log a given LogRecord.
 void publish(java.util.logging.LogRecord record)
          Publish a LogRecord.
 java.lang.Object setAttribute(java.lang.String _name, java.lang.Object value)
          It assigns an attributte to the handler.
 void setEncoding(java.lang.String encoding)
          Set the character encoding used by this Handler.
protected  void setException(java.lang.Exception exception)
          Set the most recent IO exception.
 void setFilter(java.util.logging.Filter newFilter)
          Set a Filter to control output on this Handler.
 void setFormatter(java.util.logging.Formatter newFormatter)
          Set a Formatter.
 void setLevel(java.util.logging.Level newLevel)
          Set the log level specifying which message levels will be logged by this Handler.
 void setName(java.lang.String name)
          It assigns the name of the handler
 
Methods inherited from class java.util.logging.Handler
getErrorManager, reportError, setErrorManager
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

handler

public java.util.logging.Handler handler
The real handler


type

protected java.lang.String type
the type of the handler (see org.objectweb.util.monolog.api.Handler for the possible values)


name

protected java.lang.String name
The name of the handler

Constructor Detail

GenericHandler

public GenericHandler()

GenericHandler

public GenericHandler(java.lang.String name)

GenericHandler

public GenericHandler(java.lang.String name,
                      java.lang.String type)
Builds a generic handler with its name and the type. The real handler will be instanciated after the configuration step.

Parameters:
name - is the name of the handler
type - is the type of the handler

GenericHandler

public GenericHandler(java.lang.String name,
                      java.util.logging.Handler h)
builds a generic handler since a real handler.

Parameters:
name - is the name of the handler
h - is the real handler
Method Detail

getName

public java.lang.String getName()
It retrieves the name of the handler

Specified by:
getName in interface Handler

setName

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

Specified by:
setName in interface Handler

getType

public java.lang.String getType()
It retrieves the Handler type

Specified by:
getType in interface Handler

getAttributeNames

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

Specified by:
getAttributeNames in interface Handler

getAttribute

public java.lang.Object getAttribute(java.lang.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 java.lang.Object setAttribute(java.lang.String _name,
                                     java.lang.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

close

public void close()
Close the Handler and free all associated resources.

Specified by:
close in class java.util.logging.Handler

flush

public void flush()
Flush any buffered output.

Specified by:
flush in class java.util.logging.Handler

getEncoding

public java.lang.String getEncoding()
Return the character encoding for this Handler.

Overrides:
getEncoding in class java.util.logging.Handler

getFilter

public java.util.logging.Filter getFilter()
Get the current Filter for this Handler.

Overrides:
getFilter in class java.util.logging.Handler

getFormatter

public java.util.logging.Formatter getFormatter()
Return the Formatter for this Handler.

Overrides:
getFormatter in class java.util.logging.Handler

getLevel

public java.util.logging.Level getLevel()
Get the log level specifying which messages will be logged by this Handler.

Overrides:
getLevel in class java.util.logging.Handler

isLoggable

public boolean isLoggable(java.util.logging.LogRecord record)
Check if this Handler would actually log a given LogRecord.

Overrides:
isLoggable in class java.util.logging.Handler

publish

public void publish(java.util.logging.LogRecord record)
Publish a LogRecord.

Specified by:
publish in class java.util.logging.Handler

setEncoding

public void setEncoding(java.lang.String encoding)
                 throws java.lang.SecurityException,
                        java.io.UnsupportedEncodingException
Set the character encoding used by this Handler.

Overrides:
setEncoding in class java.util.logging.Handler
Throws:
java.lang.SecurityException
java.io.UnsupportedEncodingException

setException

protected void setException(java.lang.Exception exception)
Set the most recent IO exception.


setFilter

public void setFilter(java.util.logging.Filter newFilter)
Set a Filter to control output on this Handler.

Overrides:
setFilter in class java.util.logging.Handler

setFormatter

public void setFormatter(java.util.logging.Formatter newFormatter)
Set a Formatter.

Overrides:
setFormatter in class java.util.logging.Handler

setLevel

public void setLevel(java.util.logging.Level newLevel)
Set the log level specifying which message levels will be logged by this Handler.

Overrides:
setLevel in class java.util.logging.Handler