-----------------------------------------------------------
New Message on MumbaiUserGroup
-----------------------------------------------------------
From: SoftwareAkash
Message 4 in Discussion
Hi Thanks for your reply Yes I am using Dispose on the object. Here is the
piece of code which I am using
static void WriteToLog(string LogString, string LogLevel)
{
//Create a log format : dd/mm/yyyy hh:mm:ss AM/PM [LogLevel]==> Log Message
// And writing to the file
string sLogFormat = DateTime.Now.ToShortDateString().ToString() + " " +
DateTime.Now.ToLongTimeString().ToString() + " [" + LogLevel + "]" + " ==> ";
StreamWriter sw = new StreamWriter(FullFilePath, true);
TextWriter tw = TextWriter.Synchronized(sw);
tw.WriteLine(sLogFormat + LogString);
tw.Flush();
tw.Close();
tw.Dispose();
I used Synchronized also .. but still its not working when 2 different
applications try to write to log. The actual thing happening is this
1) I call this fuction ( DLL ) from 2 applications. First Application is an
ASp.net Web Application and the second one is a conslole application. both
writes 10000 lines in the log file. ( it takes around 5 seconds for a web app
and 10-15 seconds for a console app to write 10000 entries)
2) I first start any one application and after that I start the other one. The
second application waits for the first application to finish ( that is ... the
first application writes to the log successfully ). But when the second
application tries to start writing I get error of " the file is being used by
other process.
I have tried 2 web applications and 2 console applications also .. but the
result is the same.
Regards
Akash
-----------------------------------------------------------
To stop getting this e-mail, or change how often it arrives, go to your E-mail
Settings.
http://groups.msn.com/MumbaiUserGroup/_emailsettings.msnw
Need help? If you've forgotten your password, please go to Passport Member
Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help
For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact
If you do not want to receive future e-mail from this MSN group, or if you
received this message by mistake, please click the "Remove" link below. On the
pre-addressed e-mail message that opens, simply click "Send". Your e-mail
address will be deleted from this group's mailing list.
mailto:[EMAIL PROTECTED]