log4文件被锁解决办法
Try to configure log4net with a minimal lock:
…
…
have a look here for better explanation.
Alternatively, try to open the log file with:
using (var stream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Delete | FileShare.ReadWrite))
{…}
or check this project:Tailf In any case, remove the SetAttributes() part that could not work. Tailf Project Description Tailf is a C# implementation of the tail -f command available on unix/linux systems. Differently form other ports it does not lock the file in any way so it works even if other rename the file: this is expecially designed to works well with log4net rolling file appender.