net.directj.jlogger
Class JLoggerFactory

java.lang.Object
  |
  +--net.directj.jlogger.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).

Version:
0.2.4
Author:
CARTAPANIS Alexandre <earendil@jprolog.net>

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

loggers

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


outputs

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


formatters

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


configurator

private static Configurator configurator
The configurator tool.


VERSION

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

See Also:
Constant Field Values
Constructor Detail

JLoggerFactory

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

Method Detail

getLogger

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.

Parameters:
_name - The logger name.
Returns:
Logger - The new logger.
See Also:
JLogger

init

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)

setConfigurator

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

Parameters:
_configurator - The configurator to use.

getConfigurator

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

Returns:
Configurator - The Configurator.

configure

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.

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

getVersion

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

Returns:
String - The current JLogger version.


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