Configuring Logging

To help troubleshoot issues, you can enable logging in the driver.

The Simba Amazon Redshift JDBC Driver supports two types of driver logging:

You provide the configuration information to the driver in the connection URL. For more information about the syntax of the connection URL, see Building the Connection URL.

To record network information related to Cancel messages, which are handled by the Netty library, the driver supports additional logging through Log4j logs.

You can configure Log4j logging by modifying the log4j.properties file. For more information, see the "Configuration" topic in the Log4j documentation: https://logging.apache.org/log4j/2.x/manual/configuration.html. In particular, see the "System Properties" section.

To use Log4j logging, make sure that the runtime classpath for the driver includes the log4j-1.2.17.jar file.

At run time you must specify the path to the log4j.properties configuration file with the JVM argument log4j2.configurationFile.

Using Log Files

Important:

Important:

Only enable logging long enough to capture an issue. Logging decreases performance and can consume a large quantity of disk space.

Set the DSILogLevel key in your connection URL to enable logging and specify the amount of detail included in log files. The following table lists the logging levels provided by the Simba Amazon Redshift JDBC Driver, in order from least verbose to most verbose.

LogLevel Value Description

0

Disable all logging.

1

Log severe error events that will lead the driver to abort.

2

Log error events that might allow the driver to continue running.

3

Log events that might result in an error if action is not taken.

4

Log general information that describes the progress of the driver.

5

Log detailed information that is useful for debugging the driver.

6

Log all driver activity.

To enable logging that uses log files:

  1. Set the DSILogLevel property to the desired level of information to include in log files.
  2. Set the LogPath property to the full path to the folder where you want to save log files.
  3. For example, the following connection URL enables logging level 3 and saves the log files in the C:\temp folder:

    jdbc:redshift://redshift.company.us-west-1.redshift.amazonaws.com:9000/Default;DSILogLevel=3;
    LogPath=C:\temp

  4. To make sure that the new settings take effect, restart your JDBC application and reconnect to the server.
  5. The Simba Amazon Redshift JDBC Driver produces the following log files in the location specified in the LogPath property:

    • A RedshiftJDBC_driver.log file that logs driver activity that is not specific to a connection.
    • A RedshiftJDBC_connection_[Number].log file for each connection made to the database, where [Number] is a number that identifies each log file. This file logs driver activity that is specific to the connection.

If the LogPath value is invalid, then the driver sends the logged information to the standard output stream (System.out).

To disable logging that uses log files:

  1. Remove the DSILogLevel and LogPath properties from the connection URL.
  2. To make sure that the new settings take effect, restart your JDBC application and reconnect to the server.

Using LogStream or LogWriter

Important:

Important:

Only enable logging long enough to capture an issue. Logging decreases performance and can consume a large quantity of disk space.

Set the LogLevel key in your connection URL to enable logging and specify the amount of detail sent to the LogStream or LogWriter specified in the DriverManager.

To enable logging that uses the LogStream or LogWriter:

  1. Choose one:
    • To configure the driver to log general information that describes the progress of the driver, set the LogLevel property to 1 or INFO.
    • Or, to configure the driver to log more detailed information that is useful for debugging the driver, set the LogLevel property to 2 or DEBUG.
  2. To make sure that the new settings take effect, restart your JDBC application and reconnect to the server.

To disable logging that uses the LogStream or LogWriter:

  1. Remove the LogLevel property from the connection URL.
  2. To make sure that the new settings take effect, restart your JDBC application and reconnect to the server.