File locking question

 
250   96.9
Jul 25, 2010
 
In my ASP.NET  application I log all the exceptions to a log file.
This can be a issue when multiple requests try to write at the same time to the log file. 
How is this scenario best handled? 



130   96.7
Jul 29, 2010
Another popular logging framework is Log4net. http://logging.apache.org/log4net/



60   95.3
Jul 29, 2010
Lock code block which has been used to write log to the file using "lock Statement". This statement would not been executed until previous execution has been completed.

For detail visit http://msdn.microsoft.com/en-us/library/c5kehkcz(VS.80).aspx link.

Jul 26, 2010
You may use the Enterprise Library from Codeplex for your scenario. It has all the patterns implemented to handle the mutithreaded scenario like yours.