IntelliTrace
collector can be used to collect diagnostic data in environments such as QA or production
where Visual Studio is not present. IntelliTrace collector generates a log file
with the extension .iTrace which can be opened in Visual Studio Ultimate edition
to start an IntelliTrace debugging session.
To
use this feature, we need to do one time setup in the environment that we are
going to run it. To start we need IntelliTraceCollection.cab file which comes
with the Visual Studio 2012 installation. (In my case it was in C:\Program
Files (x86)\Microsoft Visual Studio
11.0\Common7\IDE\CommonExtensions\Microsoft\ IntelliTrace\11.0.0\IntelliTraceCollection.cab).
Setup:
1.
Add the Windows feature “Windows PowerShell Integrated Scripting Environment”
2.
Get a copy of IntelliTraceCollection.cab file and with Windows PowerShell use
the command “expand /f:* IntelliTraceCollection.cab .” to extract the cab file.
3.
Install the IntelliTrace PowerShell cmdlets with the PowerShell command Import-Module
<IntelliTraceCollection.cab extracted directory>\ Microsoft.VisualStudio.IntelliTrace.PowerShell.dll.
That’s
all about setup.
Collect diagnostic
data:
Let’s
say there is an error in a custom SharePoint webpart.
1.
To start collecting data, open a PowerShell window as administrator and run the
command Start-IntelliTraceCollection "<Application Pool name>"
<Path to Collection Plan XML in IntelliTraceCollection.cab extracted directory>
<Full path to Trace log save directory>
2.
Confirm with “y” when prompted.
3.
Reproduce the problem (refresh the page in above case)
4.
Once the exception is thrown, stop the trace collection with PowerShell command
Stop-IntelliTraceCollection "<Application Pool name>"
5.
Confirm with “y” when prompted.
6. Now check the specified directory to save the iTrace log file. If
we repeat this recording, it will generate new files with a unique name each
time. Pick the latest file.
7.
Copy .iTrace file to an environment with Visual Studio Ultimate edition and
double click it to open. Visual Studio will show the IntelliTrace Summary page
where we can review events or start debugging with IntelliTrace.
Here
we can go to the level where our code is open and exact line where the
exception is thrown is highlighted. See more information on debug withIntelliTrace Log in MSDN here.
Note:
iTrace log files are pretty big, so remember to stop trace once done otherwise collector
might continue collecting data consuming disk space and server resources. Also
tips on how to optimize IntelliTrace data collection on production servers arehere.
No comments:
Post a Comment