Note that there are some explanatory texts on larger screens.

plurals
  1. POlog4net only logs when running in the Visual Studio debugger
    text
    copied!<p>I'm running Visual Studio 2008 - and have a problem with log4net logging (v1.2.10). I have a small console test program with a single log statement. I have log4net configured for RollingLogFileAppender and ConsoleAppender. </p> <p>When I run the compiled exe from the command line, I see the correct creation of the log file in my runtime directory. The log file is created (or appended to, when it exists), but the only output is the [Header] and [Footer] as configured. There is no output to console.</p> <p>However, <b>when I run under the debugger, the log message appears both in the log file and on the console</b>. Following is my log4net configuration:</p> <pre><code>&lt;log4net&gt; &lt;appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"&gt; &lt;layout type="log4net.Layout.PatternLayout" value="%date [%thread] %-5level %logger - %message%newline" /&gt; &lt;/appender&gt; &lt;appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender"&gt; &lt;file value="quicktest-log-" /&gt; &lt;appendToFile value="true" /&gt; &lt;immediateFlush value="true" /&gt; &lt;datepattern value="yyyy-MM-dd" /&gt; &lt;maxSizeRollBackups value="100" /&gt; &lt;maximumFileSize value="1048576" /&gt; &lt;rollingStyle value="Composite" /&gt; &lt;staticLogFileName value="false" /&gt; &lt;layout type="log4net.Layout.PatternLayout"&gt; &lt;header value="[Begin Quicktest program log]&amp;#13;&amp;#10;" /&gt; &lt;footer value="[End Quicktest program log]&amp;#13;&amp;#10;" /&gt; &lt;conversionPattern value="%date{HH:mm:ss} [%thread] %-5level %logger: %message%newline" /&gt; &lt;/layout&gt; &lt;/appender&gt; &lt;root&gt; &lt;level value="ALL" /&gt; &lt;appender-ref ref="ConsoleAppender" /&gt; &lt;appender-ref ref="RollingLogFileAppender" /&gt; &lt;/root&gt; &lt;/log4net&gt; </code></pre>
 

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