Note that there are some explanatory texts on larger screens.

plurals
  1. POLogging with Castle.Facilities.Logging and log4net
    text
    copied!<p>I'm trying to get log4net integration for Castle Windsor working. I wrote my class with an public property of type <code>ILogger</code> and took the configuration in my app.config like following. </p> <pre class="lang-xml prettyprint-override"><code>&lt;configuration&gt; &lt;configsections&gt; &lt;section name="castle" type="Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor" /&gt; &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" /&gt; &lt;/configsections&gt; &lt;castle&gt; &lt;facilities&gt; &lt;facility id="logging" type="Castle.Facilities.Logging.LoggingFacility, Castle.Facilities.Logging" loggingApi="log4net" /&gt; &lt;/facilities&gt; &lt;components&gt; &lt;component id="form1" type="WinFormsActiveRecordSample.Form1, WinFormsActiveRecordSample" /&gt; &lt;/components&gt; &lt;/castle&gt; &lt;log4net&gt; &lt;root&gt; &lt;level value="ALL" /&gt; &lt;appender-ref ref="FileAppender" /&gt; &lt;/root&gt; &lt;appender name="FileAppender" type="log4net.Appender.FileAppender"&gt; &lt;file value="main.log" /&gt; &lt;appendToFile value="true" /&gt; &lt;layout type="log4net.Layout.PatternLayout"&gt; &lt;conversionPattern value="%date{dd.MM.yy HH:mm:ss} %-5level %logger - %message%newline" /&gt; &lt;/layout&gt; &lt;/appender&gt; &lt;/log4net&gt; &lt;/configuration&gt; </code></pre> <p>In my eyes this should be working, but it doesn't. When I set <code>loggingApi="console"</code> it logs correctly. When I change it to log4net it does nothing. The log4net configuration was taken from another project where the block is working. What do I have to do that the log file is used? Must there be a special log4net configuration?</p> <p>Thanks for any hint</p> <p>Boris</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