The Unified Logging System (ULS) logs are one of the developer's and administrator's best friends when troubleshooting SharePoint. But as anyone who has ever browsed through ULS logs can attest, their readability leaves something to be desired. In this blog, I'll review two solutions to improve the readability and searchability of ULS logs: Microsoft's own, unsupported ULS Viewer and a competing ULS viewer offered by Stefan Gordon.
Let's start with the Microsoft offering.
ULS Viewer by Microsoft
The Microsoft ULS Viewer can be obtained at http://archive.msdn.microsoft.com/ULSViewer. The first thing to note is that this is an unsupported application developed by Microsoft, probably initially for internal use only. There is no installer, only a single downloadable executable. I actually prefer solutions such as this, as I don't want my registry cluttered up with entries for such a small, single-purpose program. Here is a screenshot of the ULS Viewer.
The ULS Viewer does most things you would expect of such a program, namely creating a distinct item for each entry in the ULS logs, breaking those entries into fields such as the timestamp of the log event and the event description, and allowing the user to filter the list of items based upon the values of those fields. To start, open the ULS logs either from one or more files (located typically at C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\14\LOGS) or - and this is a cool feature - from a location called "ULS". The "ULS" option will scan the default logfile location, or some other location if the latter is inaccessible, in real-time and add events to the Viewer as they happen.
Once events have been loaded into the Viewer they can be filtered and searched. To create a filter navigate to Edit->Modify Filter. In the pop-up windows, you can create filters on Viewer fields that use a certain operator. For example, if I wanted to search for the string "IncomingEmail" in the message text of the ULS event, I would select "Message" as the field to use in my filter, then use the Contains operator, and enter "IncomingEmail" as the Value. Click "Okay" and the filter becomes active, leaving only those ULS items that match the filtering criterion.
There is much more to the Microsoft ULS Viewer that I will not go into, but it is a great tool and one of the first things I add to a SharePoint server after installing SharePoint. However, I must say that the ULS Viewer has crashed on me in a few cases, so it definitely is not a RTM-quality product as Microsoft themselves advertise.
SharePoint ULS Viewer by Stefan Gordon
Stefan Gordon's SharePoint ULS Viewer can be obtained at http://ulsviewer.codeplex.com/. This product is not associated with Microsoft at all and similarly is a stand-alone executable. Also similarly to the Microsoft ULS Viewer, Stefan Gordon's ULS Viewer can load ULS logs and display each log entry as a separate item and break down each item into distinct fields.
In contrast, this ULS Viewer is much simpler than the Microsoft offering, not allowing for real-time event population and the creation of arbitrary filters. Stefan Gordon's ULS Viewer does offer three canned filters by Severity, Process, and Category, as well as text search on all fields. For many cases, this is all you would need to search through your ULS logs, and in this case, Stefan Gordon's offering is simpler and in my experience more stable.
I have had the experience that Stefan Gordon's ULS Viewer was unable to load a logfile that Microsoft'sULSS Viewer could load, but not vice versa. For this reason and for the greater flexibility offered by Microsoft's ULS Viewer I prefer the latter. If you are in need of a super-lightweight ULS viewer and simply want a better interface than Notepad, Stefan Gordon's ULS Viewer is a great choice.
Learn more about DMC's web application development services.