com.sdm.quasar.client.core.common.logging
Class LogManager

java.lang.Object
  extended bycom.sdm.quasar.client.core.common.logging.LogManager

public class LogManager
extends java.lang.Object

Creates Logger implementations.

This factory acts as a facade for LoggerConfiguration, which is interface of the adapter implementation to the actual logging framework used.

This factory will be initialized by calling #initialize(java.lang.String) once. If this initializiation is not made, all calls to logging will use the SimpleConsoleLoggerFactory and the SimpleConsoleLogger, and the logging level debug will be enabled.

Version:
1.0
Author:
Carsten Lucke, sd&m AG, Bernd Olleck, sd&m AG

Method Summary
static void addLogHandler(LogHandler logHandler)
          Adds a LogHandler to this LogManager.
static CallerInformation calculateCallerInformation(int correctStackDepth, java.lang.String loggerDomainName)
          Calculates the CallerInformation, about the caller of the logging call.
static LogHandler getLogHandler(int loggingLevel, CallerInformation callerInformation)
          Returns the LogHandler implementation responsible for the given logging level and class name.
static java.lang.String loglevel2String(int level)
          Converts the log-level into a human-readable string.
static void removeLogHandler(LogHandler logHandler)
          Removes a previously registered LogHandler.
static void setCallerInformationCalculator(CallerInformationCalculator callerInformationCalculator)
          Sets the CallerInformationCalculator to resolve class names.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

calculateCallerInformation

public static CallerInformation calculateCallerInformation(int correctStackDepth,
                                                           java.lang.String loggerDomainName)
Calculates the CallerInformation, about the caller of the logging call. To enable calculating this information (which might be relatively time-consuming, depending on implementation), a stack-depth must be provided to correct the execution stack of.

Parameters:
correctStackDepth - the value to correct the execution stack of (in means of the caller)
loggerDomainName - a optional logger domain name, which is provided by the logger caller
Returns:
the CallerInformation with information about the caller of the log method

getLogHandler

public static LogHandler getLogHandler(int loggingLevel,
                                       CallerInformation callerInformation)
Returns the LogHandler implementation responsible for the given logging level and class name.

Parameters:
loggingLevel - the level to be logged, one of the constants from LoggingLevel
Returns:
the LogHandler, that can handle logging for the parameters given

addLogHandler

public static void addLogHandler(LogHandler logHandler)
Adds a LogHandler to this LogManager.

Parameters:
logHandler - the LogHandler to add (not null).

removeLogHandler

public static void removeLogHandler(LogHandler logHandler)
Removes a previously registered LogHandler.

Parameters:
logHandler - the LogHandler to remove (not null).

setCallerInformationCalculator

public static void setCallerInformationCalculator(CallerInformationCalculator callerInformationCalculator)
Sets the CallerInformationCalculator to resolve class names.

Parameters:
callerInformationCalculator - the CallerInformationCalculator to set.

loglevel2String

public static java.lang.String loglevel2String(int level)
Converts the log-level into a human-readable string.

Parameters:
level - the log-level to convert
Returns:
log-level as human-readable string