Package org.xmlresolver.logging
Class AbstractLogger
- java.lang.Object
-
- org.xmlresolver.logging.AbstractLogger
-
- All Implemented Interfaces:
ResolverLogger
- Direct Known Subclasses:
DefaultLogger
,SystemLogger
public abstract class AbstractLogger extends java.lang.Object implements ResolverLogger
The abstract logger implements some of the core functionality needed regardless of how the messages are processed.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
CACHE
Messages related to how the cache is used.protected java.lang.String
catalogLogging
protected java.util.HashMap<java.lang.String,java.lang.Integer>
categories
static java.lang.String
CONFIG
Messages related to resolver configuration.protected static int
DEBUG
static java.lang.String
ERROR
Error messages.protected static int
INFO
protected static int
NONE
static java.lang.String
REQUEST
Requests for resource resolution.static java.lang.String
RESPONSE
Responses describing how a request was resolved.static java.lang.String
TRACE
Trace (or debuggin) messages.protected static int
WARN
static java.lang.String
WARNING
Warning messages.
-
Constructor Summary
Constructors Constructor Description AbstractLogger()
Initializes properties of the abstract class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getCategory(java.lang.String cat)
Returns the log level, "debug", "info", worn", or "none" associated with a category.void
log(java.lang.String cat, java.lang.String message, java.lang.Object... params)
Log a message.protected java.lang.String
logMessage(java.lang.String cat, java.lang.String message, java.lang.Object... params)
void
setCategory(java.lang.String cat, java.lang.String level)
Set the log level for a category.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.xmlresolver.logging.ResolverLogger
debug, info, warn
-
-
-
-
Field Detail
-
REQUEST
public static final java.lang.String REQUEST
Requests for resource resolution.- See Also:
- Constant Field Values
-
RESPONSE
public static final java.lang.String RESPONSE
Responses describing how a request was resolved.- See Also:
- Constant Field Values
-
TRACE
public static final java.lang.String TRACE
Trace (or debuggin) messages.- See Also:
- Constant Field Values
-
ERROR
public static final java.lang.String ERROR
Error messages.- See Also:
- Constant Field Values
-
CACHE
public static final java.lang.String CACHE
Messages related to how the cache is used.- See Also:
- Constant Field Values
-
CONFIG
public static final java.lang.String CONFIG
Messages related to resolver configuration.- See Also:
- Constant Field Values
-
WARNING
public static final java.lang.String WARNING
Warning messages.- See Also:
- Constant Field Values
-
DEBUG
protected static final int DEBUG
- See Also:
- Constant Field Values
-
INFO
protected static final int INFO
- See Also:
- Constant Field Values
-
WARN
protected static final int WARN
- See Also:
- Constant Field Values
-
NONE
protected static final int NONE
- See Also:
- Constant Field Values
-
categories
protected final java.util.HashMap<java.lang.String,java.lang.Integer> categories
-
catalogLogging
protected java.lang.String catalogLogging
-
-
Method Detail
-
getCategory
public java.lang.String getCategory(java.lang.String cat)
Returns the log level, "debug", "info", worn", or "none" associated with a category.- Specified by:
getCategory
in interfaceResolverLogger
- Parameters:
cat
- The category.- Returns:
- The level. If no level has been configured for that category, the default is "debug".
-
setCategory
public void setCategory(java.lang.String cat, java.lang.String level)
Set the log level for a category. After this call, messages in the specified category will be logged at the specified level. Valid levels are "debug", "info", and "warn". An invalid level is treated as "debug".- Specified by:
setCategory
in interfaceResolverLogger
- Parameters:
cat
- The category.level
- The level.
-
logMessage
protected java.lang.String logMessage(java.lang.String cat, java.lang.String message, java.lang.Object... params)
-
log
public void log(java.lang.String cat, java.lang.String message, java.lang.Object... params)
Log a message.The category is used to determine what level of logging is expected for this message. The message is then formatted with its parameters and logged.
The message and its parameters are formatted with
Formatter
.- Specified by:
log
in interfaceResolverLogger
- Parameters:
cat
- The category.message
- The message.params
- The message parameters.
-
-