Diagnostics Trace data disappears after exception

Go To StackoverFlow.com


I'm using Azure Diagnostics Trace to log messages. The configuration is to transfer the logged data every minute to Azure Storage Table.

While testing the setup I have discovered that in case of unhanded exception, the previous trace data disappears.

For example:


This will show up in the Azure Table after a minute

 throw new TimeoutException();

This will not log the data, because of the exception.

I was under the impression that Diagnostics should persist the data, why is this happening?

2012-04-03 21:46
by Registered User


You need to make a call to


to ensure that the data is persisted. The Trace information is buffered in memory, and the exception causes that information to be lost before it even makes it into the diagnostic area that can be picked up by the Azure Table transfer process.

You can also set the autoflush property in your configuration file to ensure the Trace data is automatically flushed after every write:

  <trace autoflush="true">
2012-04-03 21:47
by mellamokb