Jean Paul's Blog

There are 2 types of People in the World, One who Likes SharePoint and..

  • Microsoft MVP

  • MindCracker MVP

  • CodeProject MVP

  • eBook on SharePoint 2010

  • eBook on Design Patterns

  • eBook on Windows Azure

  • NLayers Framework @ CodePlex

  • MSDN Forums

  • .Net vs. Java

    Due to Public Demand
  • Advertisements

Advantage of ULS Logging

Posted by Paul on July 9, 2013

Logging Information is required for Debugging in Production Deployments. In this article I would compare the usage of SharePoint ULS Logging along with regular Text File Logging.

ULS Logging Here we are using SPDiagnostics class for logging information.

Text Logging Here we are using a TextWriter and writing information to file.

uls log

Advantages of ULS Logging

Following are the advantages of ULS Logging:

1. Log Information can be controlled through Central Administration.

2. Built-in classes for writing log information.

3. Sophisticated Tools available for viewing log entries

While writing ULS Log Information, we need to specify Trace Severity & Event Severity.


Through Central Administration, we can control the Trace & Event Severity. Open Configure diagnostic logging from central administration.


You can filter the log information based on severity there:


Thus, even though our code will contain the Log Writing code, the actual writing only takes place based on the severity level allowed through Central Administration.

This gives the advantage of:

1. Turning On writing to log file through Central Administration when required

2. Turning Off writing to log file when debugging is completed

Sample ULS Logging Code

Following is a test logging code with Trace Severity as High.

SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(“Application”, TraceSeverity.High, EventSeverity.Error), TraceSeverity.High, “Message here”);

Following is a test logging code with Trace Severity as Verbose.

SPDiagnosticsService.Local.WriteTrace(0, new SPDiagnosticsCategory(“Application”, TraceSeverity. Verbose, EventSeverity.Error), TraceSeverity.Verbose, “Big Message here”);

Verbose severity is used to log too much information, for example writing the internal data structure for debugging purpose.


Although Verbose log writing code resides in the Production Deployed Assembly, it will not impact performance when the Central Administration settings is set to exclude Verbose logging.

ULS Log Viewer

You can download the ULS Log Viewer for more convenient viewing of ULS Log information.


You can download from:



In this article we have explored the advantages of using ULS Logging in SharePoint. In real world scenarios this provides more convenience & control in the amount of information logged. You can also use ULS Log Viewer for more flexible viewing options.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s