Note that there are some explanatory texts on larger screens.

plurals
  1. POSection types in Config files
    text
    copied!<p>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 <code>&lt;log4net&gt;</code> section to the <em>app.config</em> file, but for it to compile correctly, don't I also need to outline my <code>configSections</code>?</p> <p>I have the following right now:</p> <pre><code>&lt;configuration&gt; &lt;configSections&gt; &lt;section name="system.serviceModel"/&gt; &lt;section name="appSettings" type="System.Configuration.ConfigurationManager"/&gt; &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /&gt; &lt;section name="startup" /&gt; &lt;/configSections&gt; &lt;system.serviceModel&gt; ... &lt;/system.serviceModel&gt; &lt;appSettings&gt; ... &lt;/appSettings&gt; &lt;log4net&gt; ... &lt;/log4net&gt; &lt;startup&gt;&lt;supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/&gt;&lt;/startup&gt; &lt;/configuration&gt; </code></pre> <p>But I'm receiving the following errors:</p> <ul> <li><code>XML document must contain a root level element</code></li> <li><code>The required attribute 'type' is missing</code> (from <code>system.serviceModel</code> and <code>startup</code>)</li> <li><code>Could not find schema information for the element *</code> (*=everything in log4net)</li> </ul> <p>I've read a couple posts on section groups, and I've considered setting up the <code>appSettings</code> and <code>log4net</code> in a separate config file. This is a little over my head. </p> <p>Should I be using separate <em>config</em> files?</p> <p>If I should be putting everything in one <em>config</em> file, how do I know what type a section is? (I'm guessing on the <code>appSettings</code> type based on the assembly I use to get the settings--and I got the type for <code>log4net</code> from the many posts including it.)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload