views:

572

answers:

0

This question is related to my another question.

With trace enabled I can get the following(not quite verbose) trace of a page request:

[2488] aspx.page: Begin PreInit
[2488] aspx.page: End PreInit
[2488] aspx.page: Begin Init
[2488] aspx.page: End Init
[2488] aspx.page: Begin InitComplete
[2488] aspx.page: End InitComplete
[2488] aspx.page: Begin PreLoad
[2488] aspx.page: End PreLoad
[2488] aspx.page: Begin Load
[2488] aspx.page: End Load
[2488] aspx.page: Begin LoadComplete
[2488] aspx.page: End LoadComplete
[2488] aspx.page: Begin PreRender
[2488] aspx.page: End PreRender
[2488] aspx.page: Begin PreRenderComplete
[2488] aspx.page: End PreRenderComplete
[2488] aspx.page: Begin SaveState
[2488] aspx.page: End SaveState
[2488] aspx.page: Begin SaveStateComplete
[2488] aspx.page: End SaveStateComplete
[2488] aspx.page: Begin Render
[2488] aspx.page: End Render

Reflector shows that System.Web.UI.Page.ProcessRequestMain method which I suppose does the main part of request processing has more conditional trace messges. For example:

if (context.TraceIsEnabled)
{
    this.Trace.Write("aspx.page", "Begin PreInit");
}
if (EtwTrace.IsTraceEnabled(5, 4))
{
    EtwTrace.Trace(EtwTraceType.ETW_TYPE_PAGE_PRE_INIT_ENTER, this._context.WorkerRequest);
}
this.PerformPreInit();
if (EtwTrace.IsTraceEnabled(5, 4))
{
    EtwTrace.Trace(EtwTraceType.ETW_TYPE_PAGE_PRE_INIT_LEAVE, this._context.WorkerRequest);
}
if (context.TraceIsEnabled)
{
this.Trace.Write("aspx.page", "End PreInit");
}
if (context.TraceIsEnabled)
{
    this.Trace.Write("aspx.page", "Begin Init");
}
if (EtwTrace.IsTraceEnabled(5, 4))
{
    EtwTrace.Trace(EtwTraceType.ETW_TYPE_PAGE_INIT_ENTER, this._context.WorkerRequest);
}
this.InitRecursive(null);

So there are these EwtTrace.Trace messages which I don't see I the trace. Going deeper with Reflector shows that EtwTrace.IsTraceEnabled is checking if the appropriate tracelevel set:

internal static bool IsTraceEnabled(int level, int flag)
{
    return ((level < _traceLevel) && ((flag & _traceFlags) != 0));
}

So the question is how do I control these _traceLevel and _traceFlags and where should these trace messages ( EtwTrace.Trace ) go? The code I'm looking at is of .net framework 2.0

@Edit: I guess I should start with ETW Tracing MSDN entry.