org.objectweb.util.monolog.wrapper.javaLog

Class GenericHandler

Implemented Interfaces:
Handler

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 String
name
The name of the handler
protected 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, LEVEL_ATTRIBUTE, LOGGER_HANDLER_TYPE, MAX_SIZE_ATTRIBUTE, OUTPUT_ATTRIBUTE, PATTERN_ATTRIBUTE, ROLLING_FILE_HANDLER_TYPE

Constructor Summary

GenericHandler()
GenericHandler(String name)
GenericHandler(String name, String type)
Builds a generic handler with its name and the type.
GenericHandler(String name, java.util.logging.Handler h)
builds a generic handler since a real handler.

Method Summary

void
close()
Close the Handler and free all associated resources.
void
flush()
Flush any buffered output.
Object
getAttribute(String name)
It retrieves the value of an attribute value of the handler.
String[]
getAttributeNames()
It retrieves the attributes of the handler
String
getEncoding()
Return the character encoding for this Handler.
Filter
getFilter()
Get the current Filter for this Handler.
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.
String
getName()
It retrieves the name of the handler
String
getType()
It retrieves the Handler type
boolean
isLoggable(LogRecord record)
Check if this Handler would actually log a given LogRecord.
void
publish(LogRecord record)
Publish a LogRecord.
Object
setAttribute(String _name, Object value)
It assigns an attributte to the handler.
void
setEncoding(String encoding)
Set the character encoding used by this Handler.
protected void
setException(Exception exception)
Set the most recent IO exception.
void
setFilter(Filter newFilter)
Set a Filter to control output on this Handler.
void
setFormatter(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(String name)
It assigns the name of the handler

Field Details

handler

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


name

protected String name
The name of the handler


type

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

Constructor Details

GenericHandler

public GenericHandler()


GenericHandler

public GenericHandler(String name)


GenericHandler

public GenericHandler(String name,
                      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(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 Details

close

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


flush

public void flush()
Flush any buffered output.


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


getAttributeNames

public String[] getAttributeNames()
It retrieves the attributes of the handler
Specified by:
getAttributeNames in interface Handler


getEncoding

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


getFilter

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


getFormatter

public Formatter getFormatter()
Return the Formatter for this Handler.


getLevel

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


getName

public String getName()
It retrieves the name of the handler
Specified by:
getName in interface Handler


getType

public String getType()
It retrieves the Handler type
Specified by:
getType in interface Handler


isLoggable

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


publish

public void publish(LogRecord record)
Publish a LogRecord.


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


setEncoding

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


setException

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


setFilter

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


setFormatter

public void setFormatter(Formatter newFormatter)
Set a Formatter.


setLevel

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


setName

public void setName(String name)
It assigns the name of the handler
Specified by:
setName in interface Handler