Can Logging be Pre-Initialized?

Topics: Exception Handling Application Block, General discussion, Logging Application Block
Oct 17, 2007 at 2:00 AM
Ive been performing simple analysis of speed when calling 'Logger.Write()' and 'using(new Tracer())'.
What I found that the first call to either takes between 1 and 2.5 seconds depending on combination of TracingEnabled and LoggingEnabled settings (was 1.1 seconds with both set to false). Any calls thereafter are under 0.2 seconds (which was the max with DB & EventLog Listeners)

I planned to use EntLib in webservices for tracing/logging/monitoring as I am already using Nettiers but this 'startup' time will KILL us on each request.

My Questions:
  • Is it possible to pre-initialize whatever setup process is taking in order to avert that initial penalty with each request?
  • Should I consider a different framework?

p.s. I did my testing with ANTS 3.1 and both a console app and simple web service.
Oct 17, 2007 at 12:57 PM
I presume you were not loading anything in a debugger (or a debugger type of environment)? The reason I ask this is if it is looking for the PDBs that will take time. It appears you are experiencing a one of hit for loading something. So my guess would be either the EL objects themselves or a reference to the PDBs.

I've not seen this speed issue (on a regular application), with the exception and I like the framework. However it seems you need to determine where the 'initialization' time is being spent. Changing frameworks may not help your issue unless you determine where the slowdown is actually happening.

So my take to your questions are:
1) Is it possible to pre-initialize? Not that I'm aware of, but I've not seen the necessity my self.
2) I would not for this reason until the reason for the slowness is known.

Finally I presume you are using 3.0 or 3.1?
Oct 18, 2007 at 1:31 AM
Your exactly right. I had the same thought last night and put together some tests this morning using timers instead of using Ants. There is still a larger hit for the initial call to either using(new Tracer()) or Logger.Write() but now its only 500 milliseconds for the initial request to the web service. EntLib sings along between .01ms and 40ms for each request thereafter depending on how much logging/tracing I am doing.