|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.hsqldb.lib.FrameworkLogger
public class FrameworkLogger
A logging framework wrapper that supports java.util.logging and log4j.
Logger hierarchies are stored at the Class level. Log4j will be used if the Log4j system (not necessarily config files) are found in the runtime classpath. Otherwise, java.util.logging will be used. This is pretty safe because for use cases where multiple hierarchies are desired, classloader hierarchies will effectively isolate multiple class-level Logger hierarchies. Sad as it is, the java.util.logging facility lacks the most basic developer-side and configuration-side capabilities. Besides having a non-scalable discovery system, the designers didn't comprehend the need for a level between WARNING and SEVERE! Since we don't want to require log4j in Classpath, we have to live with these constraints. As with all the popular logging frameworks, if you want to capture a stack trace, you must use the two-parameters logging methods. I.e., you must also pass a String, or only toString() from your throwable will be captured. Usage example:
private static FrameworkLogger logger =
FrameworkLogger.getLog(SqlTool.class);
...
logger.finer("Doing something log-worthy");
The system level property hsqldb.reconfig_logging=false
is
required to avoid configuration of java.util.logging. Otherwise
configuration takes place.
Method Summary | |
---|---|
static void |
clearLoggers(String prefixToZap)
Frees Logger(s), if any, with the specified category, or that begins with the specified prefix + dot. |
void |
enduserlog(Level level,
String message)
|
void |
error(String message)
This is just a wrapper for FrameworkLogger.warning(), because java.util.logging lacks a method for this critical purpose. |
void |
error(String message,
Throwable t)
Just like FrameworkLogger.error(String), but also logs a stack trace. |
void |
finer(String message)
|
void |
finer(String message,
Throwable t)
Just like FrameworkLogger.finer(String), but also logs a stack trace. |
void |
finest(String message)
|
void |
finest(String message,
Throwable t)
Just like FrameworkLogger.finest(String), but also logs a stack trace. |
static FrameworkLogger |
getLog(Class c)
User's entry-point into this logging system. |
static FrameworkLogger |
getLog(Class c,
String contextId)
This method just defers to the getLog(Class) method unless default (no local configuration) JDK logging is being used; In that case, this method assures that the returned logger has an associated FileHander using the supplied String identifier. |
static FrameworkLogger |
getLog(String s)
Alternative entry-point into this logging system, for cases where you want to share a single logger instance among multiple classes, or you want to use multiple logger instances from a single class. |
static FrameworkLogger |
getLog(String baseId,
String contextId)
This method just defers to the getLog(String) method unless default (no local configuration) JDK logging is being used; In that case, this method assures that the returned logger has an associated FileHander using the supplied String identifier. |
void |
info(String message)
|
void |
info(String message,
Throwable t)
Just like FrameworkLogger.info(String), but also logs a stack trace. |
static boolean |
isDefaultJdkConfig()
Whether this JVM is configured with java.util.logging defaults. |
void |
log(Level level,
String message)
|
void |
log(Level level,
String message,
Throwable t)
Just like FrameworkLogger.log(Level, String), but also logs a stack trace. |
void |
privlog(Level level,
String message,
Throwable t,
int revertMethods,
Class skipClass)
The "priv" prefix is historical. |
static String |
report()
Utility method for integrators. |
void |
severe(String message)
|
void |
severe(String message,
Throwable t)
Just like FrameworkLogger.severe(String), but also logs a stack trace. |
void |
warning(String message)
|
void |
warning(String message,
Throwable t)
Just like FrameworkLogger.warning(String), but also logs a stack trace. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static String report()
Not named similar to 'toString' to avoid ambiguity with instance method toString.
public static void clearLoggers(String prefixToZap)
Note that as of today, this depends on the underlying logging framework implementation to release the underlying Logger instances. JUL in Sun's JVM uses weak references, so that should be fine. Log4j as of today seems to use strong references (and no API hooks to free anything), so this method will probably have little benefit for Log4j.
public static FrameworkLogger getLog(Class c)
FrameworkLogger
public static FrameworkLogger getLog(Class c, String contextId)
public static FrameworkLogger getLog(String baseId, String contextId)
public static FrameworkLogger getLog(String s)
getLog(Class)
public void log(Level level, String message, Throwable t)
level
- java.util.logging.Level level to filter and log atmessage
- Message to be loggedt
- Throwable whose stack trace will be logged.log(Level, String)
,
Logger.log(Level, String)
,
Level
public void privlog(Level level, String message, Throwable t, int revertMethods, Class skipClass)
public void enduserlog(Level level, String message)
public void log(Level level, String message)
level
- java.util.logging.Level level to filter and log atmessage
- Message to be loggedLogger.log(Level, String)
,
Level
public void finer(String message)
message
- Message to be loggedLogger.finer(String)
public void warning(String message)
message
- Message to be loggedLogger.warning(String)
public void severe(String message)
message
- Message to be loggedLogger.severe(String)
public void info(String message)
message
- Message to be loggedLogger.info(String)
public void finest(String message)
message
- Message to be loggedLogger.finest(String)
public void error(String message)
message
- Message to be loggedwarning(String)
public void finer(String message, Throwable t)
t
- Throwable whose stack trace will be logged.finer(String)
public void warning(String message, Throwable t)
t
- Throwable whose stack trace will be logged.warning(String)
public void severe(String message, Throwable t)
t
- Throwable whose stack trace will be logged.severe(String)
public void info(String message, Throwable t)
t
- Throwable whose stack trace will be logged.info(String)
public void finest(String message, Throwable t)
t
- Throwable whose stack trace will be logged.finest(String)
public void error(String message, Throwable t)
t
- Throwable whose stack trace will be logged.error(String)
public static boolean isDefaultJdkConfig()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |