Yes, you can add the section
element for log4net without referencing log4net.dll
in your web application project.
To be sure, I double checked this with a scratch web application project (WebApplication1) and class library (ClassLibrary1) targeting .NET 4.0 in Visual Studio 2013. ClassLibrary1 referenced log4net.dll
, but WebApplication1 did not; it just referenced ClassLibrary1 and had a log4net section
element & related log4net
element in its Web.config
: logging to a text file via log4net worked beautifully.