How to suppress Tracer-"Start Trace" log events from being written?

Topics: Logging Application Block
Dec 30, 2008 at 11:17 PM
I'm using a SQL Server database as the Trace Listener for the category I use for Microsoft.Practices.EnterpriseLibrary.Logging.Tracer so that I can run queries to extract and analyze performance data.  What I have discovered is that the time to write "Start Trace" log event is included in the elapsed time reported by the Tracer instance in the "End Trace" log event.  We have a lot of latency between our developer client boxes and our remote development database server so the time to write "Start Trace" log event can significantly increase the elapsed time report by the Tracer in the "End Trace" log event.

How can I suppress Tracer-"Start Trace" log events from being written (without suppressing the writing of the "End Trace" log events)?

Thanks,
David

Jan 5, 2009 at 4:33 AM
Edited Jan 5, 2009 at 7:04 AM
Hi David,

Looking at the Ent Lib Source code, it seems that the timer is started before the "Start Trace" so it eats up time in initializing and included it to the time reported. One thing you can do is to edit the source code at the Microsoft.Practices.EnterpriseLibrary.Logging.Tracer.cs, in the Initialize method. You can switch the line of code that starts the timer and the WriteTraceStartMessage. 

Here is the link of the Issue I logged.
http://www.codeplex.com/entlib/WorkItem/View.aspx?WorkItemId=20446

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com
Nov 6, 2009 at 8:19 PM

Hi Valiant,

 

I see the status of the issue you logged is still Unassigned, will this issue be addressed in the 5.0 release?

 

Thanks,

David

Nov 9, 2009 at 1:47 AM

We'll have to ask the EntLib team regarding this and the other question you posted.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Nov 27, 2009 at 9:08 PM

Hi Sarah,

 

Any word from the EntLib team on this issue?

 

Thanks,

David

Dec 17, 2009 at 9:27 PM

By design.

Excluding initialization time from the timer will be misleading since it's part of execution anyway.

Suppressing Tracer-"Start Trace" log events is out of scope for v5.

Dec 28, 2009 at 11:34 PM

Hi Grigori,

 

The problem is that the time to write "Start Trace" log event to the Trace Listener can dramatically increase the elapsed time reported by the Tracer instance in the "End Trace" log event.  It seems undesirable that the mere act of timing a unit of code using Tracer can dramatically increase the execution time of that unit of code.  This issue makes the elapsed time reported by Tracer unreliable/misleading for performance analysis.

 

Thanks,

David