com.ebmwebsourcing.easycommons.logger.handler
Class ContextualFileHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by java.util.logging.StreamHandler
          extended by com.ebmwebsourcing.easycommons.logger.handler.ContextualFileHandler

public class ContextualFileHandler
extends java.util.logging.StreamHandler

Contextual file logging Handler.

The ContextualFileHandler writes the log records in different log files depending on the contextual information.

By default the SimpleFormatter class is used for formatting.

Configuration: By default each ContextualFileHandler is initialized using the following LogManager configuration properties. If properties are not defined (or have invalid values) then the specified default values are used.


Constructor Summary
  ContextualFileHandler()
          Construct a default ContextualFileHandler.
protected ContextualFileHandler(java.lang.String basedir, java.lang.String subdir, java.lang.String logFilename, java.util.Properties systemProperties)
           
 
Method Summary
protected static java.lang.String getStringProperty(java.lang.String name, java.lang.String defaultValue)
           
 void publish(java.util.logging.LogRecord record)
          This method overrides the method publish() of .
 
Methods inherited from class java.util.logging.StreamHandler
close, flush, isLoggable, setEncoding, setOutputStream
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, reportError, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContextualFileHandler

protected ContextualFileHandler(java.lang.String basedir,
                                java.lang.String subdir,
                                java.lang.String logFilename,
                                java.util.Properties systemProperties)

ContextualFileHandler

public ContextualFileHandler()
                      throws java.io.IOException,
                             com.ebmwebsourcing.easycommons.properties.PropertiesException
Construct a default ContextualFileHandler. This will be configured entirely from LogManager properties (or their default values).

Throws:
java.io.IOException - If the base directory is not set and a the temporary directory could not be created to write the logs
com.ebmwebsourcing.easycommons.properties.PropertiesException - If an error occurs when resolving a place holder in the base directory properties
Method Detail

publish

public void publish(java.util.logging.LogRecord record)
This method overrides the method publish() of . It gets the file to publish the log record by resolving the place holders present in the path pattern according the execution context before calling the method publish() of .

Overrides:
publish in class java.util.logging.StreamHandler

getStringProperty

protected static final java.lang.String getStringProperty(java.lang.String name,
                                                          java.lang.String defaultValue)


Copyright © 2012 Petals Link. All Rights Reserved.