Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / productivity / SharePoint

ULS Log Viewer

4.50/5 (3 votes)
12 Sep 2012CPOL3 min read 60K  
Exploring the SharePoint 2010 free tool, ULS Log Viewer.

Introduction

In this article we can explore the SharePoint 2010 free tool ULS Log Viewer. This is a tool from Microsoft and we are free to use it, but there is no customer support for any issues or queries.

What is logging?

Eventually in the life cycle of a SharePoint deployment the Administrator and Developer need to look into the log information of SharePoint. There are basically three kinds of log information to look for.

  1. SharePoint 14 hive LOGS folder where the SharePoint log information is kept.
  2. IIS web application log files inside the INETPUB LOGS folder.
  3. Windows event log where the Service Application log information is kept.

What is ULS?

ULS represents Unified Logging Service and it captures the following:

  • Exceptions of SharePoint
  • Logs by applications

The unified logging is stored in .log files in the 14 HIVE > LOGS folder. The unified view helps in understanding problems in the order of activities.

Note: The SPDiagnosticsBase class in the namespace Microsoft.SharePoint.Administration enables writing Trace Logs in SharePoint 2010. This is the preferred way for SharePoint 2010 and it includes the WriteTrace() and WriteEvent() methods to be overridden.

Who is the intended audience?

This tool can be used by the following types of audience:

  1. SharePoint Administrators
  2. Developers
  3. Architects

Download

You can download the tool from the following location: http://archive.msdn.microsoft.com/ULSViewer.

On opening the above link you should get the following page:

Image 1

Click on the Downloads tab and download the file shown.

Image 2

How to view the LOGS files?

We are actually interested in the first option of looking into the SharePoint 14 hive LOGS folder. You can open the folder and see that there are a number of log files as shown below.

  • C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS

Image 3

The latest log file (sorted by date) should contain the latest log information as shown below:

Image 4

So there involves a bit of clumsy tasks to view the log information of SharePoint.

What are the advantages of this tool?

The ULS Log Viewer tool provides the following advantages:

  1. A better user interface to view the log information.
  2. Filtering of log levels based on Basic, High, Verbose, etc.
  3. Formatting of log information.
  4. Real time log information viewing.
  5. Exporting log information to CSV files.
  6. Multiple machine log viewing.
  7. It is free.

Starting with the tool

After downloading, you can execute the tool. The main screen looks like that shown below.

Image 5

Viewing a log file

You can use the File > Open from > File menu to open a log file from the 14 hive LOGS folder.

Image 6

As you can see, there are Time, Server, Process, Product, Category, Level information for each row listed.

Filtering rows

You can filter the rows using the toolbar buttons. The rows will be filtered accordingly.

Image 7

Real time tracing

Another advantage of the tool is real time tracing. We can see real time log messages by watching the tool. For monitoring a folder for real time log messages, use the File > Open From > ULS menu item.

Image 8

On enabling ULS monitoring, the Notifications List contains the source log file which contains the new log entries. Please note that the specified folder can contain multiple log files.

Click on the Notifications List to see the source file which contains the new log entries.

Command line

The real time mode can be started using command line too:

ULSLogViewer.exe realtime:FolderPath

Exporting to a file

We can also export selected lines to a file using the context menu.

Image 9

Smart highlight

The Smart Highlight button on the toolbar enables highlighting the contents of similar texts. For example, placing the mouse over Medium should highlight all the entries of type Medium.

Image 10

You need to click the Smart Highlight button to enable this view.

References

Summary

In this article we have explored the ULS Log Viewer tool. In real life scenarios this tool should give time, cost, and convenience advantages.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)