|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.tomgibara.pronto.logging.LoggingConfig
public abstract class LoggingConfig
This class provides the basis for the convenient reconfiguration of Java's
java.util.logging framework. A single instance of the class's
default implementation is available via the getInstance
method, through which the object's policy can configuration can be set. In
addition, the class provides the functionality to force a reconfiguration at
any time.
The properties provided by the configuration are entirely compatible with those detailed in the documentation for the Java logging framework. However, class does provide some convenient extra behaviour. It allows packages, handler class-names, formatter class-names and filter class-names to be abbreviated:
$package are taken to define
a package abbreviation. These abbreviations are only expanded where they
occur at the start of a logging-property key.$handler are taken to define
a handler abbreviation. These abbreviations are only expanded where they
occur in a ".handlers" property value.$formatter are taken to
define a formatter abbreviation. These abbreviations are only expanded where
they occur in a ".formatter" property value.filter are taken to define a
filter abbreviation. These abbreviations are only expanded where they occur
in a ".filter" property value.For example, the following logging configuration extract:
$package.app = com.sample.app
$handler.simple = app.SimpleHandler
$formatter.db = app.JDBCFormatter
app.SimpleHandler.formatter = db
app.level = INFO
app.package.level = FINE
app.package.handler = simple
Is equivalent to:
com.sample.app.SimpleHandler.formatter = com.sample.app.JDBCFormatter
com.sample.app.level = INFO
com.sample.app.package.level = FINE
com.sample.app.package.handler = simple
The implementation specifies a small number of default definitions that serve to standardize the names of built-in logging classes, they are currently:
$handler.console=java.util.logging.ConsoleHandler
$handler.file=java.util.logging.FileHandler
$handler.socket=java.util.logging.SocketHandler
Because the logging configuration is layered atop the
java.util.logging package it inherits all of its deficiencies:
no per-logger handler configuration and no dynamic adjustment of logger
handlers to name just two.
| Constructor Summary | |
|---|---|
LoggingConfig()
|
|
| Method Summary | |
|---|---|
static LoggingConfig |
getInstance()
Should be called to obtain a LoggingConfig instance. |
abstract LoggingPolicy |
getPolicy()
The policy currently in use by this object. |
abstract com.tomgibara.pronto.config.ConfigSource |
getSource()
The current source of configuration properties. |
abstract void |
setPolicy(LoggingPolicy policy)
Sets the policy for this object. |
abstract void |
setSource(com.tomgibara.pronto.config.ConfigSource source)
Sets the source of configuration properties for this object. |
abstract void |
update()
Causes the logging to be reconfigured immediately with the properties from the current configuration source. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LoggingConfig()
| Method Detail |
|---|
public static LoggingConfig getInstance()
throws com.tomgibara.pronto.core.ProntoException
LoggingConfig instance. This
method provides access to control logging configuration in the Pronto
framework.
com.tomgibara.pronto.core.ProntoException - if the instance could not be createdpublic abstract void setPolicy(LoggingPolicy policy)
policy - the policy to be used for this object, or nullpublic abstract LoggingPolicy getPolicy()
public abstract void setSource(com.tomgibara.pronto.config.ConfigSource source)
throws ProntoLoggingException
source - the source of configuration information for the logging
ProntoLoggingException - if reconfiguration of the logging failedpublic abstract com.tomgibara.pronto.config.ConfigSource getSource()
public abstract void update()
throws ProntoLoggingException
ProntoLoggingException - if reconfiguration of the logging failed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||