Webform Log file

G

Guest

I created a class to log application event in my webform.
This "Logs" class contains only one static method :

static void WriteLog(string mess)
{
StreamWriter log
log = File.AppendText("file.log");
log.WriteLine(mess);
log.Flush();
log.Close();
}

Logs.WriteLog() is called in the codebehing of my WebForm

Several WebForm can call simultaneously the WriteLog method.
What appends if several people call my Webform at the same time ?
deadlock or Exception ? Or others problems ?

Is it necessary to had a lock(this) around my WriteLog code ?

Thanks

Christian
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top