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
.log
files, see Using Log Files. - To send logged information to the
LogStream
orLogWriter
specified in theDriverManager
see 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
DSILogLevel
property to the desired level of information to include in log files. - Set the
LogPath
property 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
Redshift
JDBC
_driver.log
file that logs driver activity that is not specific to a connection. - A
Redshift
JDBC
_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.
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
DSILogLevel
andLogPath
properties 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
LogLevel
property to1
orINFO
. - Or, to configure the driver to log more detailed information that is useful for debugging the driver, set the
LogLevel
property to2
orDEBUG
. - 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
LogLevel
property from the connection URL. - To make sure that the new settings take effect, restart your JDBC application and reconnect to the server.