Search code examples
db2webspheretracewebsphere-8

How can I enable and collect trace for DB2 through WebSphere?


I would like to enable trace for DB2 which I'm accessing via datasource in WebSphere Application Server version 8.


Solution

  • In the server's bootstrap.properties file after the variable com.ibm.ws.logging.trace.specification= add the following code:

    for version 6 or later:

     *=info:WAS.j2c=all:RRA=all:WAS.database=all:Transaction=all
    

    for version 5:

    RRA=all=enabled:WAS.database=all=enabled:J2C=all=enabled
    

    More info can be found on IBM website: https://www-304.ibm.com/support/docview.wss?rs=71&uid=swg21196160#wasconnection

    In you datasource you need to specify the traceLevel property as well. Example:

    <dataSource id="db2" jndiName="jdbc/db2" jdbcDriverRef="DB2Driver" >
        <properties.db2.jcc databaseName="myDB" traceLevel="-1"/>
    </dataSource>