ULS (The Ugly Log Stream) Is No More

Any SharePoint administrator or developer has been faced with ugly task of digging through the ULS (officially known as Unified Logging Service, to me as the Ugly Log Stream) looking for clues as to why "Unexpected Error.." is being thrown. Most often this involves opening the ULS in some sort of text editor, and trying to maneuver around as best you can to pinpoint the cause of the issue.

Because this is such a daunting task, I’ve been on the lookout for a magical solution to turn the ULS from the Ugly Log to the Unbelievable Log. The first place I looked was on CodePlex, where I found a few, but nothing that made me say, "Wow!"

I then stumbled across the ULS Viewer in the MSDN Code Gallery and knew my life had just become infinitely easier. As I said, this gem of an application can be found in the MSDN Code Gallery under ULS Viewer. It hasn’t been updated since October 2009, but I have had no problems using it with Server 2008 R2 and SharePoint 2010, instances of MOSS 2007 on 32-bit hardware, or Windows 7 and XP. The biggest issue people have reported is date formatting issues with non English culture settings. I am going to pull out a few of the features that I have found to be most helpful, but in no way is this going to be a complete list of the different options that are available to you.

To start with, the ULS Viewer is a small executable 500MB in size, that doesn’t require any installation. Just double click and your up and running in ULS heaven. With this size it won’t be hard to added it to your USB stick and have it with you always. (I think we can all spare 500MB on our 8 or 16 GB sticks we all have…or can afford to skip the coffee for a week to get ourselves one.) In addition, to not having to install anything, as long as you have access via the network to the log location of your SharePoint server, there is no need to even log onto the SharePoint Application server. (Another point for this little baby.)

To view your logs you have two options. The first is to open a log file via File -> Open From -> File, which allows you to open any defined file in a the given browsed to location. This is excellent if you are wanting to view a PSConfig log file or historical ULS log files. The second option is to open File -> Open From -> ULS is were this really shines. You provide the path to your SharePoint log files and it will automatically refresh the screen as new lines are logged. No longer must you close and reopen, or refresh the screen. In addition, when using viewing via the ULS option, you can pause the live stream and start it back up as you want.

The next feature I find great is the ability to view only certain message types. By default all the message types are shown, which are VerboseEx, Verbose, Medium, and High. Sadly, there is not a single button to filter out Warning type messages, but this can be easily achieved via the filtering system provided.

Which leads into the next super sweet feature…the ability to filter messages so you only have to look at those that apply to the current issue your investigating. You have the ability to filter all of the columns with standard contains, begins, not equals…and even regex expression matching. To make it even cooler you can save different filter sets off, to use again or to share amongst teammates investigating the same issue.

SharePoint provides the Correlation ID for error messages as a way for us to easily identify what message(s) in the log are related to the error, but often it is hard to locate all the related messages as they are rarely all clumped in a group. Well, ULS Viewer makes this easier for us to, by providing the Correlation Tree. This beauty l will list all of the correlation ids currently in the log file or that have already been shown if live streaming the ULS, you then can select the ID you want…poof…all logged messages related are shown, no more hunting with the Find to make sure you have seen all the messages.

BUT wait there’s more!!!!!
Also, provided to make finding related or specific messages is the ability to format the display. This includes the basics of which columns to show and the default size of said columns, but it gets better. You can establish filter rules which will then highlight that line in your chosen color, and just like the filter options you can save these off to use later or share. If you don’t want the entire line, you can even designate certain column to be highlights. By default it even highlights any critical level messages for you.
If the bells and whistles I’ve pulled out haven’t at least peaked your interest, maybe the simple yet great features will sell you on the ULS Viewer. When ever a line is selected the top frame of the window will display the entire message column in clean wrapped text. Now we don’t have to scroll forever left and right or try to determine what is wrapped text or a new line in the log. Of course, it even goes a step further, and if you double click a line in the ULS, you get a nice dialog box which breaks all of the columns down for you to easily view or even share.
Everyone knows you have to view the ULS Log at least once for any given SharePoint project, but it shouldn’t be something to hate. With the ULS Viewer the ULS Log is no longer a last phase in issue resolution, but becomes an excellent first stop in an investigation. The ULS Viewer can be downloaded from the MSDN Code Gallery at http://code.msdn.microsoft.com/ULSViewer.


Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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

This site uses Akismet to reduce spam. Learn how your comment data is processed.