toolbox.services.util.logging.support
Class LoggingServiceHandler

Package class diagram package LoggingServiceHandler
java.lang.Object
  extended by java.util.logging.Handler
      extended by toolbox.services.util.logging.support.LoggingServiceHandler

public class LoggingServiceHandler
extends java.util.logging.Handler

A JDK logging handler implementation to facilitate interaction with the LoggingService from the standard java.util.logging package.

This handler will publish records to the logging service configured in the environment where this handler is used.

This handler supports the following configuration properties:


Constructor Summary
LoggingServiceHandler()
          Default constructor.
LoggingServiceHandler(java.lang.String registry, java.lang.String service, java.lang.String detailDelim)
          Construct this handler with the logging service configuration.
 
Method Summary
 void close()
          Not implemented.
 void flush()
          Not implemented.
 boolean isLoggable(java.util.logging.LogRecord record)
          Check to see if this Handler would actually log a given record.
 void publish(java.util.logging.LogRecord record)
          Publish the given LogRecord to the LoggingService.
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggingServiceHandler

public LoggingServiceHandler()
Default constructor. This constructor will configure the handler.


LoggingServiceHandler

public LoggingServiceHandler(java.lang.String registry,
                             java.lang.String service,
                             java.lang.String detailDelim)
Construct this handler with the logging service configuration.

Parameters:
registry - String contaiing the name of the registry where the logging service is configured.
service - String containing the name of the logging service instance to use.
detailDelim - String containing a simple delimiter that will be used to split log messages into parts.
Method Detail

publish

public void publish(java.util.logging.LogRecord record)
Publish the given LogRecord to the LoggingService.

This implementation transforms the LogRecord into a LogMessage and publishes the LogMessage using the configured LoggingService implementation.

Specified by:
publish in class java.util.logging.Handler
Parameters:
record - The LogRecord to publish.

isLoggable

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

This implementation checks to see whehter the member LoggingService was initialised correctly and ensures that level is not lower than Level.INFO. If these checks are successfully the parent check method is invoked for further verification.

Overrides:
isLoggable in class java.util.logging.Handler
Parameters:
record - The LogRecord to check.
Returns:
boolean indicating whether the record is loggable.

flush

public void flush()
Not implemented.

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

close

public void close()
Not implemented.

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