Equivalent to Azure App Service's AddAzureWebAppDiagnostics() for application logs?

Viewed 166

Is there a non-App Service equivalent to the ILoggerFactory.AddAzureWebAppDiagnostics extension in the Azure SDK libraries (or where ever), as shown below in our application startup:

    public void Configure(
        IApplicationBuilder app,
        IHostingEnvironment environment,
        ILoggerFactory loggerFactory)
    {
        loggerFactory
            .AddAzureWebAppDiagnostics()
            .AddConsole()
            .AddDebug();

        ...
    }

We only need the append blob logging for application logs.

We are migrating our application layer from Azure App Service to Azure Kubernetes Service, but looking to keep the same blob logging functionality that we have been using until now.

1 Answers

Is there a non-App Service equivalent to the ILoggerFactory.AddAzureWebAppDiagnostics extension in the Azure SDK libraries (or where ever)

I'm afraid to say no. .NET core did support many third-party logging providers, but AddAzureWebAppDiagnostics could store logs to Azure storage or file system depends on setting Application Logging (Filesystem or blob) to On. You could find it here.

So if you want to use other methods to store logs to storage, I think you need to implement it with the help with other tools. Like if you use Serilog to manage log you could use Serilog.Sinks.AzureBlobStorage this package to implement it.

And before you work with Kubernetes log, you could read this blog about monitoring log file with Kubernetes.

Hope this could help you, if you still have other questions, please let me know.

Related