Oracle 5.0 Reference Manual page 1940

Table of Contents

Advertisement

}
}
}
Further information on
Syntax". Further information on
was included with your connector.
20.2.5.14. Using the MySQL Connector/Net Trace Source Object
MySQL Connector/Net 6.2 introduced support for .NET 2.0 compatible tracing, using
objects.
The .NET 2.0 tracing architecture consists of four main parts:
• Source - This is the originator of the trace information. The source is used to send trace messages.
The name of the source provided by MySQL Connector/Net is mysql.
• Switch - This defines the level of trace information to emit. Typically, this is specified in the
app.config
• Listener - Trace listeners define where the trace information will be written to. Supported listeners
include, for example, the Visual Studio Output window, the Windows Event Log, and the console.
• Filter - Filters can be attached to listeners. Filters determine the level of trace information that will be
written. While a switch defines the level of information that will be written to all listeners, a filter can
be applied on a per-listener basis, giving finer grained control of trace information.
To use tracing a
MySQL Connector/Net you would use code similar to the following:
TraceSource ts = new TraceSource("mysql");
To enable trace messages, configure a trace switch. There are three main switch classes,
BooleanSwitch, SourceSwitch, and TraceSwitch. Trace switches also have associated with
them a trace level enumeration, these are Off, Error, Warning, Info, and Verbose. The following
code snippet illustrates creating a switch:
ts.Switch = new SourceSwitch("MySwitch", "Verbose");
This creates a SourceSwitch, called MySwitch, and sets the trace level to Verbose, meaning that
all trace messages will be written.
It is convenient to be able to change the trace level without having to recompile the code. This is
achieved by specifying the trace level in application configuration file, app.config. You then simply
need to specify the desired trace level in the configuration file and restart the application. The trace
source is configured within the
illustrates this:
<configuration>
...
<system.diagnostics>
<sources>
<source name="mysql" switchName="MySwitch"
Connector/Net Programming
conn.Close();
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
Console.WriteLine("Done.");
LOAD DATA INFILE
MySqlBulkLoader
file, so that it is not necessary to recompile an application to change the trace level.
object first needs to be created. To create a
TraceSource
system.diagnostics
switchType="System.Diagnostics.SourceSwitch" />
can be found in
Section 13.2.6,
can be found in the reference documentation that
section of the file. The following XML snippet
1920
"LOAD DATA INFILE
TraceSource
object in
TraceSource

Advertisement

Table of Contents
loading

This manual is also suitable for:

Mysql 5.0

Table of Contents