net.sourceforge.acelogger.factory
Class LoggerFactory

java.lang.Object
  extended by net.sourceforge.acelogger.factory.LoggerFactory

public final class LoggerFactory
extends Object

Factory for managing instances of configured loggers.

Since:
1.0.0
Version:
1.0.0
Author:
Zardi (https://sourceforge.net/users/daniel_zardi)

Method Summary
static Logger getDefaultLogger()
          Returns the default logger of this factory, the one used when no logger is found for a given identifier.
static Logger getLogger()
          Obtains a properly configured logger based in the callers class information.
static Logger getLogger(Class<?> clazz)
          Obtains a properly configured logger for the given class.
static Logger getLogger(String identifier)
          Obtains a properly configured logger for the given identifier.
static List<Logger> getRegisteredLoggers()
          Returns a list of all loggers registered in this factory.
static Logger registerLogger(Logger logger)
          Registers an appender within this factory.
static Logger setDefaultLogger(Logger defaultLogger)
          Sets the default logger of this factory, the one used when no logger is found for a given identifier.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getLogger

public static Logger getLogger(String identifier)
Obtains a properly configured logger for the given identifier.

Parameters:
identifier - The identifier of the intended logger.
Returns:
A properly configured logger for the given identifier. If the identifier is not found, then the default logger is returned.
Since:
1.0.0
See Also:
getDefaultLogger()

getLogger

public static Logger getLogger(Class<?> clazz)
Obtains a properly configured logger for the given class.

Parameters:
clazz - The class that will generate the logger identifier.
Returns:
A properly configured logger for the given identifier. If the identifier is not found, then the default logger is returned.
Since:
1.0.0
See Also:
getDefaultLogger()

getLogger

public static Logger getLogger()
Obtains a properly configured logger based in the callers class information.

Returns:
A properly configured logger for the given identifier. If the identifier is not found, then the default logger is returned.
Since:
1.0.0
See Also:
getDefaultLogger(), CodeFrameResolver.getCodeFrame()

setDefaultLogger

public static Logger setDefaultLogger(Logger defaultLogger)
Sets the default logger of this factory, the one used when no logger is found for a given identifier.

Parameters:
defaultLogger - The logger that will be used as the default one from now.
Returns:
The previous default logger.
Since:
1.0.0

getDefaultLogger

public static Logger getDefaultLogger()
Returns the default logger of this factory, the one used when no logger is found for a given identifier.

Returns:
The default logger.
Since:
1.0.0

getRegisteredLoggers

public static List<Logger> getRegisteredLoggers()
Returns a list of all loggers registered in this factory.

Returns:
A list of loggers.
Since:
1.0.0

registerLogger

public static Logger registerLogger(Logger logger)
Registers an appender within this factory. The mapped identifier will be the loggers identifier.

Parameters:
logger - The logger to be registered.
Returns:
The default logger if there was no previous mapping for the identifier or the previous configured logger otherwise.
Since:
1.0.0
See Also:
getDefaultLogger()


Copyright © 2007-2010 The AceLogger Team. All Rights Reserved.