<!--<system.diagnostics>
<sharedListeners>
<add name="AzureLocalStorage" type="WCFServiceWebRole1.AzureLocalStorageTraceListener, WCFServiceWebRole1"/>
</sharedListeners>
<sources>
<source name="System.ServiceModel" switchValue="Verbose, ActivityTracing">
<listeners>
<add name="AzureLocalStorage"/>
</listeners>
</source>
<source name="System.ServiceModel.MessageLogging" switchValue="Verbose">
</sources>
</system.diagnostics>-->
<system.diagnostics>
<trace autoflush="true">
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<filter type="" />
</add>
</trace>
</system.diagnostics>
<system.serviceModel>
<diagnostics><messageLogging maxMessagesToLog="3000" logEntireMessage="true" logMessagesAtServiceLevel="true" logMalformedMessages="true" logMessagesAtTransportLevel="true" />
</diagnostics>
<behaviors>
……………………
<source name="System.ServiceModel" switchValue="Information,ActivityTracing,Warning" propagateActivity="true">
<add name="xml" />
<source name="System.ServiceModel.MessageLogging">
<add initializeData="C:\CTS\WCFTrace.svclog" type="System.Diagnostics.XmlWriterTraceListener"
name="xml" />
<trace autoflush="true" >
<diagnostics>
<messageLogging logEntireMessage="true"
maxMessagesToLog="300"
logMessagesAtServiceLevel="true"
logMalformedMessages="true"
logMessagesAtTransportLevel="true" />
<behaviors>…………………………
However, the trace will not be generated just with the above configuration. If you run procmon, you would see “Access Denied” on CreateFile for “C:\CTS\WCFTrace.svclog” that I’ve in the configuration for logging WCF trace. Open up task manager and you would see w3wp.exe (remember – it’s full IIS) running under Network Service account. This account needs to have permissions to write on the folder configured to store WCF traces. Just give “Everyone” write permissions on the folder and get it to work!!
Since regular tracing works, I don’t expect any issues running circular (rolling) tracing in the Azure environment.
I tried following this example for a workerRole using the XmlWriterTraceListener method at the end of your post. I just set the initializeData to WCFTrace.svclog to hopefully avoid permission issues. It runs in the dev fabric OK, but on Azure it just creates an empty file. Any ideas what I'm doing wrong?