Showing posts with label ULS Log Viewer. Show all posts
Showing posts with label ULS Log Viewer. Show all posts

Saturday, 29 November 2014

ULS Log Viewer in Sharepoint 2010


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 SharePoint log information. There are basically 3 kinds of log information to look for; they are:

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

The 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 14 HIVE > LOGS folder. The unified view helps in understanding the problem in the order of activities.

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

Who is the Intended Audience?

This tool can be used by the following type 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

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
view-the-LOGS-files.jpg

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

latest-log-file.jpg

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 advantage:

  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 of Log Information to CSV files
  6. Multiple Machine Log viewing
  7. It is Free
Download

You can download the tool from following location:

http://archive.msdn.microsoft.com/ULSViewer

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

ULS-Viewer.jpg

Click on the Downloads tab and download the file shown.

ULS-Viewer-initial-release.jpg

Starting with the Tool

After downloading you can execute the tool. The main screen looks such as shown below.

tools-ULS-viewer.jpg

Viewing a Log file

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

Viewing-a-Log-file.jpg

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

Filtering the Rows

You can filter the rows using the tool bar buttons:

Filtering-the-Rows.jpg

The rows will be filtered accordingly.

Filtering-the-Rows1.jpg

Real time Tracing


Another advantage of the tool is Real Time Tracing. We can see the 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.

Real-time-Tracing.jpg

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 new log entries.

Command Line

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

ULSLogViewer.exe realtime:FolderPath

Exporting to File


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

Exporting-to-File.jpg

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.

Smart-Highlight.jpg

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

References

http://tinyurl.com/sp2010-ulsdoc

Summary

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


Reference:

http://www.c-sharpcorner.com/UploadFile/40e97e/uls-log-viewer-in-sharepoint-2010/

ULS Log Viewer - Part 2


In continuation of Part 1 on the ULS Log Viewer we will see more options to sort and filter errors in the ULS Log Viewer. The ULS Log Viewer is a very basic tool to monitor errors, warnings and issues in a SharePoint Farm.
You can filter errors by using the Text Filer. Enter "error" in the text filter and you will get filtered results as shown in Figure 4.

ULS -Log-Viewer-1.jpg
Figure  SEQ Figure \* ARABIC 4: Filtering Errors in Log Viewer

Since the log file becomes bulky the filtering helps the SharePoint administrator to focus on issues in the farm. You can also filter on the Category drop down to get category-wise errors as shown in Figure 5.

ULS -Log-Viewer-2.jpg
Figure  SEQ Figure \* ARABIC 5: ULS Viewer - Category Wise Errors List

If there are errors in your custom web controls then they will also be seen in the log viewer as shown in Figure 6.

ULS -Log-Viewer-3.jpg
Figure  SEQ Figure \* ARABIC 6: ULS Viewer - Custom Web Controls Error

The ULS logs are a very important source of information to debug the errors, warnings and issues in the SharePoint Farm. Developers can use the SPDiagnosticsServiceBase.WriteTrace method in their code to write logging information to the logs with complete application information and custom strings.

When writing a trace log using the ULS API, you must specify a severity level. The severity level is displayed in the ULS trace log and is commonly used by reporting or filtering tools.
ULS Level Name Level ID Description
Unexpected 10 Similar to an Assert (an assumption in code that a condition is true at a particular point), this message indicates that a logic check failed that is atypical, or the message returns an unexpected error code. These generally represent code bugs that should be investigated and fixed.
Monitorable 15 Traces that indicate a problem, but do not need immediate investigation. The intent is to collect data and analyze it over time, looking for problem trends.
High 20 General functional detail, the high priority events that happen in the environment. Examples include global configuration modifications, service start and stop, timer jobs completed, and so on.
Medium 50 Useful to help support or test teams to debug customer or environmental issues. These likely include messages indicating that individual features have succeeded or failed, such as creating a new list, modifying a page, and so on.
Verbose 100 Useful primarily to help developers debug low-level code failures. Not generally useful to anyone who does not have access to source code or symbols.
VerboseEx 200 Useful for traces that are likely to be high volume, especially information that is not needed for all debugging scenarios.

Summary
The ULS Log Viewer is a very basic tool to monitor errors, warnings and issues in a SharePoint Farm. There are many shortcomings of this tool, such as determination of the related details of an error or warning is cumbersome, also determining what is transpiring on the wire as in the case of services, workflows and apps is difficult. In the absence of any other you can use this tool.

References
http://msdn.microsoft.com/en-us/library/ff512746(v=office.14).aspx

Reference:

http://www.c-sharpcorner.com/UploadFile/d2ee01/uls%C2%A0-log-viewer-part-2/

ULS Log Viewer - Part 1


One of the very basic tools to monitor issues in a SharePoint Farm is the ULS Log Viewer. The Unified Logging Service (ULS) logs in SharePoint 2013 track server-side and client-side activities in the farm. Application life cycle and diagnostics information is captured in these logs. The data gathered in the ULS logs depends on the logging settings, the highest level being the most verbose. The logging settings can be changed from "Central Admin" --> "Monitoring" --> "Configure diagnostics Logging" and chose the level of logging, in other words, Warning, Critical, and Verbose as shown in Figure 1.

ULS -Log-Viewer-1.jpg

Figure  SEQ Figure \* ARABIC 1: Logging Settings

If Verbose log setting is enabled then that is great for debugging but not good for the performance of the SharePoint Farm. After debugging make sure to reset the log settings.

The logs are stored by default in the "..[15]\logs" folder. Your custom full trust solution can also write information to the ULS logs. Since custom solutions require full trust, this cannot be done in the cloud version of SharePoint.
You can use PowerShell to filter the data, display it in various ways, and output the data to a data grid with which you can filter, sort, group, and export data to Excel 2013.
The following PowerShell command opens the log in a filterable, searchable data grid in a separate window as shown in Figure 2.
Get-SPLogEvent | Out-GridView

ULS -Log-Viewer-2.jpg

Figure  SEQ Figure \* ARABIC 2: Example of ULS Log as Grid View

To export grid data to a spreadsheet, select the rows that you want to export. You can select multiple rows by using SHIFT+DRAG to select a block of rows, CTRL+CLICK to select specific rows, or CTRL+A to select all rows. Copy the selected rows and then paste the copied rows into the Excel spreadsheet.
You can also filter and sort the results before you copy the data into a spreadsheet. When you sort or filter data, only the resulting viewable data is copied over.
I've personally found the Stefan's utility very useful, as shown in Figure 3. The only drawback being, you cannot copy the data in Excel for doing further analysis. You can use this ULS Log Viewer available from CodePlex to filter the data, display it in various ways, and output the data to a data grid with which you can filter, sort, group, and export data to Excel 2013.
You can download the viewer from: http://ulsviewer.codeplex.com/
ULS -Log-Viewer-3.jpg
 
 Figure  SEQ Figure \* ARABIC 3: Stefan Gordon's ULS Viewer Snapshot

Rference:

http://www.c-sharpcorner.com/UploadFile/d2ee01/uls%C2%A0log-viewer-part-1/