org.codehaus.plexus.logging

Class BaseLoggerManager

Implemented Interfaces:
Initializable, LoggerManager

public abstract class BaseLoggerManager
extends AbstractLoggerManager
implements Initializable

Base class for all LoggerManagers which use cache of Loggers.
Version:
$Id: BaseLoggerManager.java 1750 2005-04-19 07:45:02Z brett $
Author:
Michal Maczka

Field Summary

private int
currentThreshold
private Map
loggerCache
private String
threshold

Fields inherited from interface org.codehaus.plexus.logging.LoggerManager

ROLE

Method Summary

protected abstract Logger
createLogger(String key)
int
getActiveLoggerCount()
Logger
getLoggerForComponent(String role, String roleHint)
int
getThreshold()
Returns the current threshold for all new loggers.
int
getThreshold(String role, String roleHint)
String
getThresholdAsString()
void
initialize()
protected int
parseThreshold(String text)
void
returnComponentLogger(String role, String roleHint)
void
setThreshold(String role, String roleHint, int threshold)
void
setThreshold(int currentThreshold)
Sets the threshold for all new loggers.

Methods inherited from class org.codehaus.plexus.logging.AbstractLoggerManager

getLoggerForComponent, getThreshold, returnComponentLogger, setThreshold, toMapKey

Field Details

currentThreshold

private int currentThreshold

loggerCache

private Map loggerCache

threshold

private String threshold

Method Details

createLogger

protected abstract Logger createLogger(String key)

getActiveLoggerCount

public int getActiveLoggerCount()
Specified by:
getActiveLoggerCount in interface LoggerManager

getLoggerForComponent

public Logger getLoggerForComponent(String role,
                                    String roleHint)
Specified by:
getLoggerForComponent in interface LoggerManager

getThreshold

public int getThreshold()
Returns the current threshold for all new loggers.
Specified by:
getThreshold in interface LoggerManager
Returns:
Returns the current threshold for all new loggers.

getThreshold

public int getThreshold(String role,
                        String roleHint)
Specified by:
getThreshold in interface LoggerManager

getThresholdAsString

public String getThresholdAsString()

initialize

public void initialize()
Specified by:
initialize in interface Initializable

parseThreshold

protected int parseThreshold(String text)

returnComponentLogger

public void returnComponentLogger(String role,
                                  String roleHint)
Specified by:
returnComponentLogger in interface LoggerManager

setThreshold

public void setThreshold(String role,
                         String roleHint,
                         int threshold)
Specified by:
setThreshold in interface LoggerManager

setThreshold

public void setThreshold(int currentThreshold)
Sets the threshold for all new loggers. It will NOT affect the existing loggers.

This is usually only set once while the logger manager is configured.

Specified by:
setThreshold in interface LoggerManager
Parameters:
currentThreshold - The new threshold.