Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure WebJobs: Can't find Trace logging

I've followed the instructions on this Microsoft webpage for logging messages from an Azure WebJob, but none of my messages appear in the log.

In my WebJob I write logging messages using

Trace.TraceInformation("blah blah blah");

In the configuration file's application diagnostics section I have blob storage logging turned on with the "Verbose" option.

Log files are being created (though I sometimes have to wait several minutes - in one case until the following morning - until the logs appear in the blob storage) but the logs don't contain my Trace messages.

So how do I log messages to these log files, and/or where does Trace get written to?

Here is an image of my configured options for logging:

enter image description here

And the configured blob storage is definitely the same as the one I'm looking in.

like image 835
awj Avatar asked Jan 09 '23 09:01

awj


1 Answers

To specify the storage account for Web Job logs, you need to add connection string under CONFIGURE tab > connection string sections, name of the connection string has to be AzureWebJobsDashboard.

It should be look like below:

  • Name: AzureWebJobsDashboard
  • Value: DefaultEndpointsProtocol=https;AccountName="";AccountKey=""
  • Type: Custom

You can also view logs in Azure portal, open the Web app and select WEBJOBS tab, click on the URL of web job, it will show the last runs, click on Toggle button, which shown details of the run including the custom messages written by app using below statement.

Console.WriteLine("Error While Doing Something ...");
like image 89
Sajad Deyargaroo Avatar answered Jan 15 '23 05:01

Sajad Deyargaroo