Tuesday, May 21, 2013

All About SharePoint 2010 ULS Logging

Posted in [SharePoint], [Technical] By Doug Allen @ 6/29/2011 9:14 PM

I use SharePoint’s ULS logs almost daily when supporting and administering SharePoint (2007 and 2010 for that matter).  Let’s look at what it is, and how it can help you troubleshoot issues in SharePoint 2010.

What is this “ULS Logging”?

Like most (but not all) features in SharePoint 2010, logging did get an upgrade from 3.0 / 2007.  First of all, what is ULS?  It stands for Unified Logging Service (ULS).  It is the engine that handles creating a detailed trace output of all of the events that occur in SharePoint.  It is dependent on the Windows service “SharePoint 2010 Tracing”.  By default, SharePoint creates these log files in the file system in the “14 hive”:

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

These log files are written by SharePoint in real-time and contain information regarding event logging per its configuration in Central Administration. 

New for 2010

SharePoint 2010 introduced some new features with regards to trace logs.  Here are some of the highlights.

Correlation IDs

One big struggle with the ULS logs is that they were very hard to try and find where a specific error occurred.  You might have known when it happened, but it was very difficult to find the correlating specific error in the actual log.  Microsoft introduced the concept of a Correlation ID.  The way this works is that every event in SharePoint is given a unique GUID string.  Related events are grouped together by the same Correlation ID.  So for a given event, all of the actions that take place have the same correlation ID.  This way, you are able to very easily find the grouping of events that relate to each other.  When an exception occurs, the Correlation ID is shown.  Once you have that ID, that is when you dive into the ULS logs.  We’ll go into detail on that shortly.

Correlation ID

Event Throttling

In 2007, the interface used to configure event throttling for events wasn’t all that great.  You had some flexibility to set the severity level logged by category, but it was a little clunky:

image

In 2010, it has been changed significantly to help make modifications easier, especially being able to determine what level of logging has been set for which categories.  You can also easily reset all modified settings back to default.  Typically these options are modified when you are troubleshooting an issue on a specific component.  Here’s what the new UI looks like:

image             image

Event Log Flood Protection

This is a new option for 2010.  This new feature, as it’s name implies, prevents the event log from being flooded with duplicated events.  This is just good practice to enable.

Trace Log Configuration

Here’s how the settings looked in 2007:

image

The trace log settings also got an upgrade in 2010. Here’s the same section in 2010.  They really got smart and gave us some options to be able to prevent the server from filling up with logs.  As I understand it, after the number of days to store log files has expired, it prunes the logs from day 1.  The next day it will prune day 2 and so on so that there will always only be 14 days worth of log files.  You also have a new option to be able to restrict the log files by file size as well.

image

Microsoft has some best practices for configuring these diagnostic logging settings on TechNet.  Now let’s take a look at how to use the ULS log files for troubleshooting.

ULS Usage

How to Configure the Tracing Settings

For the sake of this post, we are focusing on SharePoint 2010 so all steps are specific to the 2010 interface.  To configure ULS logging settings, you have to access Central Administration.  Under Monitoring, click Configure diagnostic logging. 

How to View the ULS Logs

The ULS log files are text files that SharePoint creates in the convention <servername-yyyymmdd-time>.log.  You could, in theory, use notepad to read the ULS logs.  I would advise against that if you want to retain your sanity.  Microsoft has provided (along with at least one on Codeplex) a viewer to look at the ULS log available here.  Between the two, I personally like one from Microsoft because it has more features and I just think is better.  In the viewer, you can either watch the ULS logs real time, or open a previous log file.

Troubleshooting with the ULS Logs

So when would you actually use all this?  Well, I’m sure in your life using SharePoint you will eventually encounter an error (sorry Microsoft, no one’s perfect).  When you see that dreaded error message, fret not!  If you’re not already, you’re going to have to remote on the SharePoint server.  Now open your trusty ULS log viewer.  You have two choices here to find the exact error in the ULS logs:

  1. Hopefully you will be able to reproduce the error at will.  So open the logs in a real time view, and find the error.
  2. Or, you can’t reproduce at will, so you will have to do a little hunting.  If you know about when it occurred, you can open a log file and search.

Let’s look at the ULS log viewer.  To open the logs in real time, click File –> Open From –> ULS

image

On the next dialog, choose the default option “Use ULS feed from default log-file directory”, then click Ok. Then watch the fun!  If you want to see a particular log, it’s just as easy.  Click File –> Open From –> File.  It defaults to the LOGS directory, and browse the list to find the ULS log file you want.  You can see the date/time, process, product and category, severity level, Correlation (remember that?) and a detailed message of each event. 

One of the cooler features that makes it easier to find the correlation ID is the correlation tree.  Click the button on the toolbar in the top right corner (Toggle Correlation Tree) which will open on the left.  Change the drop down to Correlation, and find the ID from the error.

image

You can of course search and find certain text if you’re looking for something specific.  One thing I’ve done a lot in the past is when troubleshooting the User Profile Service (and who hasn’t?).  You can filter the view by category like this:

image

This will only show events that relate to the User Profile Service.  When you provision a User Profile Service, there are a known certain events that you should see, and this makes it very easy to see and watch.  I encourage you to check out other features as well like the Smart Highlighting.  You can also change the level of events that are displayed. 

In another blog post, we’ll look at a related feature, the SharePoint Health Analyzer!  I hope this has been helpful, and encourages you to check out your ULS logs!

Popular tags: , ,

Comments

Got something to say? Join the discussion »
    Posted by Husain on 3/26/2013 3:21 PM
    Doug,

    Thank you for your reply.Appreciate your help
    Following are the answers to your question regarding the logging and services in the farm

    Current Setting: In Central Admin --> the logging level is set at default for everything (nothing bolded)
    Can't open the log files - Have you looked in the logs to see what they are logging?

    What services are running on the WFEs that the app server is not?

    Services running on WFE (these services are running on App Server also)
    Microsoft SharePoint Foundation Incoming E-Mail
    Microsoft SharePoint Foundation Web Application
    Microsoft SharePoint Foundation Workflow Timer Service
    Search Query and Site Settings Service
    SharePoint Server Search

    Running on WFE only
    Microsoft SharePoint Foundation Sandboxed Code Service

    Thank You
    Husain

    Posted by Doug Allen on 3/25/2013 10:59 PM
    Husain,

    If you look in Central Admin, is the logging level default for everything (nothing bolded)? If the logging level is turned up on one of the web-based components, that would explain part of it. Have you looked in the logs to see what they are logging? What services are running on the WFEs that the app server is not?

    Doug
    Posted by Husain on 3/25/2013 2:46 PM
    Hello Team,

    The SharePoint Log files on Web servers are growing large - size about 900MB to 1GB +
    But Log files on Application Server is normal.

    Please can you help us to idendity what config change might be causing the SharePoint Logs on WFE Server grow large.

    Thank you appreciate your help
    Husain

leave a reply

 [Quick Submit with Ctrl+Enter]

Remember my details
Notify me of followup comments via e-mail

C5_Insight

About C5 Insight

We are a Microsoft Gold Certified partner focusing on SharePoint, Microsoft Dynamics CRM and Salesforce.com.  Learn more about us by visiting our website.

Search

We Wrote the Bible on Microsoft SharePoint and Dynamics CRMBook-Microsoft Dynamics CRM 2011 and SharePoint 2010 Bible

Tags

Maximize

Recent Comments

Maximize

Blog Roll

Maximize

Disclaimer

The information herein may be used solely at your own risk.  No warranty is made by the author or by C5 Insight, Inc.

The opinons expressed herein are those of the individual authors and do not necessarily represent C5 Insight, Inc in any way.

Copyright 2011 by C5 Insight