user2486488
user2486488

Reputation: 111

How to control and maintain Azure web jobs control panel logging?

I am using azure web jobs in a system to process xml data received in real-time via a web service that is queued for later processing. Some of the webjob functions are invoked at quite a high frequency (100s per minute). When I first trialed the system the logging seemed to perform well. However now after several weeks a large volume of log data has accumulated it seems to stop updating and displays "indexing in process" fairly constantly.

  1. How do I 'purge' or clear-out the logs?
  2. Can I and should I turn off logging selectively for the frequently updated jobs? How can this be achieved?

My web jobs are continuous and use the c# api. My question isn't the same as Azure webjobs output logs indexing taking very long although this answer is also relevant - I was specifically asking how to purge the logs and turn off logging selectively.

Azure web jobs control panel logging

Upvotes: 1

Views: 400

Answers (1)

Abhay Saraf
Abhay Saraf

Reputation: 1212

  1. You would have configured the AzureWebJobsStorage application setting or connection string in your WebJob. The logs are stored in the blob storage of this storage account. You should be able to manually clear them up there.

  2. Assuming that you are using the Azure WebJobs SDK, you can plug in a custom logger

    JobHostConfiguration config = new JobHostConfiguration();
    config.Tracing.Tracers.Add(new CustomTraceWriter(TraceLevel.Info));
    JobHost host = new JobHost(config);
    host.RunAndBlock();
    

    CustomTraceWriter can wrap all writes within a check for an application setting

    if(CloudConfigurationManager.GetSetting("EnableWebJobLogging"))
    {
    ....
    }

Upvotes: 1

Related Questions