1 Diagnostic Tools : Logging (Salesforce Driver)

Logging (Salesforce Driver)
The Salesforce driver provides a flexible and comprehensive logging mechanism of its Java components that allows logging to be incorporated seamlessly with the logging of your application or enabled and configured independently from the application. The logging mechanism can be instrumental in investigating and diagnosing issues. It also provides valuable insight into the type and number of operations requested by the application from the driver and requested by the driver from the remote data source. This information can help you tune and optimize your application.
Logging Components
The Salesforce driver uses the Java Logging API to configure and control the loggers (individual logging components) used by the driver. The Java Logging API is built into the JVM.
The Java Logging API allows applications or components to define one or more named loggers. Messages written to the loggers can be given different levels of importance. For example, errors that occur in the driver can be written to a logger at the ERROR level, while progress or flow information can be written to a logger at the INFO or FINER level. Each logger used by the driver can be configured independently. The configuration for a logger includes what level of log messages are written, the location to which they are written, and the format of the log message.
The Java Logging API defines the following levels:
NOTE: Log messages logged by the driver only use the CONFIG, FINE, FINER, and FINEST logging levels.
Setting the log threshold of a logger to a particular level causes the logger to write log messages of that level and higher to the log. For example, if the threshold is set to FINE, the logger writes messages of levels FINE. CONFIG, and SEVERE to its log. Messages of level FINER or FINEST are not written to the log.
The driver exposes loggers for the following functional areas:
Driver to SQL Communication Logger
Name
com.ddtek.cloud.drivercommunication
Description
Logs all calls made by the driver to the SQL Engine and the responses from the SQL Engine back to the driver.
Message Levels
CONFIG - Errors and Warnings encountered by the communication protocol are logged at this level.
FINER - The message type and arguments for requests and responses sent between the driver and SQL Engine are logged at this level. Data transferred between the driver and SQL Engine is not logged.
FINEST - Data transferred between the driver and SQL Engine is logged at this level.
Default
OFF
SQL Engine Logger
Name
com.ddtek.cloud.sql.level
Description
Logs the operations that the SQL engine performs while executing a query. Operations include preparing a statement to be executed, executing the statement, and fetching the data, if needed. These are internal operations that do not necessarily directly correlate with Web service calls made to the remote data source.
Message Levels
CONFIG - Any errors or warnings detected by the SQL engine are written at this level.
FINE - In addition to the same information logged by the CONFIG level, SQL engine operations are logged at this level. In particular, the SQL statement that is being executed is written at this level.
FINER - In addition to the same information logged by the CONFIG and FINE levels, data sent or received in the process of performing an operation is written at this level.
Web Service Adapter Logger
Name
com.ddtek.cloud.adapter.level
Description
Logs the Web service calls the driver makes to the remote data source and the responses it receives from the remote data source.
Message Levels
CONFIG - Any errors or warnings detected by the Web service adapter are written at this level.
FINE - In addition to the information logged by the CONFIG level, information about Web service calls made by the Web service adapter and responses received by the Web service adapter are written at this level. In particular, the Web service calls made to execute the query and the calls to fetch or send the data are logged. The log entries for the calls to execute the query include the Salesforce-specific query being executed. The actual data sent or fetched is not written at this level.
FINER - In addition to the information logged by the CONFIG and FINE levels, this level provides additional information.
FINEST - In addition to the information logged by the CONFIG, FINE, and FINER levels, data associated with the Web service calls made by the Web service adapter is written.
 
Configuring Logging
You can configure logging using a standard Java properties file in either of the following ways:
Using the JVM
If you want to configure logging using the properties file that is shipped with your JVM, use a text editor to modify the properties file in your JVM. Typically, this file is named logging.properties and is located in the JRE/lib subdirectory of your JVM. The JRE looks for this file when it is loading.
You can also specify which properties file to use by setting the java.util.logging.config.file system property. At a command prompt, enter:
java -Djava.util.logging.config.file=properties_file
where properties_file is the name of the properties file you want to load.
Using the Driver
If you want to configure logging using the driver, you can use either of the following approaches:
Use a different properties file for each embedded database. For example, if you have two embedded databases (johnsmith.xxx and pattijohnson.xxx, for example), you can load one properties file for the johnsmith.xxx database and load another properties file for the pattijohnson.xxx database.
NOTE: By default, the name of the embedded database is the user ID specified for the connection. You can specify the name of the embedded database using the DatabaseName property. Refer to “Connection Option Descriptions” in Chapter 21 of the DataDirect Connect Series for ODBC User’s Guide for details on using LogConfigFile and other connection options.
By default, the driver looks for the file named ddlogging.properties in the current working directory to load for all Salesforce connections. If the SQLEngineMode connection option is set to Server, the driver uses the ddlogging.properties file that is specified by the Server DB Directory connection option.
If a properties file is specified for the LogConfigFile connection option, the driver uses the following process to determine which file to load:
1
2
If the driver cannot find the file in Step 1, it looks for a properties file named database_name.logging.properties in the directory containing the embedded database for the connection, where database_name is the name of the embedded database.
3
If the driver cannot find the file in Step 2, it looks for a properties file named ddlogging.properties in the current working directory.
4
If the driver cannot find the file in Step 3, it abandons its attempt to load a properties file.
If any of these files exist, but the logging initialization fails for some reason while using that file, the driver writes a warning to the standard output (System.out), specifying the name of the properties file being used.
A sample properties filenamed ddlogging.properties is installed in the install_dir\samples subdirectory of your product installation directory, where install_dir is your product installation directory. For example, you can find the ddlogging.properties file in install_dir\Samples\Bulkstrm, install_dir\Samples\Bulk, and install_dir\Samples\Example. You can copy this file to the current working directory of your application or embedded database directory, and modify it using a text editor for your needs.