Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In the end, buffering was not the issue and the solution was quite simple. It looks like the RollingFileAppender uses an exclusive lock by default so the log file was locked while the application was running. </p> <p>The fix in this instance was to set: <code>LockingModel = new FileAppender.MinimalLock();</code></p> <p>The updated init looks like this:</p> <pre><code>.Log4Net&lt;RollingFileAppender&gt;(x=&gt; { x.LockingModel = new FileAppender.MinimalLock(); x.Threshold = Level.Debug; x.MaxSizeRollBackups = 10; x.RollingStyle = RollingFileAppender.RollingMode.Size; x.File = "c:\\Logs\\log.txt"; }) </code></pre> <p>While I was searching the Log4Net docs for a buffering solution, I stumbled upon the <a href="http://logging.apache.org/log4net/release/sdk/log4net.Appender.BufferingForwardingAppender.html" rel="nofollow">BufferingForwardingAppender</a>. This appender wraps non-buffering appenders providing a buffering service.</p> <p>Here is what the config would look like if I wanted to add buffering to the RollingFileAppender:</p> <pre><code> .Log4Net&lt;BufferingForwardingAppender&gt; (x =&gt; { x.BufferSize = 50; // number of events to buffer x.AddAppender(new RollingFileAppender() { LockingModel = new FileAppender.MinimalLock(), Layout = new SimpleLayout(), Threshold = Level.Debug, MaxSizeRollBackups = 10, RollingStyle = RollingFileAppender.RollingMode.Size, File = "c:\\Logs\\log.txt", SecurityContext = NullSecurityContext.Instance }); }) </code></pre> <p>Patrick.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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