Using SPMonitoredScope, Counters and SPCriticalTraceCounter

Something that I don’t always remember – you can use the SPMonitoredScope class to monitor your SharePoint code as it executes. The results then get sent to the Developer Dashboard and ULS logs. There’s a decent description of it on MSDN.

using (new SPMonitoredScope("My Monitored Scope"))
{
    // Do Stuff...
}

Continue reading “Using SPMonitoredScope, Counters and SPCriticalTraceCounter”

Advertisements
Using SPMonitoredScope, Counters and SPCriticalTraceCounter

FAIL: SPCriticalTraceCounter and TraceLevels

I’ve been looking at how to use the SPCriticalTraceCounter class for outputting messages in the Developer Dashboard. I came across a good post about how to do this by Frode Aarebrot, but it left me puzzled – what was the traceLevel integer about? Why wasn’t it an enumeration – like the Microsoft.SharePoint.Administration.TraceSeverity enum? Why those magic values? What happened if I used a wrong value?

Continue reading “FAIL: SPCriticalTraceCounter and TraceLevels”

FAIL: SPCriticalTraceCounter and TraceLevels