I want to enable diagnostics in my web role (a web API, written in C#).
If I understand correctly, this can be done before deployment by enabling it in the cloud project, or after deployment, by configuring it using the server explorer.
I tried to do it after deployment, so what I did:
- Use System.Diagnostics.Trace in web API to log information and errors.
- kept default settings in cloud project (left 'enable diagnostics' check box unchecked).
- Deployed web API to Azure.
- Configured diagnostics using server explorer (Enable transfer of application logs).
Problem is that I don't see the trace information appearing in Application Logs if I do 'View Diagnostics Data' in server explorer.
I also tried to do it before deployment (which I would prefer), but then I get the build error: Cannot load imported module named 'Diagnostics.' after I added the import in the service definition file.
I'm probably forgetting something, but what?
Thanks!