Enabling tracing

Enabling tracing allows you to monitor the actions that are performed against the SQL database, which can be valuable information for troubleshooting and tuning the database. There are two configurations that you can use to turn on the tracing.

About this task

You can enable tracing not only for the Wire Listener, but also for the Db2® JSON Java™ API and the IBM® Data Server Driver. The Wire Listener uses the Db2 JSON Java API and the IBM Data Server Driver for JDBC applications and SQLJ applications.

Procedure

Configuration 1

To enable tracing for applications that use the Mongo API against the Wire Listener, complete the following steps.

  1. Create the nosql.properties file. Note the directory in which you saved the file.
  2. Depending on your system, run one of the following two files:
    • On Windows operating systems, run the wplistener.bat script.
    • On Linux® and UNIX operating systems, run the wplistener.sh script.
  3. Set the -logPath path , where path is the directory that you want the trace file to be generated.
  4. Set the -noSQLPropertyPath path , where path is the directory where the nosql.properties file and/or the DB2JccConfiguration.properties is located.
  5. Set the nosql.traceLevel properties in the nosql.properties file. For more information, see nosql.traceLevel property.
  6. Set the nosql.traceFile properties in the nosql.properties file. For more information, see nosql.traceLevel property.
  7. Set the JDBC driver tracing properties in the DB2JccConfiguration.properties file. For more information on customizing the DB2JccConfiguration.properties file, go to Customization of IBM Data Server Driver for JDBC and SQLJ configuration properties

Example

The following is an example of how to enable the Wire Listener, NOSQL API and JDBC driver trace on windows:

wplistener.bat -start -mongoPort 27017 -host localhost:50000 -user  user_id -password password -dbname db_name -debug -logPath C:\temp -noSQLPropertyPath C:\temp

Example 2

The following example is for the nosql.properties file:

nosql.traceFile=/tmp/nosql.txt
nosql.traceLevel=ALL 

Example 3

The following example is for the DB2JccConfiguration.properties file:

db2.jcc.override.traceFile=/tmp/jdbcTrace.txt
db2.jcc.override.traceFileAppend=true
db2.jcc.override.TraceLevel=-1

Configuration 2

To enable tracing for applications that use the Mongo API against the Wire Listener that is written with NOSQL API, refer to the following example:
  1. Enable tracing for NOSQL API and JDBC driver by using the -D JVM option, as in the following example.
java -Dnosql.traceFile=/tmp/nosql.txt -Dnosql.traceLevel=ALL  -Ddb2.jcc.override.traceFile=c:\temp\jdbctrace.txt -Ddb2.jcc.override.TraceLevel=-1 app
where app is the compiled Java application.

Configuration 3

To enable tracing for applications that use the Mongo API against the Wire Listener, start the wirelistener with the following options:

  1. -debug: To enable wire listener trace.
  2. -nosqltrc: To enable nosql trace for wire listener.
  3. -jcctrc: To enable jcc trace for wire listener.
  4. -logPath: To specify a directory where above trace should get saved. Default location is json/logs directory.

Example

To enable only nosql trace for wire listener:
wplistener -start -mongoPort 27017 -dbName jsdb -usid user -password pwd -nosqltrc -logPath C:\temp
To enable only jcc trace for wire listener:
wplistener -start -mongoPort 27017 -userid user -password pwd -dbName jsdb -jcctrc -logPath C:\temp
To enable nosql and jcc trace for wire listener at default logPath directory:
wplistener -start -mongoPort 27017 -userid user -password pwd -dbName jsdb -debug -nosqltrc -jcctrc -logPath C:\temp
To enable all three traces at once:
wplistener -start -mongoPort 27017 -userid user -password pwd -dbName jsdb -debug -nosqltrc -jcctrc -logPath C:\temp