Logging Application Block in Class Library

Sep 21, 2007 at 9:05 AM
Hello,

I try to use the Logging Application Block in a Class Library. So I created a Class Library project with an app.config file and a Console Application project for consumption of the library. But when I call Logger.Write(...) in the Class Library, I get the following error: "The configuration section for Logging cannot be found in the configuration source.". So I tried something else and put the app.config to the project (Console Application) where the Class Library is used. Now everything works fine. But I think that can not be the right way. For example how do I solve the problem that I have two Class Libraries and each shall log to a seperate file?

Greets
pacosys
Sep 21, 2007 at 11:34 AM
Hi,

Configuration files really contain settings for an application, not a library. You can work around this in some cases (not this one) by using more advanced features to make the blocks read other configuration files, but it shouldn't be necessary here; just use different categories when logging from the different libraries, each with its own file trace listener.

Fernando