简体   繁体   中英

Need to open file I log to but get file locked exception

hI,

I'm using LOG4NET to log to a txt file. However, one of my forms needs to open the txt file (using streamreader) to read the contents and display them in a .txt file. However, I keep getting an exception stating that the file is locked by another process.

Is there a way around this in LOG4NET?

Thanks

This may be help you.

http://www.ericbt.com/Blog/48

If you open the log file with ReadWrite sharing enabled (FileShare.ReadWrite) it will probably work.

You can always uses Process Monitor from http://www.sysinternals.com to see what is happening.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM