in src/log4net/Appender/FileAppender.cs [1198:1245]
protected virtual void OpenFile(string fileName, bool append)
{
if (LogLog.IsErrorEnabled)
{
// Internal check that the fileName passed in is a rooted path
bool isPathRooted;
using (SecurityContext?.Impersonate(this))
{
isPathRooted = Path.IsPathRooted(fileName);
}
if (!isPathRooted)
{
LogLog.Error(_declaringType,
"INTERNAL ERROR. OpenFile(" + fileName + "): File name is not fully qualified.");
}
}
lock (LockObj)
{
Reset();
LogLog.Debug(_declaringType, "Opening file for writing [" + fileName + "] append [" + append + "]");
// Save these for later, allowing retries if file open fails
_fileName = fileName;
AppendToFile = append;
LockingModel.CurrentAppender = this;
LockingModel.OpenFile(fileName, append, Encoding);
_stream = new LockingStream(LockingModel);
if (_stream is not null)
{
_stream.AcquireLock();
try
{
SetQWForFiles(_stream);
}
finally
{
_stream.ReleaseLock();
}
}
WriteHeader();
}
}