Re: Set Trace to Ignore Errors in Trace.WriteLine?
- From: Stewart Berman <saberman@xxxxxxxxxxxxx>
- Date: Thu, 16 Jul 2009 16:03:42 -0400
What I found is, after the first time writing to Trace, the log file is
opened (or created) and locked - other processes should not be able to lock
it for writing.
The problem appears to be something reading the log file not writing to it. The error message was
very clear -- the Trace Writeline method was unable to access the file (I assume for writing)
because another process had a portion of it locked. It could be a backup process or a virus scan.
Anyway, I put a wrapper around all of my Trace method calls with fixed number of retires with a 100
millisecond sleep between retries (the application is not time critical) and the problem appears to
have gone away.
The wrappers are a bunch of subroutines in a module so they are static and, I assume, thread safe
although I do not know how to confirm this.
jiewan@xxxxxxxxxxxxxxxxxxxx ("Jie Wang [MSFT]") wrote:
Hi Stewart,.
I just took a look at the Trace class and the TextWriterTraceListener class
implementation.
What I found is, after the first time writing to Trace, the log file is
opened (or created) and locked - other processes should not be able to lock
it for writing.
So I think it is better to lock on the file during the app initialization
phase by writing something into the log, this will ensure the log file is
opened & locked in an early stage.
If that still doesn't work, then realtime debugging is needed to find out
the root cause.
Best regards,
Jie Wang
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
- Follow-Ups:
- Re: Set Trace to Ignore Errors in Trace.WriteLine?
- From: "Jie Wang [MSFT]"
- Re: Set Trace to Ignore Errors in Trace.WriteLine?
- References:
- Set Trace to Ignore Errors in Trace.WriteLine?
- From: Stewart Berman
- RE: Set Trace to Ignore Errors in Trace.WriteLine?
- From: "Jie Wang [MSFT]"
- Re: Set Trace to Ignore Errors in Trace.WriteLine?
- From: Stewart Berman
- Re: Set Trace to Ignore Errors in Trace.WriteLine?
- From: "Jie Wang [MSFT]"
- Set Trace to Ignore Errors in Trace.WriteLine?
- Prev by Date: Re: How Do I Find MyApplication Events?
- Next by Date: Re: Using "Me"
- Previous by thread: Re: Set Trace to Ignore Errors in Trace.WriteLine?
- Next by thread: Re: Set Trace to Ignore Errors in Trace.WriteLine?
- Index(es):
Relevant Pages
|
Loading