Multithreading in Application_Error event handler?

  • Thread starter Thread starter ram
  • Start date Start date
R

ram

Hi,

In Application_Error (global.asax) i'm sending the details of the
exception to
a file (opening and closing file each time).

I'm using the same file (eg, log.txt) for all logs.

Are the calls to this method serialized?

It's possible that, when trying to write to the file, the file is
already opened by another thread?


TIA,
ram
 
ram said:
Hi,

In Application_Error (global.asax) i'm sending the details of the
exception to
a file (opening and closing file each time).

I'm using the same file (eg, log.txt) for all logs.

Are the calls to this method serialized?

In my experience, no.
It's possible that, when trying to write to the file, the file is
already opened by another thread?

Yes. If you want to write to the file from multiple threads, you need to
synchronize your code.

Regards,
Sami
 
Back
Top