S
softwareakash
Thread Safety
I wrote a small class library written in C# which writes log messages
to a log file.
Everything works fine when one ASP.net application uses this dll to
write text strings.
The problem starts when 2 or more applications ( ASP.net or Console )
uses this dll simultaneously and try to write a lot of messages (
around 10000 ).
I get error that the text file is being used by other process.
In my final application this dll will be used for logging and it should
handle unlimited number of user .
I want to make it completely thread safe so that any number of
different applications can parallaly write to the same text file.
I tried to use lock and synchronized methods etc but nothing is
working.
For writing to the text file I am using StreamWriter class.
I am using VS2005
Can anybody help?
Regards
Akash
I wrote a small class library written in C# which writes log messages
to a log file.
Everything works fine when one ASP.net application uses this dll to
write text strings.
The problem starts when 2 or more applications ( ASP.net or Console )
uses this dll simultaneously and try to write a lot of messages (
around 10000 ).
I get error that the text file is being used by other process.
In my final application this dll will be used for logging and it should
handle unlimited number of user .
I want to make it completely thread safe so that any number of
different applications can parallaly write to the same text file.
I tried to use lock and synchronized methods etc but nothing is
working.
For writing to the text file I am using StreamWriter class.
I am using VS2005
Can anybody help?
Regards
Akash