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.static java.lang.String
CONFIG
Messages related to resolver configuration.static java.lang.String
ERROR
Error messages.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.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.void
setCategory(java.lang.String cat, java.lang.String level)
Set the log level for a category.-
Methods inherited from class java.lang.Object
equals, 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
-
-
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.
-
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.
-
-