Keywords: traceLevel=value database connection URL attribute

# traceLevel=value attribute

#### Function

If tracing is enabled, specifies the level of tracing to be used by the Derby Network Client. The value is numeric. If you do not specify a trace level, the default is TRACE_ALL.

For more information about tracing, see "Network client tracing" in the Java DB Server and Administration Guide. See traceFile=path, traceFileAppend=true, and traceDirectory=path for other attributes related to tracing.

#### Tracing levels

The following table shows the available tracing levels and their values.

Table 1. Available tracing levels and values
Trace level | Hex value | Decimal value
--- | --- | ---
org.apache.derby.jdbc.ClientDataSource.TRACE_NONE | 0x0 | 0
org.apache.derby.jdbc.ClientDataSource.TRACE_CONNECTION_CALLS | 0x1 | 1
org.apache.derby.jdbc.ClientDataSource.TRACE_STATEMENT_CALLS | 0x2 | 2
org.apache.derby.jdbc.ClientDataSource.TRACE_RESULT_SET_CALLS | 0x4 | 4
org.apache.derby.jdbc.ClientDataSource.TRACE_DRIVER_CONFIGURATION | 0x10 | 16
org.apache.derby.jdbc.ClientDataSource.TRACE_CONNECTS | 0x20 | 32
org.apache.derby.jdbc.ClientDataSource.TRACE_PROTOCOL_FLOWS | 0x40 | 64
org.apache.derby.jdbc.ClientDataSource.TRACE_RESULT_SET_META_DATA | 0x80 | 128
org.apache.derby.jdbc.ClientDataSource.TRACE_PARAMETER_META_DATA | 0x100 | 256
org.apache.derby.jdbc.ClientDataSource.TRACE_DIAGNOSTICS | 0x200 | 512
org.apache.derby.jdbc.ClientDataSource.TRACE_XA_CALLS | 0x800 | 2048
org.apache.derby.jdbc.ClientDataSource.TRACE_ALL | 0xFFFFFFFF | -1

To specify more than one trace level, use one of the following techniques:

- If you are using the `ij` tool, add the decimal values together and specify the sum. For example, to trace both PROTOCOL flows and connection calls, add the values for TRACE_PROTOCOL_FLOWS (64) and TRACE_CONNECTION_CALLS (1). Specify the sum, the value 65.
- If you are running a JDBC program, do one of the following:
  - Use bitwise OR operators ( | ) with two or more trace values. For example, to trace protocol flows and connection calls, specify this value for traceLevel:

        TRACE_PROTOCOL_FLOWS | TRACE_CONNECTION_CALLS

  - Use a bitwise complement operator ( ~ ) with a trace value to specify all except a certain trace. For example, to trace everything except protocol flows, specify this value for traceLevel:

        ~TRACE_PROTOCOL_FLOWS

#### Combining with other attributes

If you specify this attribute, you must also specify either the traceFile=path attribute or the traceDirectory=path attribute.

#### Example

    -- enable tracing on a new database
    jdbc:derby://localhost:1527/mydb;create=true;traceFile=trace.out;traceLevel=65

Parent topic: Setting attributes for the database connection URL