Diagnostics
Two diagnostic facilities are available: one allows you to trace the execution of driver objects, the other allows remote tracing of the server.
Driver Tracing
The setLogWriter()
method in the
DriverManager
class enables driver
tracing. Trace information can be written to the current output screen or to a
file. For example:
PrintWriter pw = new PrintWriter(System.out);
DriverManager.setLogWriter(pw);
There are three property values used to control driver tracing:
logLevel
This controls the level of diagnostic information that will be traced. It must be set to one of the following values:
PANIC
ALERT
WARNING
NOTICE
INFO
DEBUG
The default is NOTICE.
logOptions
This option applies additional tracing information if required; for example, the calling method or thread name. It can be set to one or both of the values METHODS and THREADS. The default is NONE.
logModules
This option controls which modules are to be traced. It can be set to any combination of the following values:
SERVER
DDA
CONNECTION
DATABASEMETADATA
STATEMENT
PREPAREDSTATEMENT
CALLABLESTATEMENT
RESULTSETMETADATA
RESULTSET
ALLMODS
The default is NONE
Note
When combining values, you must use a vertical bar (|) as a separator; for example:
logOptions=METHODS|THREADS
You can pass the logging properties to the driver using any one of the
methods described in the RealSQLConnection
interface. In order of priority (lowest first):
- By including the properties in a
java.util.Properties
object that is passed togetConnection()
, see Method B in the Connection Examples -
By setting the properties in the
realsql.Properties
file (in the same directory as the driver class files). For example:logLevel=
logOptions=
logModules=STATEMENT|RESULTSET -
By including the logging properties in a URL that is passed to
getConnection()
, see Method A in the Connection Examples. -
By setting
logging
in the system properties using the -D option at the command line when you call the application. For example:-Dcom.northgateis.reality.realsql.logModules=ALLMODS
Note
You must use the full package name when supplying options via system properties.
Server Tracing
Server tracing is controlled by two property values:
hostOption
This controls the type of diagnostic information that will be traced. It can be set to any of the following values:
0
= None
1 = Log input
2 = Log output
3 = Log input and output
hostItemName
This
specifies the name of item created in the host logging file SQLSRVLOG
. The default cycles
through 1 to 9.
You can pass these properties to the driver in the same way as for driver tracing.