Class JLoggerFactory


public final class JLoggerFactory
extends java.lang.Object

This class can create a JLogger, and return it. If the specified JLogger already exist, then it is returned. Moreover, there is a configuration methods, that allow you to easely create logger and log manager, and setting log level, without recompile your source code. Since 0.2.4, it also contains the list of already instancied formatter and output. This is to prevent from multiple output to access to the same resource (file or networking port).

CARTAPANIS Alexandre <>

Field Summary
private static Configurator configurator
          The configurator tool.
private static java.util.HashSet formatters
          The set of formatter.
private static java.util.Hashtable loggers
          The list of logger.
private static java.util.HashSet outputs
          The set of output.
static java.lang.String VERSION
          The JLogger current version, as a String.
Constructor Summary
private JLoggerFactory()
          The default constructor.
Method Summary
static void configure(java.lang.String _fileName)
          Allows you to specify you're configuration file to load.
static Configurator getConfigurator()
          Returns the current configurator tool.
static JLogger getLogger(java.lang.String _name)
          Returns a new Logger, with a specified name.
 java.lang.String getVersion()
          Returns the version of JLogger.
private static void init()
          Initializes the JLoggerFactory.
static void setConfigurator(Configurator _configurator)
          Changes the configuration tool to use.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail


private static java.util.Hashtable loggers
The list of logger.


private static java.util.HashSet outputs
The set of output.


private static java.util.HashSet formatters
The set of formatter.


private static Configurator configurator
The configurator tool.


public static final java.lang.String VERSION
The JLogger current version, as a String.

See Also:
Constant Field Values
Constructor Detail


private JLoggerFactory()
The default constructor. Forbids direct instanciation.

Method Detail


public static final JLogger getLogger(java.lang.String _name)
Returns a new Logger, with a specified name. If a logger with a such name already exist, then it is returned. Else, a new logger is created.

_name - The logger name.
Logger - The new logger.
See Also:


private static final void init()
Initializes the JLoggerFactory. It first load the default configuration file, that is the Jar file and where you cannot access. Then it analyse the 'jlogger.xml' file that is the same directory than the 'JLogger.jar' library file. This method is called at the creation of the factory, and if you want to use you're own configuration class or file, use the setConfigurator and configure(String) methods.

See Also:
setConfigurator(Configurator), configure(String)


public static final void setConfigurator(Configurator _configurator)
Changes the configuration tool to use.

_configurator - The configurator to use.


public static final Configurator getConfigurator()
Returns the current configurator tool.

Configurator - The Configurator.


public static final void configure(java.lang.String _fileName)
Allows you to specify you're configuration file to load. The format of this file depend of the configurator that is set. By default, it is XML, but you can change it using the setConfigurator method.

_fileName - The configuration file.
See Also:
setConfigurator(Configurator), Configurator


public java.lang.String getVersion()
Returns the version of JLogger.

String - The current JLogger version.

Copyright 2002 CARTAPANIS Alexandre
This page was last updated on May 10 2003