using (new Tracer("Trace"))

Topics: Logging Application Block
Mar 13, 2007 at 3:12 PM
using (new Tracer("Trace"))
{
Logger.Write("unauthorized user", "security", ....etc)
}

Why is it that all calls to 'logger.write() from within a Tracer() using block all 'acquire' the category of the Tracer? This is problematic since inside my using block I would like to log 'error' or 'security' category messages, then in the future I would like to be able to turn tracing OFF in the config file using a Filter on 'Trace' category - problem is that when I filter out the 'Trace' category, all of my other log entries are also filtered out since they are also tagged with the Trace category.

Am I missing something - is there a better way to accomplish this, or do I have to write a custom filter?
Mar 13, 2007 at 4:03 PM
This was a deliberate design decision as it allows correlation of log messages. If you just want to filter out the Tracer start/stop events, you can set TraceEnabled on the root config node, rather than using a filter.

Tom
Mar 13, 2007 at 7:38 PM
Thanks, I somehow overlooked the SourceLevels under the 'Category Sources' in the config tool - I knew there must be an easier way to turn tracing on off.
-John.