I'm using log4net for the first time, and I can't figure out how to add the appropriate config settings. All the documentation is pretty consistent about adding a <log4net>
section to the app.config file, but for it to compile correctly, don't I also need to outline my configSections
?
I have the following right now:
<configuration>
<configSections>
<section name="system.serviceModel"/>
<section name="appSettings" type="System.Configuration.ConfigurationManager"/>
<section name="log4net"
type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
<section name="startup" />
</configSections>
<system.serviceModel>
...
</system.serviceModel>
<appSettings>
...
</appSettings>
<log4net>
...
</log4net>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
</configuration>
But I'm receiving the following errors:
XML document must contain a root level element
The required attribute 'type' is missing
(fromsystem.serviceModel
andstartup
)Could not find schema information for the element *
(*=everything in log4net)
I've read a couple posts on section groups, and I've considered setting up the appSettings
and log4net
in a separate config file. This is a little over my head.
Should I be using separate config files?
If I should be putting everything in one config file, how do I know what type a section is? (I'm guessing on the appSettings
type based on the assembly I use to get the settings--and I got the type for log4net
from the many posts including it.)