Re: Set Trace to Ignore Errors in Trace.WriteLine?



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.
.



Relevant Pages

  • Re: [2.6.9-rc4] USB && mass-storage && disconnect broken semantics
    ... How do you expect writing to a device followed by a forced dismount to ... With *nix, most data only gets written at unmount, so the only way this ... then clear your caches. ... Replugging is the only possibility that could ever support writes. ...
    (Linux-Kernel)
  • 2.6.28: warn_slowpath in orinoco receive path
    ... Enabling unmasked SIMD FPU exception support... ... Using ACPI for IRQ routing ... (was 0x380801ff, writing 0x3808010b) ... eth1: Read PDA returned 0 ...
    (Linux-Kernel)
  • Re: Poly1305 vs. UMAC vs. new MAC1071
    ... premier games. ... Just now, go arouse a writing! ... Where did Taysseer hate in support of all the constitutions? ...
    (sci.crypt)
  • Re: E-mail not delivered, Event ID 2028
    ... Right click on "Default SMTP Virtual Server" and click Properties. ... On the General tab, please check the option "Enable logging". ... Select W3C Extended Log File Format from the list below. ... Microsoft Online Partner Support ...
    (microsoft.public.exchange.admin)
  • Re: Problem with OWA
    ... Open IIS MMC, right click Default Web Site and then click Properties. ... You may wait a while for IIS to generate the log file. ... Install MBExplorer by installing IIS 6 Resource Kit Tools: ... > Microsoft Online Partner Support ...
    (microsoft.public.exchange.setup)

Loading