org.geotoolkit.util.logging
Class LoggerAdapter

Object
  extended by Logger
      extended by LoggerAdapter
          extended by LoggerAdapter

Deprecated. Moved to Apache SIS as LoggerAdapter

@Deprecated
public abstract class LoggerAdapter
extends LoggerAdapter

An adapter that redirect all Java logging events to an other logging framework. This class redefines the severe, warning, info, config, fine, finer and finest methods as abstract ones. Subclasses should implement those methods in order to map Java logging levels to the backend logging framework.

All log methods are overridden in order to redirect to one of the above-cited methods. Note that this is the opposite approach than the Java logging framework one, which implements everything on top of Logger.log(LogRecord). This adapter is defined in terms of severefinest methods instead because external frameworks like Commons-logging don't work with LogRecord, and sometime provides nothing else than convenience methods equivalent to severefinest.


Restrictions
Because the configuration is expected to be fully controlled by the external logging framework, every configuration methods inherited from Logger are disabled:

Since LoggerAdapters do not hold any configuration by themselves, it is not strictly necessary to add them to the log manager. The adapters can be created, garbage-collected and recreated again while preserving their behavior since their configuration is entirely contained in the external logging framework.


Localization
This logger is always created without resource bundles. Localizations must be performed through explicit calls to logrb or LoggerAdapter.log(LogRecord) methods. This is sufficient for Geotk needs, which performs all localizations through the later. Note that those methods will be slower in this LoggerAdapter than the default Logger because this adapter localizes and formats records immediately instead of letting the Handler performs this work only if needed.


Logging levels
If a log record level is not one of the predefined ones, then this class maps to the first level below the specified one. For example if a log record has some level between FINE and FINER, then the finer method will be invoked. See LoggerAdapter.isLoggable(java.util.logging.Level) for implementation tips taking advantage of this rule.

Since:
2.4
Version:
3.00
Author:
Martin Desruisseaux (IRD)
See Also:
Logging
Module:
utility/geotk-utility (download)    View source code for this class

Field Summary
 
Fields inherited from class Logger
global, GLOBAL_LOGGER_NAME
 
Constructor Summary
protected LoggerAdapter(String name)
          Deprecated. Creates a new logger.
 
Method Summary
 
Methods inherited from class LoggerAdapter
addHandler, config, entering, entering, entering, exiting, exiting, fine, finer, finest, getDebugLevel, getLevel, info, isLoggable, log, log, log, log, log, logp, logp, logp, logp, logrb, logrb, logrb, logrb, removeHandler, setFilter, setLevel, setParent, setUseParentHandlers, severe, throwing, warning
 
Methods inherited from class Logger
getAnonymousLogger, getAnonymousLogger, getFilter, getHandlers, getLogger, getLogger, getName, getParent, getResourceBundle, getResourceBundleName, getUseParentHandlers
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoggerAdapter

protected LoggerAdapter(String name)
Deprecated. 
Creates a new logger.

Parameters:
name - The logger name.


Copyright © 2009-2013 Geotoolkit.org. All Rights Reserved.