views:

772

answers:

2

I'm using log4net logging in my DLL class library - I'm wondering where people would recommend I put the log4net configuration - in the App.config or in a separate .log4net config file?

+6  A: 

App.Config

The reason for this is just one configuration file for your application. I always favor simplicity.

David Basarab
Won't that mean users of the DLL won't be able to configure the logging?
Nosrama
No they could, they can put it in there app.config. I have used Log4Net.dll dozen of times in many different applications just using 1 .config. Each application I want logged in a different place.
David Basarab
If you have a web application, putting the config in web.config can cause a problem because changing the log4net config will then cause the web application to restart (this is not the case with a class library though as in in Nosrama's case).
adrianbanks
@David Basarab: Have you used it in DLLs or just EXEs?
Nosrama
A: 

most times, i like app.config

but if you want reuse your dll in different location, maybe consider the AppName.dll.log4net, you can just copy two files, then reuse.