Powered by Zoomin Software. For more details please contactZoomin

DataDirect Connect for ADO.NET Data Provider Help

Logging Application Blocks

  • Last Updated: April 16, 2026
  • 5 minute read
    • ADO.NET
    • Documentation

Using the Enterprise Library Logging Application Block (LAB) makes it easier to implement common logging functions. DataDirect Connect data providers that support the ADO.NET Entity Framework use the standard Logging Application Block and design patterns, and offer LAB customizations for additional functionality.

To use features of the Enterprise Library with your data provider, download the Microsoft Enterprise Library. The Enterprise Library installation by default includes the Enterprise Library documentation, which contains detailed information about using the application blocks.

When Should You Use the LAB?

The DataDirect ADO.NET Entity Framework data providers include a set of LAB customizations that are useful for developing with the ADO.NET Entity Framework when you want to log the Command Trees and SQL generated when using the data provider.

Configuring the LAB

Logging capability can be added to an application by adding an entry to an application’s app.config or web.config configuration file using the Enterprise Library configuration tool. This tool contains specific instructions in order to enable the Logging Application Block config file. The tool also contains the necessary AppSetting to enable the LAB.

To enable Logging Application Block output, set the environment property DDTek_Enable_Logging_Application_Block_Trace to true. Also, in the app.config file, set the EnableLoggingApplicationBlock AppSetting property to true.

To disables the Logging Application Block, set either of these properties to false.

The following configuration XML snippet from the app.config file enables logging for the Oracle Entity Framework data provider.

<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">

The SQL logged to the Logging Block is the SQL that is ultimately transmitted to the data source.

The following procedure uses the configuration options for the .NET Framework 4.5.

To configure the Logging Application Block on any supported platform:

  1. Right-click on your project in Solution Explorer. Select Add / New Item. The Add New Item window appears.

  2. Select the Application Configuration File template. Then, click Add. The App.config file is added to the the project.

  3. Right-click the App.config file. Choose Edit Configuration File.

    Enterprise Library Configuration window

  4. The App.config file is displayed. Select Blocks / Add Logging Settings. Additional fields appear on the New Configuration window.

    New Configuration window with Logging Settings options displayed

  5. Add a flat file trace listener file:
    a. Click the Logging Target Listeners plus sign button (Plus sign button). Then, select Add Logging Target Listeners / Add Flat File Trace Listener.
    b. In the properties pane next to the File Name property, click the ellipsis button (Ellipsis button). The Open File window appears.
    c. Browse to the target location for the file. Then, type a file name for the trace listener file, and click Open. In this example, the file name is trace.log.

  6. Click the plus sign button (Plus sign button) to the right of the Categories heading; then, select Add Category. The Category section is expanded.

    The Categories section in the Enterprise Library Configuration window is expanded. The Category subsection shows the default settings.

  7. Define the characteristics of the new category:
    a. In the Name field, type the name of the new category. In this example, the category DDTek Error will be created.
    b. Click the plus sign button (Plus sign button) next to the Listeners heading. Then, select Flat File Trace Listener from the drop-down list.
    c. From the Minimum Severity drop-down list, select Error.

  8. Repeat Step 5 through Step 7 to create the following category:

    • DDTek Information: Information not related to errors

      The Enterprise Library Configuration window shows the configuration for a file named labconfig.config.

  9. Select File / Save As. The Save Configuration File window appears. Type a name for your configuration file.

Using the LAB in Application Code

The LAB that you configured must be added to the app.config or web.config file for your application.

The following table describes settings you can use to enable and configure the data provider's interaction with the LAB.

LAB Configuration Settings

Configuration Setting Description
enableLoggingApplicationBlock Enables the Logging Application Block.
labLogEntryTypeName Specifies the LogEntry type name for the LogEntry object.
labLoggerTypeName Specifies the Logger type name for the Logging Application Block.
labAssemblyName Specifies the assembly name to which the Logging Application Block applies.
Note: If you are using any version of the LAB other than the Microsoft Enterprise Library 6.0 binary release, you must set the labAssemblyName. For example, if you are using an older or newer version of the LAB, or a version that you have customized, you must specify a value for labAssemblyName.

The following code fragment provides an example of a Logging Application Block that could be added to an Oracle data access application.

<loggingConfiguration name="Logging Application Block"
tracingEnabled="true"
   defaultCategory="" logWarningsWhenNoCategoriesMatch="true">
   <listeners>
      <add fileName="rolling.log"
         footer="----------------------------------------"
         header="----------------------------------------"
         rollFileExistsBehavior="Overwrite"
         rollInterval="None" rollSizeKB="0"
         timeStampPattern="yyyy-MM-dd"
            listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
               traceOutputOptions="None" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
               name="Rolling Flat File Trace Listener" />
      </listeners>
      <formatters>
         <add template="Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity: {severity}&#xD;&#xA;title:{title}&#xD;&#xA;&#xD;&#xA;"
original_filename: enterpriselib.06.3.md
               type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
               name="Text Formatter" />
      </formatters>
      <categorySources>
            <add switchValue="All" name="DDTek">
               <listeners>
                  <add name="Rolling Flat File Trace Listener" />
               </listeners>
            </add>
         </categorySources>
         <specialSources>
            <allEvents switchValue="All" name="All Events" />
            <notProcessed switchValue="All" name="Unprocessed Category" />
            <errors switchValue="All" name="Logging Errors &amp; Warnings">
               <listeners>
                  <add name="Rolling Flat File Trace Listener" />
               </listeners>
            </errors>
          </specialSources>
   </loggingConfiguration>

Using Different Versions of the Logging Application Block

By default, the Entity Framework data providers use the Enterprise Library 6.0 Logging Application Block. If you need to use a different version of the Logging Application Block, you can specify the labAssemblyName setting in your .config file.

See Specifying Enterprise Library Version Information in the .config File for more information.

TitleResults for “How to create a CRG?”Also Available inAlert