KBEC-00086 - Enabling and collecting voluminous JDBC logging

Issue

The Java Database Connectivity (JDBC) API is the industry standard for database-independent connectivity between the Java programming language and a wide range of databases and other tabular data sources, such as spreadsheets or flat files.

This article describes how to enable JDBC additional logging for debug purposes.

Environment

Resolution

  1. In the CloudBees CD Server, Open the logback-local.groovy file, which is located in yourInstallationPath/conf, and find the following section:

    // Log all SQL DML statements as they are executed
    logger("org.hibernate.SQL", TRACE)
    // Log all JDBC parameters
    logger("org.hibernate.type.descriptor.sql.BasicBinder", TRACE)
    
  2. Ensure that the lines are uncommented and that the level is set to “TRACE”.

  3. Once saved this file, please confirm the additional logging lines are added to the yourInstallationPath/logs/commander.log file (in clustered installations the log is generated in the file commander-yourHostName.log) by running:

    // Log all SQL DML statements as they are executed
    logger("org.hibernate.SQL", TRACE) 
    --> Validate 
        grep " SQL              " commander.log | wc -l
    is > 0
    
    // Log all JDBC parameters
    logger("org.hibernate.type.descriptor.sql.BasicBinder", TRACE)
    --> Validate 
        grep " BasicBinder      " commander.log | wc -l
    is > 0   
    
  4. If this change does not take effect (previous grep commands return 0), restart the CloudBees CD (CloudBees Flow) server and check with the grep commands again after restarting (this might be required for very busy servers).

  5. Reproduce the issue that you are trying to debug.

  6. Provide to the support team all the logs from the time you turned on SQL logging until after the issue is reproduced.

Have more questions?

0 Comments

Please sign in to leave a comment.