Customize Tracer Message

Topics: Logging Application Block
May 11, 2007 at 2:51 AM
I am using the construct:...

using( new Tracer( "Trace" ) )
{
}

... to log information to a flat file (trace.log). An example of the message that is logged is...

End Trace: Activity 'e9a09330-151a-4e0e-b841-c4a3cf6c8caf' in method '.ctor' at 18996763841 ticks (elapsed time: 0.022 seconds)

I would like to intercept this message and modify it. There is not much as far as events in any of the objects in Microsoft.Practices.EnterpriseLibrary.Logging. Is there an object that I need to override to change this functionality?

Oct 3, 2007 at 8:16 AM
Edited Oct 3, 2007 at 8:22 AM
I'm interested too in how to personalize tracer messages. The intention is to add some useful information and to format it in a different way to be able to process it like a csv file.

someone have an answer? thx!
Oct 3, 2007 at 12:39 PM
Hi,

This is not an extension point, unfortunately. However the templates come out of a resource (TracerStartMessageFormat and TracerEndMessageFormat in the logging assembly) so you could update the resources or supply a locale specific version with the text you need.

Regards,
Fernando
Oct 3, 2007 at 1:55 PM
Thx for a quick replay!

How could I supply a locale specific version? I've been trying a bit, but no success!! :S

thx
Oct 6, 2007 at 1:55 PM
Hi Ryk,

These are standard .net resources. What kind of problems did you face?

Fernando