Thread safety

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
 

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

Members online

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top