Showing posts with label IntelliTracing in SharePoint. Show all posts
Showing posts with label IntelliTracing in SharePoint. Show all posts

Monday, June 17, 2013

Debugging SharePoint production environment by using IntelliTraceCollector

I have experienced many times that my code works in Dev environment and it will not work in UAT or Production, causes quarrel between me and my QA. We can’t install the development tools and debug the code in production environment due to many reasons. Most of the cases I was used to write log files in the code itself to log the exception. These logs help me to fix the issue in production environment.  Now we have a tool that allows us to collect diagnostics data from production environment without installing Visual Studio. We have IntelliTraceCollection.cab located in C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\ IntelliTrace\11.0.0.

MS people introduced intellitracing in VS 2010 ultimate edition. By using this feature we can get all ASP.net, ADO.net events and exception details. In VS 2012 we have standalone collector with .cab file. We can also download the .cab file separately.

We can check the exception in production environment running in IIS 7.0 and IIS 7.5 by using the intellitrace collector to save the data to an intellitrace .iTrace file. This will help us to check our application without installing VS. We can delete the controller by uninstalling it once we are done with collecting data because iTrace file will grow size very fast, this may effect for production environment.
To log the exceptions follow the steps below,
  • Download intellitraceCollector.cab for VS 2012 from here 
  • Copy the cab file into some other location like D:\Intellitrace
  • Expand using D:\Intellitrace>expand /f:* IntelliTraceCollection.cab. D:\intellitrace. Here “.” is used to maintain the folder structure  
  • To start collecting data use following PowerShell command,
    • Start-IntelliTraceCollection <AppPool>
  • To stop collecting data use following PowerShell command,
    • Stop-IntelliTraceCollection <AppPool>
Sample script to collect the data from SharePoint application in SharePoint-9999 application pool,


Start-IntelliTraceCollection "SharePoint - 9999" "D:\IntelliTraceCollector\collection_plan.ASP.NET.default.xml" “D:\IntelliTraceLogs"


Here “SharePoint-9999” is application pool, "D:\IntelliTraceCollector\collection_plan.ASP.NET.default.xml" is the path to collection path and “D:\IntelliTraceLogs” is folder to save the .trace files.


PathToCollectionPlan, is an xml file that will have the configuration settings for the collector. We have to specify the plan to collect the logs in SharePoint applications. “collection_plan.ASP.NET.default.xml” will collect IntelliTrace events, SharePoint events, DB calls, and Web server requests. “collection_plan.ASP.NET.trace.xml” will collects only function calls and all the data in collection_plan.ASP>NET.default.xml. We can check detailed analysis by using this plan.

We have to check the following things in intellitrace,
  • Permissions: We have to give full permissions to the web application or SharePoint application for .itrace file directory and also we have to restrict the account that not working with intellitrace.
  • File Size: We have to check the trace file sizes. Max file size will not be more than 100 MB.