DataContext.Log property

Gets or sets an object that will write the Collaborative Application Markup Language (CAML) query that results from the translation of the LINQ query.

Namespace:  Microsoft.SharePoint.Linq
Assembly:  Microsoft.SharePoint.Linq (in Microsoft.SharePoint.Linq.dll)

public TextWriter Log { get; set; }

Property value

Type: System.IO.TextWriter
A TextWriter that can be called to write the CAML query.

The following example shows how to set the Log property to write the CAML queries to the console in a console application:

DataContext dc = new DataContext("http://localhost");
dc.Log = Console.Out;