com.northgateis.reality.realsql
Class RealDebug

java.lang.Object
 |
 +--com.northgateis.reality.realsql.RealDebug

public class RealDebug
extends java.lang.Object
implements com.northgateis.reality.realsql.RealConstants

Enables objects in the driver to log various diagnostic information. Debug options can be set (in order of precedence)


1. The driver's property file
"com/northgateis/reality/realsql/realsql.properties".
2. An application generated properties object passed into the driver via a
call to getConnection(String, Properties).
3. System properties set using the "java -D" command option.
Their are three property values which maybe used to control driver tracing:
 
 logLevel=level
    This controls the level of diagnostic information which will be traced.
    Where 'level' can be one of the following values (the default is NOTICE). 
     PANIC|ALERT|WARNING|NOTICE|INFO|DEBUG
          
 logOptions=options
    This applies additional tracing information if required.
    For example, the calling method or thread name.
    Where 'options' can be anyone or combination of the following values 
    (the default is NONE)
     METHODS|THREADS
 logModules=modules
    This controls which modules are to be traced
    Where 'modules' can be anyone or combination of the following values 
    (the default is NONE)
     SERVER|DDA|CONNECTION|DATABASEMETADATA|STATEMENT|PREPAREDSTATEMENT|
     CALLABLESTATEMENT|RESULTSETMETADATA|RESULTSET|ALLMODS
 
To set the default logging level and trace the Statement and ResultSet interfaces from the driver properties file:
 
logLevel=
logOptions=
logModules=STATEMENT|RESULTSET
To set the logging level to INFO, generate method names and trace the Connection and DatabaseMetaData interfaces via an application generated properties object.:

Properties info = new Properties();
info.put("logLevel", "INFO");
info.put("logOptions", "METHODS");
info.put("logModules", "CONNECTION|DATABASEMETADATA");
connection = DriverManager.getConnection(url, info);
To set the default logging level on all modules from the system properties:

-Dcom.northgateis.reality.realsql.logModules=ALLMODS


Constructor Summary
RealDebug(int module, int flags, java.lang.Object obj)
          Establishes a new Debug logging object.
 
Method Summary
 voidclose()
          Closes out the log by flushing any changes.
 intgetLevel()
          Get the current logging level.
 intgetTraceFlags()
          Get the trace flags.
 voidlog(java.lang.String method, int level, java.lang.String event)
          Attempts to log an event of a specified type to the driver manager's print writer or to stderr/stdout if no print writer is set.
 booleantraceDDA()
          Confirm the condition of the DDA tracing option.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RealDebug

public RealDebug(int module,
 int flags,
 java.lang.Object obj)
Establishes a new Debug logging object.
Parameters:
module - which modult to trace, the default is ALL.
level - at what level to trace, the default is NOTICE.
owner - the object for whom logging is being performed
Method Detail

close

public void close()
Closes out the log by flushing any changes.

getLevel

public int getLevel()
Get the current logging level.

Returns:
the level of events being logged


getTraceFlags

public int getTraceFlags()
Get the trace flags.

Returns:
the trace flags


traceDDA

public boolean traceDDA()
Confirm the condition of the DDA tracing option.

Returns:
true if DDA tracing option set by user; else false.


log

public void log(java.lang.String method,
 int level,
 java.lang.String event)
Attempts to log an event of a specified type to the driver manager's print writer or to stderr/stdout if no print writer is set.

Parameters:
method - the method from which logging is being done.
level - the logging level.
event - the event being logged.