Collecting logging in a Microsoft Azure WebJob

Zoe Sands, 26 June 2019

A triggered WebJob can handle its own logging and can be accessed by selecting your triggered WebJob then selecting logs as shown.

image

Logging in a continuous WebJob is a little trickier. This is because there is technically no endpoint, as soon as it finishes running it runs again. With a triggered WebJob you have a set start and finish which creates a distinct set of tracing information for each run. There is no distinct start and endpoint in a Continuous WebJob, therefore logging will require a different system. This logging system is Blob storage. To create a Blob you must first create a Storage Account.

To create a Blob go to your Storage Account and select Blobs > + Container (essentially new) > then select a name for your container (Blob) > click ok.

image

image

You have now created a Blob.

Linking your Blob to your WebJob.

Go back to your App Service and select Diagnostics Logs (under Monitoring).

image

Update application logging to be enabled, for the storage settings select the Blob  you just created. I would also suggest that you define a retention period for your logs otherwise they will not be deleted.

image