By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,792 Members | 1,603 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,792 IT Pros & Developers. It's quick & easy.

Help needed on Trace operation

P: n/a
============ RESEND ================

Dear all,

I have implementing some tracing function in my
applicatrion to store log information to file and event

I have actually a problem to logging to file, hwhere I get
an exception error saying :

"Cannot access to file becasue it is use by an other

The error comes the second time I try to write to the file.

I have try to close the file and the trace stuff after
each write but nothing much still the error.

I have implemented as follow :

m_LogFile = New FileStream(m_File, FileMode.OpenOrCreate,
m_Listner = New TextWriterTraceListener

'-- handle objet for sending to EvLog
m_EventLog = New EventLog("Debug Log")
m_EvtListner = New EventLogTraceListener
m_EventLog.Source =

Trace.AutoFlush = True

The exception comes when the m_LogFile object start to
The code above is located in a separate assembly that the
call which is instanciate the object for writing to log.

If I paste this code in the same assembly that the
instance is created it works fine all time
Any help will be aprreciate
Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.