Turning On and Off DataDirect Spy Logging
- Last Updated: February 13, 2020
- 2 minute read
- DataDirect Connectors
- JDBC
- Salesforce 6.0
- Documentation
Once DataDirect Spy logging is enabled for a connection, you can turn on
and off the logging at runtime using the setEnableLogging method in the
com.ddtek.jdbc.extensions.ExtLogControl interface. When DataDirect Spy
logging is enabled, all Connection objects returned to an application provide an
implementation of the ExtLogControl interface.
The following code snippet shows how to turn off logging using
setEnableLogging(false).
import com.ddtek.jdbc.extensions.*
// Get Database Connection
Connection con = DriverManager.getConnection
("jdbc:datadirect:sforce://login.salesforce.com;User=abc@defcorp.com;
Password=secret;SecurityToken=XaBARTsLZReM4Px47qPLOS;
SpyAttributes=(log=(filePrefix)/tmp/spy_;logTName=yes;timestamp=yes)");
((ExtLogControl) con).setEnableLogging(false);
...
The setEnableLogging method only turns on and off logging
if DataDirect Spy logging has already been enabled for a connection; it does not set or
change DataDirect Spy attributes. See "Enabling DataDirect Spy" for information about
enabling and customizing DataDirect Spy logging.
If Java logging is also enabled and Java API logger levels in the
properties file are set to FINER or FINEST, the driver ignores the file settings of Spy logging and
logs all the logging information (Spy logs and Java logs) into the log file defined by the
Java logging config settings.
For example:
If both Spy logging and Java logging are specified in the URL:
LogConfigFile=C:\\props\\spy\\ddlogging_DD.properties;
SpyAttributes=(log=(file)spy.log;timestamp=yes)
FINER or
FINEST:# logger for web service adapter: use CONFIG, FINE, FINER, FINEST
datadirect.cloud.adapter.level = FINEST
# logger for sql engine: use CONFIG, FINE, FINER, FINEST
datadirect.cloud.sql.level = FINEST
# logger for jdbc spy: use FINER or FINEST
datadirect.jdbc.cloud.level = FINESTjava -Djava.util.logging.config.file=myfileThen both the Spy logs and Java logs will be logged into the log file
defined by the Java logging argument, which is myfile in
this example.
For more information about Java logging, see "Using Java Logging."