Class ConsoleLoggerManager
- java.lang.Object
-
- org.codehaus.plexus.logging.AbstractLoggerManager
-
- org.codehaus.plexus.logging.console.ConsoleLoggerManager
-
- All Implemented Interfaces:
LoggerManager,Initializable
public class ConsoleLoggerManager extends AbstractLoggerManager implements LoggerManager, Initializable
This is a simple logger manager that will only write the logging statements to the console. Sample configuration:<logging> <implementation>org.codehaus.plexus.logging.ConsoleLoggerManager</implementation> <logger> <threshold>DEBUG</threshold> </logger> </logging>
-
-
Field Summary
Fields Modifier and Type Field Description private booleanbootTimeLoggerprivate intcurrentThresholdprivate intloggerCountThe number of active loggers in use.private java.util.Maploggersprivate java.lang.StringthresholdMessage of this level or higher will be logged.-
Fields inherited from interface org.codehaus.plexus.logging.LoggerManager
ROLE
-
-
Constructor Summary
Constructors Constructor Description ConsoleLoggerManager()ConsoleLoggerManager(java.lang.String threshold)This special constructor is called directly when the container is bootstrapping itself.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description LoggercreateLogger(int threshold, java.lang.String name)private voiddebug(java.lang.String msg)Remove this method and all references when this code is verified.private java.lang.StringdecodeLogLevel(int logLevel)intgetActiveLoggerCount()LoggergetLoggerForComponent(java.lang.String role, java.lang.String roleHint)intgetThreshold()Returns the current threshold for all new loggers.intgetThreshold(java.lang.String role, java.lang.String roleHint)voidinitialize()private intparseThreshold(java.lang.String text)voidreturnComponentLogger(java.lang.String role, java.lang.String roleHint)voidsetThreshold(int currentThreshold)Sets the threshold for all new loggers.voidsetThreshold(java.lang.String role, java.lang.String roleHint, int threshold)voidsetThresholds(int currentThreshold)Sets the threshold for all loggers.-
Methods inherited from class org.codehaus.plexus.logging.AbstractLoggerManager
getLoggerForComponent, getThreshold, returnComponentLogger, setThreshold, toMapKey
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.codehaus.plexus.logging.LoggerManager
getLoggerForComponent, getThreshold, returnComponentLogger, setThreshold
-
-
-
-
Field Detail
-
threshold
private java.lang.String threshold
Message of this level or higher will be logged. This field is set by the plexus container thus the name is 'threshold'. The field currentThreshold contains the current setting of the threshold.
-
currentThreshold
private int currentThreshold
-
loggers
private java.util.Map loggers
-
loggerCount
private int loggerCount
The number of active loggers in use.
-
bootTimeLogger
private boolean bootTimeLogger
-
-
Method Detail
-
initialize
public void initialize()
- Specified by:
initializein interfaceInitializable
-
setThreshold
public void setThreshold(int currentThreshold)
Description copied from interface:LoggerManagerSets 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:
setThresholdin interfaceLoggerManager- Parameters:
currentThreshold- The new threshold.
-
setThresholds
public void setThresholds(int currentThreshold)
Description copied from interface:LoggerManagerSets the threshold for all loggers. It affects all the existing loggers as well as future loggers.- Specified by:
setThresholdsin interfaceLoggerManager- Parameters:
currentThreshold- The new threshold.
-
getThreshold
public int getThreshold()
Description copied from interface:LoggerManagerReturns the current threshold for all new loggers.- Specified by:
getThresholdin interfaceLoggerManager- Returns:
- Returns the threshold.
-
setThreshold
public void setThreshold(java.lang.String role, java.lang.String roleHint, int threshold)- Specified by:
setThresholdin interfaceLoggerManager
-
getThreshold
public int getThreshold(java.lang.String role, java.lang.String roleHint)- Specified by:
getThresholdin interfaceLoggerManager
-
createLogger
public Logger createLogger(int threshold, java.lang.String name)
-
getLoggerForComponent
public Logger getLoggerForComponent(java.lang.String role, java.lang.String roleHint)
- Specified by:
getLoggerForComponentin interfaceLoggerManager
-
returnComponentLogger
public void returnComponentLogger(java.lang.String role, java.lang.String roleHint)- Specified by:
returnComponentLoggerin interfaceLoggerManager
-
getActiveLoggerCount
public int getActiveLoggerCount()
- Specified by:
getActiveLoggerCountin interfaceLoggerManager
-
parseThreshold
private int parseThreshold(java.lang.String text)
-
decodeLogLevel
private java.lang.String decodeLogLevel(int logLevel)
-
debug
private void debug(java.lang.String msg)
Remove this method and all references when this code is verified.- Parameters:
msg-
-
-