Data Access has been discontinued. Please refer to this page for more information.

How to: Enable Tracing and Logging with the Telerik® Data Access Visual Designer

This article is relevant to entity models that utilize the deprecated Visual Studio integration of Telerik Data Access. The current documentation of the Data Access framework is available here.

Telerik Data Access enables you to trace and log statements generated by the OpenAccessContext. You can enable that feature with just a few clicks. The purpose of this tutorial is to show you how to perform that task.

In order to enable the Tracing and Logging:

  1. Open your domain model in the Visual Designer.
  2. Right-click on the design surface and select Show Model Settings.

  3. The Model Settings Dialog appears.

  4. Navigate to the BackendSettings tab page and then to the Tracing and Logging tab page.
  5. The minimum settings you need to specify are:

    1. Ensure that the Enable Logging options is checked.
    2. Specify the LogLevel. The LogLevel setting serves as a filter - which statements will be written to the output file, and which won't. LogLevel.Error is the default value. This means that only serious errors (such as connections timing out) will be logged. LogLevel.Normal will log the most useful events that do not reduce performance significantly (e.g. SQL executed). For more information about the different LogLevels, please refer to Tracing and Logging.
    3. You could optionally include stack trace information by using the Include Stack Trace option.
    4. Check the Log Events to Text File setting. By default it is set to False.
    5. Specify a path to the output File Name. That will be the file name where all statements will be written in.

  6. Click OK to commit the changes.

  7. Build and run your application.
  8. In the following demonstration the LogLevel is set to Normal. A new instance of the domain model is created and all categories from the database are printed.

    using (EntitiesModel dbContext = new EntitiesModel())
    {
       foreach (Category category in dbContext.Categories)
       {
           Console.WriteLine(category.CategoryName);
       }
    }
    
    Using dbContext As New EntitiesModel()
     For Each _category As Category In dbContext.Categories
      Console.WriteLine(_category.CategoryName)
     Next _category
    End Using
    

    The content of the output log file should be similar to this:

    Log File 20100729 12:33:49 PM pmf.start     Log Level: all
    20100729 12:33:49 PM driver.con.connect     MultipleActiveResultSets=true;Pooling=false;
                                                Enlist=false;data source=.\SQLEXPRESS;
                                                initial catalog=Northwind;
                                                integrated security=True
    20100729 12:33:49 PM driver.con.connect     MultipleActiveResultSets=true;Pooling=false;
                                                Enlist=false;data source=.\SQLEXPRESS;
                                                initial catalog=Northwind;
                                                integrated security=True
    20100729 12:33:49 PM driver.con.isolation       40327891 READ_COMMITTED(2)
    20100729 12:33:49 PM driver.con.autoCommit      40327891 false
    20100729 12:33:49 PM driver.pool.alloc          active=1/10 idle=0/10 HP con=40327891
    20100729 12:33:49 PM driver.con.rollback        40327891
    20100729 12:33:49 PM driver.pool.release        active=0/10 idle=1/10 con=40327891
    20100729 12:33:49 PM pm.created
    
  9. All Logging settings are stored in the Backend Configuration section of your .RLINQ file. You could open your .RLINQ file in a XML editor and locate the Backend Configuration section.

    <BackendConfigurationSettings>
     <BackendConfiguration>
       <Backend>mssql</Backend>
       <Logging>
         <LogLevel>all</LogLevel>
         <LogFileName>C:\\MyLog</LogFileName>
         <LogToConsole>False</LogToConsole>
         <EventText>True</EventText>
       </Logging>
     </BackendConfiguration>
    </BackendConfigurationSettings>