logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Grabowski <rongrabow...@yahoo.com>
Subject Re: Log file availability issue
Date Wed, 12 Jun 2013 23:25:37 GMT
You can use a minimal lock on your FileAppender:

<lockingModel type="log4net.Appender.FileAppender+MinimalLock" />

but it'll slow things down because it will open and close the file with each write. I've used
code like this before to open a locked file:

// from http://www.ericbt.com/Blog/48
using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
  using (StreamReader streamReader = new StreamReader(fileStream))
  {
    logFileText = streamReader.ReadToEnd();
  }
}


________________________________
 From: "Chu, Greg" <Greg.Chu@wendys.com>
To: "log4net-user@logging.apache.org" <log4net-user@logging.apache.org> 
Sent: Wednesday, June 12, 2013 9:44 AM
Subject: Log file availability issue
 


 
During the application running the log file is locked. I am trying to email the log file inside
the application while the application is running.
Do I have any way to close the log file so it is unlocked, so that I can get the log file
and email it?
 
Thanks
 
Greg
 
Notice: This e-mail message and its attachments are the property of The Wendy's Company or
one of its subsidiaries and may contain confidential or legally privileged information intended
solely for the use of the addressee(s). If you are not an intended recipient, then any use,
copying or distribution of this message or its attachments is strictly prohibited. If you
received this message in error, please notify the sender and delete this message entirely
from your system. 
Mime
View raw message