urs-hart opened a new issue, #321:
URL: https://github.com/apache/logging-log4net/issues/321

   When using the XmlConfigurator's file-watching, like this:
   ```c#
   var logRepository = LogManager.GetRepository(typeof(Program).Assembly);
   XmlConfigurator.ConfigureAndWatch(logRepository, new FileInfo("log.config"));
   ```
   with a simple FileAppender config, like this:
   ```xml
   <log4net>
        <appender name="log.log" type="log4net.Appender.FileAppender">
                <file value=".\log.log" />
                <layout type="log4net.Layout.PatternLayout">
                        <conversionPattern value="%date %message%newline" />
                </layout>
        </appender>
        <root>
                <level value="ALL" />
                <appender-ref ref="log.log" />
        </root>
   </log4net>
   ```
   When editing the config-file at run-time, you get:
   `log4net:ERROR [FileAppender] ErrorCode: GenericFailure. Unable to acquire 
lock on file ...\log.log. The process cannot access the file '...\log.log' 
because it is being used by another process.`
   
   
   Due the file-change, the appenders are getting re-configured.
   `v3.3.0` old appenders were stopped and removed before new appenders were 
created and added.
   `v3.3.1` new appenders are created before old appenders are stopped.
   The old appender still has a lock on the file.
   The new appender is created and calls ActivateOptions()->OpenFile().


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to