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:
-
Right-click on your project in Solution Explorer. Select Add / New Item. The Add New Item window appears.
-
Select the Application Configuration File template. Then, click Add. The App.config file is added to the the project.
-
Right-click the App.config file. Choose Edit Configuration File.

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

-
Add a flat file trace listener file:
a. Click the Logging Target Listeners 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 (
). 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. -
Click the plus sign button (
) to the right of the Categories heading; then, select Add Category. The Category section is expanded.
-
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 (
) 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. -
Repeat Step 5 through Step 7 to create the following category:
-
DDTek Information: Information not related to errors

-
-
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}
Category: {category}
Priority: {priority}
EventId: {eventid}
Severity: {severity}
title:{title}

"
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 & 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.