Tracing Method Calls
- Last Updated: April 16, 2026
- 2 minute read
- ADO.NET
- Documentation
Tracing capability can be enabled either through environment variables or the provider-specific Trace class. The data provider traces the input arguments to all of its public method calls, as well as the outputs and returns from those methods (anything that a user could potentially call). Each call contains trace entries for entering and exiting the method.
During debugging, sensitive data can be read, even if it is stored as a private or internal variable and access is limited to the same assembly. To maintain security, trace logs show passwords as five asterisks (*****).
Using Environment Variables
Using environment variables to enable tracing means that you do not have to modify your application. If you change the value of an environment variable, you must restart the application for the new value to take effect.
The following table describes the environment variables used to enable and control tracing.
Environment Variables for Tracing
| Variable | Description |
| DDTek_Trace_File | Specifies the path and name of the trace file, for example, \ProviderNameTrace.txt. |
| DDTek_Recreate_Trace | When set to 1, re-creates the trace file each time the application restarts. When set to 0 (the initial default), the trace file is appended. |
| DDTek_Enable_Trace | When set to 1 or higher, enables tracing. When set to 0 (the initial default), tracing is disabled. |
| DDTek_XA_Trace_File | When set to 1, enables tracing of the Helper library. When set to 0 (the initial default), tracing of the Helper library is disabled. |
| DDTek_Enable_Logging_Application_Block_Trace | When set to 1, enables tracing of the Logging Application Block. When set to 0 (the initial default), tracing of the Logging Application Block is disabled. |
Note: If tracing is enabled and no trace file is specified by either the connection string option or the environment variable, the data provider saves the results to a file named DDTekTrace.txt.
Using Static Methods
Some users may find that using static methods on the data provider’s Trace class to be a more convenient way to enable tracing.
The following C# code fragment uses static methods on the .NET Trace object to create a SybaseTrace class with a trace file named MyTrace.txt. The values set override the values set in the environmental variables. All subsequent calls to the data provider will be traced to MyTrace.txt.
SybaseTrace.TraceFile="C:\\MyTrace.txt";
SybaseTrace.RecreateTrace = 1;
SybaseTrace.EnableTrace = 1;
The trace output has the following format:
<Correlation#> <Timestamp> <CurrentThreadName>
<Object Address> <ObjectName.MethodName> ENTER (or EXIT)
Argument #1 : <Argument#1 Value>
Argument #2 : <Argument#2 Value>
...
RETURN: <Method ReturnValue> // This line only exists for EXIT
where:
Correlation# is a unique number that can be used to match up ENTER and EXIT entries for the same method call in an application.
Value is the hash code of an object appropriate to the individual function calls.