This question already has an answer here:
-
How do I write to the logs in Azure WebJobs from a C# console app?
2 answers
So I have tried:
Trace.TraceInformation("Trace.Information Found message on queue");
Debug.WriteLine("Debug Found message on queue");
Trace.WriteLine("Trace.WriteLine Found message on queue");
Console.WriteLine("Console.WriteLine Found message on queue");
But neither of them outputs to the Azure portal Web Jobs output log.
What am I missing?
Later edit:
Since the Beta version, the answer below is no longer correct. In order to log messages, you have to use a TextWriter now as shown in these samples:
https://github.com/Azure/azure-webjobs-sdk-samples/blob/master/BasicSamples/MiscOperations/Program.cs
Console.WriteLine should work. If that doesn't work, can you please post more code?
For messages written from inside a function, the logs should show up on the function invocation page.
For messages written outside of a function, the logs should show up in the job output log.
Console.WriteLine worked for me but log.WriteLine (as per the SDK samples) did not.
Turned out I needed to set the Webjob connection strings in the portal even though I had AzureWebJobsDashboard and AzureWebJobsStorage defined in the App.config.