public class LoggerHandler
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ALL
Logging levels
|
static java.lang.String |
ERROR
The error log level
|
static java.lang.String |
INFO
The info log level
|
static java.lang.String |
MESSAGE
The message log level - always output to stdout and any others
|
static java.lang.String |
SEVERE
The severe log level
|
static java.lang.Object |
syncOn
An object to synchronize on
|
static java.lang.String |
WARN
The warn log level
|
Constructor and Description |
---|
LoggerHandler()
Creates a new instance of LoggerHandler.
|
Modifier and Type | Method and Description |
---|---|
static void |
addDebugChannel(java.lang.String channelType,
LogChannel logChannel)
Add a new debugging channel.
|
static void |
addLogChannel(java.lang.String channelType,
LogChannel logChannel)
Add a new logging channel.
|
static void |
debugError(Logger logger,
java.lang.String level,
java.lang.Throwable error)
Log the error on the debug log stream.
|
static void |
debugMessage(Logger logger,
java.lang.String level,
java.lang.String methodName,
java.lang.String message)
Log the message on the debug stream if suitable.
|
static Logger |
getLogger(java.lang.String loggerID)
Return a logger appropriate to the class specified.
|
static java.util.ArrayList<java.lang.String> |
getLogLevels()
Get a list of all possible logging levels.
|
static boolean |
levelOK(java.lang.String theLevel,
java.lang.String logLevel)
Return true if the level to log at is higher or equal to the configuration level.
|
static void |
logError(Logger logger,
java.lang.String level,
java.lang.Throwable error)
Log the error on the log stream.
|
static void |
logMessage(Logger logger,
java.lang.String level,
java.lang.String methodName,
java.lang.String message)
Log the message on the logger if suitable.
|
public static final java.lang.String ALL
public static final java.lang.String INFO
public static final java.lang.String WARN
public static final java.lang.String ERROR
public static final java.lang.String SEVERE
public static final java.lang.String MESSAGE
public static final java.lang.Object syncOn
public LoggerHandler() throws java.lang.Exception
java.lang.Exception
- any error.public static Logger getLogger(java.lang.String loggerID)
loggerID
- the id used to identify the logger.public static void addLogChannel(java.lang.String channelType, LogChannel logChannel)
channelType
- the channel type. Can be LogConst
.STDOUTID
,
STDERRID
or STDFILEID
.logChannel
- the channel to add, of the appropriate type.public static void addDebugChannel(java.lang.String channelType, LogChannel logChannel)
channelType
- the channel type. Can be LogConst
.STDOUTID
,
STDERRID
or STDFILEID
.logChannel
- the channel to add, of the appropriate type.public static boolean levelOK(java.lang.String theLevel, java.lang.String logLevel)
theLevel
- the level the error or log message is at.logLevel
- the level the configuration is set to log to.public static void logMessage(Logger logger, java.lang.String level, java.lang.String methodName, java.lang.String message)
logger
- the logger to write to.level
- the error level.methodName
- the name of the method in the class throwing the exception.message
- the message to log.public static void debugMessage(Logger logger, java.lang.String level, java.lang.String methodName, java.lang.String message)
logger
- the logger to write to.level
- the error level.methodName
- the name of the method in the class throwing the exception.message
- the message to log.public static void logError(Logger logger, java.lang.String level, java.lang.Throwable error)
logger
- the logger to write to.level
- the error level.error
- the error to log.public static void debugError(Logger logger, java.lang.String level, java.lang.Throwable error)
logger
- the logger to write to.level
- the error level.error
- the error to log.public static java.util.ArrayList<java.lang.String> getLogLevels()