I am running into a problem with log4net when the logfile being
written to is locked (by someone else).
Specifically, this can occasionally happen when my application is
starting up - at startup time, the file is locked, and log4net cannot
open it. It appears that log4net tries to access the file prior to
Main(). If it cannot open the file, I'm seeing an exception thrown,
but then processing continues - just without any logging.
The problem is that the exception is thrown before Main() starts, so I
don't seem to have any way of catching it.
The fact that the file is locked is not an issue - or at least, not
what I'm trying to solve here. What I am trying to do is detect this
situation programmatically - but I can't seem to find any way of doing
that?
And a follow-up question - if there is a way of detecting the problem,
is there any way of programmatically telling log4net to try again
(after some code executes that should cause the file to become
unlocked)?
Thanks,
Ethan