FreeAndNil opened a new issue, #379:
URL: https://github.com/apache/logging-log4net/issues/379

   `ActivateOptions` must be called again after a property changed, for example 
a new `File` at run
   time. Several things go wrong then:
   
   - `MinimalLock` and `InterProcessLock` keep the mutex named after the old 
file, so a second process
     writing the new file is not kept out. With `InterProcessLock` each call 
also reports "Programming
     error, mutex already initialized!" through the error handler.
   - `RollingFileAppender` takes the name of the file it opened as its new base 
name and adds the roll
     suffix again: three activations give `r.log.0`, `r.log.0.0`, 
`r.log.0.0.0`. Each activation also
     creates a new rolling mutex without disposing the old one.
   
   Related, in the same code: a `File` holding an environment variable such as
   `logs/app-%COMPUTERNAME%.log` is expanded only when the file is opened. 
`RollingFileAppender` rolls
   under the unexpanded name, finds nothing to rename and reopens the live file 
truncated, so every roll
   loses the log and keeps no backup. ANT-2026-O4KAKTUN.
   
   Proposed fix: `RollingFileAppender` keeps the configured `File` as its base 
name, and the name is
   expanded before it is made absolute. On a later `ActivateOptions` with 
another file, the lock and
   rolling mutexes follow it, swapped under the appender lock after the old 
file is closed; the same
   file keeps its mutex without an error report. Visible change: a variable 
that expands to a rooted
   path, such as `%TEMP%/app.log`, is no longer placed under the application 
base directory.
   


-- 
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