============ RESEND =============== =
Dear all,
I have implementing some tracing function in my
applicatrion to store log information to file and event
logger.
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
process"
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_Fi le, FileMode.OpenOr Create,
FileAccess.Read Write)
m_Listner = New TextWriterTrace Listener
(m_LogFile)
'-- handle objet for sending to EvLog
m_EventLog = New EventLog("Debug Log")
m_EvtListner = New EventLogTraceLi stener
(m_EventLog)
m_EventLog.Sour ce =
Source.GetType. Namespace.ToStr ing
Trace.Listeners .Add(m_Listner)
Trace.Listeners .Add(m_EvtListn er)
Trace.AutoFlush = True
The exception comes when the m_LogFile object start to
initialised.
IMPORTANT :
=============
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
Dear all,
I have implementing some tracing function in my
applicatrion to store log information to file and event
logger.
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
process"
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_Fi le, FileMode.OpenOr Create,
FileAccess.Read Write)
m_Listner = New TextWriterTrace Listener
(m_LogFile)
'-- handle objet for sending to EvLog
m_EventLog = New EventLog("Debug Log")
m_EvtListner = New EventLogTraceLi stener
(m_EventLog)
m_EventLog.Sour ce =
Source.GetType. Namespace.ToStr ing
Trace.Listeners .Add(m_Listner)
Trace.Listeners .Add(m_EvtListn er)
Trace.AutoFlush = True
The exception comes when the m_LogFile object start to
initialised.
IMPORTANT :
=============
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