This post is regarding new feature in the Visual Studio 2012 “IntelliTace Stand Alone Collector”. IntelliTrace Standalone Collector helps in generating IntelliTrace Logs (if you are already familiar with IntelliTace in Visual Studio 2010, which helps in debugging application where Visual Studio is installed) on a machine where Visual Studio is not installed (Production Server/Test Server) and then move thos log files into machine where you can analyze using Visual Studio 2012 (Dev machine).
This new feature is quite useful when you want to debug some Production/Test Issues which are not reproducible in Dev Environment or debugging environment and as a developer we see lot of those issues in our production environments.
There are 4 ways you can run the IntelliTrace to collect very rich logging information:
Here I will be explaining or detailing steps for Standalone using Powershell scripts which is quite useful to run on your Production Machines to get log information.
Step: 1 – Download the IntelliTraceCollection.cab file
Either you can download the cab file by going to Microsoft Download Center – link here or you can find the Cab file in your development machine where Visual Studio 2012 has been installed at the location “C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\IntelliTrace\11.0.0”.
Step: 2 – Copy the cab file on to production machine
Copy this cab file onto the machine where you would like to collect the IntelliTrace Logging information by creating a folder “C:\IntelliTraceCollection” and give Read & Write permissions for “BUILTIN\IIS_USRS”.
Step: 3 – Expand the Cab file
Run powershell command Expand to unzip the cab file. (Don’t do Unzip because it will spoil the folder structure and IntelliTrace will not workL)
Expand "C:\IntelliTraceCollection\IntelliTraceCollection.cab” –f:* C:\IntelliTraceCollection
Step: 4 – Start IntelliTraceCollection on ApplicationPool
Two steps here, first we will create a powershell script to start IntelliTraceCollection on AppPool and then cmd file which will execute the powershell script.
Also, create Output Path to hold Log files (iTrace Files).
# StartIntelliTrace.ps1 $Drive="C:\" $FolderName="IntellitraceCollection" Set-Location $Drive$FolderName Import-Module .\Microsoft.VisualStudio.IntelliTrace.PowerShell.dll $AppPool="ASP.NET v4.0" $OutputPath="Logs" $CollectionPlan=".\collection_plan.ASP.NET.trace.xml" start-IntelliTraceCollection $AppPool $CollectionPlan $OutputPath
Command Line Script:
powershell -File StartIntelliTrace.ps1
Save it as StartIntelliTrace.cmd and run from CommandPrompt.
Step: 5 – Run your tests to reproduce the error/exception.
Now once your IntelliTraceCollection has started either run your Integration Tests or your client to run the transactions and reproduce the issue while IntelliTraceCollection is running. Note that running IntelliTrace Collection with Collection Plan as Trace (Events and Call Information) has performance impact on your application.
Step: 6 – Stop IntelliTraceCollection on ApplicationPool
Once you reproduce the issue then you stop IntelliTrace collection on the machine. To do that following is the PowerShell script
#StopIntelliTrace.ps1 $Drive="C:\" $FolderName="IntellitraceCollection" Set-Location $Drive$FolderName Import-Module .\Microsoft.VisualStudio.IntelliTrace.PowerShell.dll $AppPool="ASP.NET v4.0" Stop-IntelliTraceCollection "$AppPool"
powershell -File StopIntelliTrace.ps1
Save it as StopIntelliTrace.cmd and run from CommandPrompt.
Step: 7 – Copy Log files to Dev machine and Analyze them using Visual Studio 2012 Ultimate.
Now after you have stopped the IntelliTrace Collection go to the Logs folder and copy the iTrace files onto your Developer machine. Right click on the log file and open using your Visual Studio 2012 Ultimate to analyze the great logging information provided by IntelliTrace.
First it opens the Summary Screen and then you go into each exception details and then Events and Call Information. You can even Step Into and Step Over the code for which you need hook up the Symbols. If you are using Team Foundation Server for source control then setting the option will automatically search for symbols and loads them along with log files.
How to debug using the IntelliTrace Logging Information: click here