There are two ways in which you can enable JDBC logging:
Note: Logging can also be programmed into a Java application, applet or servlet, so some or all of the logging features described below may also be provided by your application - refer to your application documentation for details.
Six property values may be used to control driver tracing.
This controls the level of diagnostic information that will be logged on the client. It must be set to one of the following values:
PANIC ALERT WARNING NOTICE INFO DEBUG
The default is NOTICE
.
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
.
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
.
This controls the type of diagnostic information that will be logged on the host. It can be set to any of the following values:
0
= None
1
= Log input
2
= Log output
3
= Log input and output
This specifies the name of item created in the host logging file. The default cycles through 1 to 9.
Note: When combining values, you must use a vertical bar (|) as a separator; for example:
logOptions=METHODS|THREADS
Client log output is normally displayed on the screen. Your application may provide a way to route the log to a file.
Host log output is saved in the file SQLSRVLOG in the account that the server id logged on to.
The JDBC driver's property file is called realsql.properties and can be found in the subdirectory com/northgateis/reality/realsql in the directory where you installed the JDBC driver.
Within the realsql.properties file, properties are set by specifying the name of the property, followed by an equals sign and the required value. One property must appear on each line. For example:
logLevel=ALERT logOptions= logModules=STATEMENT|RESULTSET hostOption=2
System properties are set from the command line when calling a java application, by using the -D option. For example:
java myapp -Dcom.northgateis.reality.realsql.logModules=ALLMODS
This example sets the default logging level on all modules from the system properties:
In the following example, the following property value have been set:
logLevel=DEBUG logOptions=METHODS logModules=DRIVER|CONNECTION
The example below shows the information displayed on the screen when selecting all the rows in an SQL table called emp. Note that the log output is interspersed with the normal screen display.
DriverManager.initialize: jdbc.drivers = null JDBC DriverManager initialized registerDriver: driver[className=com.northgateis.reality.realsql.RealSQLDriver,com.northgateis.reality.realsql.RealSQLDriver @b2990e61 DriverManager.getConnection("jdbc:realsql://magpie:1203/R82A") trying driver[className=com.northgateis.reality.realsql.RealSQLDriver,com.northgateis.reality.realsql.RealSQLDriver @b2990e61] NOTICE com.northgateis.reality.realsql.RealSQLConnection.RealSQLConnection(): Assigned logging level of 0x40120 NOTICE com.northgateis.reality.realsql.RealSQLConnection.connection():Creating connection to magpie:1203/R82A user=ajt NOTICE com.northgateis.reality.realsql.RealSQLConnection.isClosed(): false NOTICE com.northgateis.reality.realsql.RealSQLConnection.setCatalog(): Catalog name "R82A" NOTICE com.northgateis.reality.realsql.RealSQLConnection.RealSQLConnection():Starting thread for database connection. NOTICE com.northgateis.reality.realsql.RealSQLConnection.createStatement():ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY. NOTICE com.northgateis.reality.realsql.RealSQLConnection.isClosed(): false NOTICE com.northgateis.reality.realsql.RealSQLConnection.createStatement():type = 1003, concur = 1007 NOTICE com.northgateis.reality.realsql.RealSQLConnection.isClosed(): false executeQuery(SELECT * FROM EMP) Ok! EMPNO...... ENAME..... TITLE.... MGR........ HIREDATE.. SAL...... COMM..... DEPTNO..... 8698 ARCHER MANAGER 8839 1982-12-22 3750.00 90030 8788 KELLY ANALYST 8566 1984-07-31 3900.00 90020 8369 CALLAGHAN CLERK 8902 1982-08-09 1700.00 90020 8499 HARRIS SALESREP 8698 1982-10-13 2500.00 300.00 90030 8839 JENSEN PRESIDENT 1983-07-10 5900.00 90010 8900 CUTLER CLERK 8698 1983-07-26 1850.00 90030 8521 TAYLOR SALESREP 8698 1982-10-15 2190.00 500.00 90030 8671 THOMAS SECRETARY 8839 1984-02-15 1950.00 90010 8782 WILSON MANAGER 8839 1983-01-30 3350.00 90010 8902 OLSEN ANALYST 8566 1983-07-26 3900.00 90020 8654 MCBRIDE SALESREP 8698 1983-05-21 2150.00 1400.00 90030 8844 HERMAN SALESREP 8698 1983-05-01 2400.00 90030 8934 DOUGLAS CLERK 8782 1983-09-15 2200.00 90010 8566 CUSTER MANAGER 8839 1982-11-22 3875.00 90020 8876 CROSS CLERK 8788 1984-09-03 2000.00 90020 15 Rows listed. NOTICE com.northgateis.reality.realsql.RealSQLConnection.clean(): Number of open statements 1 DEBUG com.northgateis.reality.realsql.RealSQLConnection.clean(): Cleaned 1 statements. NOTICE com.northgateis.reality.realsql.RealSQLConnection.close(): Closing connection to null/null