Configuring Logging
To help troubleshoot issues, you can enable logging in the driver.
The Simba Amazon Redshift JDBC Driver supports two types of
- To save logged information in
.logfiles, see Using Log Files. - To send logged information to the
LogStreamorLogWriterspecified in theDriverManagersee Using LogStream or LogWriter.
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:
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 |
|---|---|
|
|
Disable all logging. |
|
|
Log severe error events that will lead the driver to abort. |
|
|
Log error events that might allow the driver to continue running. |
|
|
Log events that might result in an error if action is not taken. |
|
|
Log general information that describes the progress of the driver. |
|
|
Log detailed information that is useful for debugging the driver. |
|
|
Log all driver activity. |
To enable logging that uses log files:
- Set the
DSILogLevelproperty to the desired level of information to include in log files. - Set the
LogPathproperty to the full path to the folder where you want to save log files. - To make sure that the new settings take effect, restart your JDBC application and reconnect to the server.
- A
RedshiftJDBC_driver.logfile that logs driver activity that is not specific to a connection. - A
RedshiftJDBC_connection_[Number].logfile 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.
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
The Simba Amazon Redshift JDBC Driver produces the following log files in the location specified in the LogPath property:
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:
- Remove the
DSILogLevelandLogPathproperties from the connection URL. - To make sure that the new settings take effect, restart your JDBC application and reconnect to the server.
Using LogStream or LogWriter
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:
- Choose one:
- To configure the driver to log general information that describes the progress of the driver, set the
LogLevelproperty to1orINFO. - Or, to configure the driver to log more detailed information that is useful for debugging the driver, set the
LogLevelproperty to2orDEBUG. - 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:
- Remove the
LogLevelproperty from the connection URL. - To make sure that the new settings take effect, restart your JDBC application and reconnect to the server.