I have a .NET solution with two projects:
- LoggingWebJob
- LoggingWebSite
The first project is a .NET Core 3.1 Azure WebJob created by using the template in Visual Studio. I am publishing that WebJob to Azure by Visual Studio and its appearing in Azure and showing logs in the WebJobs Dashboard.
The other project is a .NET Core 3.1 MVC App. That is also deployed fine to Azure through Visual Studio.
In Azure I turned on App Service Logs in hope to see Log Stream for both Apps & see the logs in blob storage. I set the level Verbose for both Application FileSystem & Blob. However I am able to see the logs for LoggingWebSite, but not for LoggingWebJob in both filesystem & as files in blob storage.
This is my Program.cs file:
class Program
{
static async Task Main(string[] args)
{
var builder = new HostBuilder();
builder.ConfigureWebJobs(b =>
{
b.AddAzureStorageCoreServices();
b.AddAzureStorage();
});
builder.ConfigureLogging((context, b) =>
{
b.AddConsole();
b.add
});
var host = builder.Build();
using (host)
{
await host.RunAsync();
}
}
}
This is the function file of the WebJob where logs should be generated:
public class Functions
{
public static void ProcessQueueMessage([QueueTrigger("webjobqueue")] string message, ILogger logger)
{
var ts = new TraceSource("Diagoutput");
ts.TraceEvent(TraceEventType.Verbose, 1, $"ProcessQueueMessage verbose trace {message}");
ts.TraceEvent(TraceEventType.Information, 1, $"ProcessQueueMessage info trace {message}");
ts.TraceEvent(TraceEventType.Warning, 1, $"ProcessQueueMessage warn trace {message}");
ts.TraceEvent(TraceEventType.Error, 1, $"ProcessQueueMessage err trace {message}");
ts.TraceEvent(TraceEventType.Critical, 1, $"ProcessQueueMessage crit trace {message}");
logger.LogInformation(message);
Console.WriteLine($"ProcessQueueMessage Console {message}");
Console.Error.WriteLine($"ProcessQueueMessage Console Error {message}");
}
}
So I am really wondering if Live Log Stream & Logs to blob are supported for WebJobs as part of App Service also? If so, what may be possible reasons for not seeing the logs?