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
 

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

Back
Top