I am trying to display some TraceSource registration TraceSource in an Azure emulator (console) window.
None of the TraceSource lines are displayed. Only Trace stock lines and various low-level azure messages.
Here are my repo actions, including code snippets:
- File → Create → Cloud Service (SDK 2.0) → (add worker role).
- Add TraceSource to WorkerRole.
- Update the app.config file with the trace data.
- Play / Publish.
NOTE all other default codes are there, for example, .csfg , which says UseDevelopmentStorage=true , etc.
Worker role code.
This is STOCK DEFAULT code code with added TraceSource code ...
using System.Diagnostics; using System.Net; using System.Threading; using Microsoft.WindowsAzure.ServiceRuntime; namespace WorkerRole1 { public class WorkerRole : RoleEntryPoint { private TraceSource _traceSource; public override void Run() { _traceSource.TraceEvent(TraceEventType.Verbose, 0, "********************** 111111111111111111111 ******************* ");
Now app.config ...
<?xml version="1.0" encoding="utf-8" ?> <configuration> <system.diagnostics> <sharedListeners> <add name="AzureListener" type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"> <filter type="" /> </add> </sharedListeners> <sources> <source name="Azure.WorkerRole" switchValue="Verbose" > <listeners> <add name="AzureListener" /> </listeners> </source> </sources> </system.diagnostics> </configuration>
What is it! run and make sure that the TraceSource material TraceSource not displayed :( Trace.Information is .. but I do not want to use the old Trace method, because it is suggested to replace it with TraceSource instead.
Output example. Please note that only Trace lines are added (along with low-level azure material).

source share