What's New: ULS Logging

Applies to: SharePoint Foundation 2010

This topic introduces the new logging features available to Microsoft SharePoint Foundation 2010 developers, as well as the improvements made to the existing logging mechanisms.

New for Logging

The following features are new to logging in SharePoint Foundation.

SPMonitoredScope

The SPMonitoredScope is a code attribute that, when applied to a class or method, allows a developer to write logging information to the SharePoint Foundation usage database with complete application information and custom strings.

Request Usage Database

The request usage database allows the capture of every SharePoint Foundation resource request that is made as a page is rendered.

Developer Dashboard

The developer dashboard is a utility that a developer can enable when debugging a SharePoint Foundation Web page. Similar in concept to ASP.NET tracing, this dashboard displays all the details of the request to the user.

API Improvements

In Windows SharePoint Services 3.0, the only way to write to SharePoint Trace Logs and Unified Logging System (ULS) Logs was to implement the IDiagnosticsManager interface, which required additional code to implement. However, in SharePoint Foundation, the preferred method is to use the SPDiagnosticsServiceBase class, which contains simpler and more efficient ways to interact with ULS Logs, specifically, the WriteEvent and WriteTrace methods that are simple to implement.