I use log4net in every applications I build that needs to have some sort of log.
Most of the examples on the log4net site puts the configuration right in the App.config/Web.config file for the example application. Since they are simply example and not real-life scenarios, that’s not necessarily the best way to do it. For example, you may have a single log4net.config that you want to use in several projects or you simply want to stick log4net.config somewhere else to make those config files more readable.
The magic bit that at least I can't easily find and always forget is:
If you add an appSettings key called "log4net.Config" you can put an app-relative path to an external log4net.config file in there and everything will automatically configure itself using that.
It looks like this:
<add key="log4net.Config" value="log4net.config" />
That example puts the log4net.config file right in the root of the application. You could specify "config/log4net.config" to put it in a "config" subfolder. You don't even have to call the XmlConfigurator.Configure method or mark your assembly with an XmlConfiguratorAttribute or anything. Some voodoo magic happens in the background and it just works.
Other posts :
How to enumerate the Domain Controllers in the current Domain in C#
How to Create User Accounts in Active Directory using C#
How to restart a Windows service using C#
How to set NTFS permissions using C# 2005
The opinions expressed herein are my own personal opinions and do not represent
my employer's view in any way.