App.config, class library and tracing

A

Andrew

I have a class library that has app.config that has <system.diagnostics>
that specifies trace listeners. The class library is loaded by a third party
unmanaged application. I want the .NET framework to read the diagnostic
section and create listeners for me. For a managed executable, this is done
automatically, but not for a class library. What's the easiest way to have
..NET read and create the listeners, without me having to manually parse the
section and create listeners with new()?

Thanks
 
A

Andrew

No, the problem is with managed code only.

Lets say I have c# exe that calls a method in c# class library (dll). In
app.config for both exe and dll I add <system.diagnostics>, <sources>,
<listeners> etc. (trace source names are different for exe and dll), then
call TraceEvent from exe and dll. Exe produces trace output, dll does not.
That's apparently because the framework does not process
<system.diagnostics> for a class library. I want an easy way to create
listeners for dll based on the info in app.config.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top