I am reading a log file from another system to report errors more quickly with the following:
while ((sLine = reader.ReadLine()) != null)
{
//check result of each line and do something
}
Problem is that the system is failing log writes because i have the file locked. One option is to copy the file to another location and then read it. Is there a more elegant solution though? I see StreamReader.Peek() but I am not sure if that is the right solution? I am not trying to see if I can read, rather, I need to leave the file available for the other system to write to at any time. Maybe copy is the best. Hmm...
while ((sLine = reader.ReadLine()) != null)
{
//check result of each line and do something
}
Problem is that the system is failing log writes because i have the file locked. One option is to copy the file to another location and then read it. Is there a more elegant solution though? I see StreamReader.Peek() but I am not sure if that is the right solution? I am not trying to see if I can read, rather, I need to leave the file available for the other system to write to at any time. Maybe copy is the best. Hmm...