public class DBLog
extends java.lang.Object
Logger
javadoc for more details.
Examples:
DBLog.getLogger( this ).log( Level.SEVERE, "Error updating object", exception ); DBLog.getLogger( this ).log( DBLog.getTimingLogLevel(), "Processing took {0} seconds", timing ); DBLog.getLogger( this ).log( DBLog.getTraceLogLevel(), "ID didn't resolve, processing {0} {1} by name instead.", new Object[]{ type, name } ); DBLog.getLogger( this ).log( DBLog.getEventLogLevel(), "provider {0} closed", proName );
Constructor and Description |
---|
DBLog() |
Modifier and Type | Method and Description |
---|---|
static java.util.logging.Logger |
getAndInitialiseLogger(java.lang.String name) |
static java.util.logging.Level |
getEventLogLevel()
Returns the logging level to use for logging db-api event information.
|
static java.util.logging.Logger |
getLogger()
Returns the Logger for logging of information, warning and error messages
in the api.
|
static java.util.logging.Logger |
getLogger(java.lang.Object obj)
Returns the Logger appropriate to the given object or class, initialized
using
getAndInitialiseLogger(java.lang.String) . |
static java.util.logging.Logger |
getSQLLog()
Returns the SQL log - any commands issued to the database should be trace
printed using this log.
|
static java.util.logging.Level |
getTimingLogLevel()
Returns the logging level to use for logging db-api timings (e.g.
|
static java.util.logging.Level |
getTraceLogLevel()
Returns the logging level to use for logging db-api tracing
(for example sql execution, diff result set print outs etc).
|
static void |
initLogger(java.util.logging.Logger logger) |
static void |
log(java.lang.String msg,
java.lang.Object... params)
Logs the given message to the tracing log level.
|
static void |
logDifferences(DBObject obj1,
DBObject obj2,
DBObjectProvider pro)
Prints out the differences between the two objects to the trace log level.
|
static void |
logStackTrace(java.lang.Throwable t)
Logs the given exception if the db_api tracing is enabled.
|
public static final java.util.logging.Logger getLogger()
public static final java.util.logging.Logger getLogger(java.lang.Object obj)
getAndInitialiseLogger(java.lang.String)
. The package of the class is used as
the logger name.public static final java.util.logging.Logger getAndInitialiseLogger(java.lang.String name)
public static final java.util.logging.Level getTimingLogLevel()
public static final java.util.logging.Level getTraceLogLevel()
public static final java.util.logging.Level getEventLogLevel()
public static final void logStackTrace(java.lang.Throwable t)
getLogger()
and log the
throwable at the appropriate level directly. It means the logging
information will be more accurate.
As the stack trace will be logged to the trace level it will not appear
in normal builds. Use getLogger()
and log to Level.SEVERE
,
Level.WARNING
or Level.INFO
for that to happen.
public static final void log(java.lang.String msg, java.lang.Object... params)
msg
- the message to logparams
- optional parameters for the message to be formatted withgetTraceLogLevel()
public static final void logDifferences(DBObject obj1, DBObject obj2, DBObjectProvider pro)
getTraceLogLevel()
public static final java.util.logging.Logger getSQLLog()
public static void initLogger(java.util.logging.Logger logger)