The new logging feature for ASE OLE DB Provider allows you to track an application’s database access by logging calls to the OLE DB public API.
You enable the logging feature by creating a registry entry that identifies a configuration file. The configuration file is a properties file that allows you to log all calls to OLE DB, or limit logging to a specified subset of the API.
To enable the logging feature
Create a properties file. For example:
### --- Begin oledblog.properties ---
#----------------------------------
#Configure loggers
# by default turn everything off. Change this to "=TRACE, OLEDB_LOGFILE"
# to default to logging to a file
log4cplus.rootLogger=OFF, NULL
# We want to log the OLEDB API calls to a log file
# change this to ="OFF,NULL" if you only want to log certain methods
log4cplus.logger.com.sybase.dataaccess.oledb=TRACE, OLEDB_LOGFILE
log4cplus.additivity.com.sybase.dataaccess.oledb=false
# We don't want to log the IUnknown::AddRef and Release calls
log4cplus.logger.com.sybase.dataaccess.oledb.IUnknown.AddRef=OFF, NULL
log4cplus.additivity.com.sybase.dataaccess.oledb.IUnknown.AddRef=false
log4cplus.logger.com.sybase.dataaccess.oledb.IUnknown.Release=OFF, NULL
log4cplus.additivity.com.sybase.dataaccess.oledb.IUnknown.Release=false
# Other OLEDB interface can be turned on and off as well
# You can turn on (or off) logging of all methods on a given interface
# by configuring:
# log4cplus.logger.com.sybase.dataaccess.oledb.<InterfaceName>=???
# You can get more specific and only log (or turn off logging for) a
# specific method:
log4cplus.logger.com.sybase.dataaccess.oledb.<InterfaceName>.
<MethodName>=TRACE, OLEDB_LOGFILE
#-------------------------------------
#Configure logging appenders
# Throw away all log messages
log4cplus.appender.NULL=log4cplus::NullAppender
# Send log messages to the console
log4cplus.appender.STDOUT=log4cplus::ConsoleAppender
log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout
### Modify this line to define the output format
log4cplus.appender.STDOUT.layout.ConversionPattern=%m%n
# Write the log messages to a file
log4cplus.appender.OLEDB_LOGFILE=log4cplus::FileAppender
log4cplus.appender.OLEDB_LOGFILE.layout=log4cplus::PatternLayout
log4cplus.appender.OLEDB_LOGFILE.ImmediateFlush=true
### Modify this line to define the output format
log4cplus.appender.OLEDB_LOGFILE.layout.ConversionPattern=%m%n
### Modify this line to specify the file to save the log to.
log4cplus.appender.OLEDB_LOGFILE.File=c:\temp\oledb.log
### --- End oledblog.properties ---
For more information on creating a properties file,
refer to the log4cplus project page.
Create a registry entry:
HKEY_CURRENT_USER\Software\Sybase\OLEDB Provider
LogConfigFile=<path to properties file>
Restart the application you want to log. Upon restart, the application begins to log to the log file specified in the properties file.
To disable the logging feature, delete the registry
entry created in Step 2.