locked
Logging output customizations for aspnet core app hosted in Azure RRS feed

  • Question

  • User1856098320 posted

    I am able to get my aspnet 2.2 application to log to blob storage in Azure with no issue, but I also get a ton of logging from the framework that I would like to throttle/turn down.

    At this time, my appsettings.json is simply deployed with the following:

    "Logging": {
          "LogLevel": {
          "Default": "Warning"
         }
    }

    In my Azure "App Service logs" settings, I have Application Logging (Blob) set to Information
    My understanding is:
    * The setting in App Service logs would allow events of Information and above to be shown
    * The setting in the appsettings file would define that only events of Warning and above would be shown 
    * The setting in the appsettings would take precedent and therefore only Warning and above would be logged to the blob

    Is my understanding correct?  

    Wednesday, June 26, 2019 6:48 PM

Answers

  • User1856098320 posted

    Thanks for point me to this link. 

    What ended up working for me is the following:

    App Service Logs (Application Logging) set to Information.

    My appsettings.json set to:

    "Logging": {
         "IncludeScopes": false,
         "AzureAppServicesBlob": {
              "LogLevel": {
                   "Default": "Warning",
                   "Microsoft": "Warning",
                   "System": "Warning",
                   "Web.Areas.Identity.Pages.Account.RegisterModel": "Information"
             }
         },
    "LogLevel": {
    "Default": "Warning"
    }
    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 1, 2019 6:07 PM

All replies

  • User-1764593085 posted

    Hi thievlf,

    Yes.Someone explains it clearly that :

    When using Azure App Service Logging, the available log level would be the larger one between the level you set in your filtering rules and the application level your configured on Azure Portal. In order to capture information-level logs reported from your assemblies, the Application Level you configured on Azure Portal need to less than or equal information-level, you could configure it to verbose or information.

    Refer to Filtering logs in Azure Web App Diagnostics Logs

    Thursday, June 27, 2019 8:27 AM
  • User1856098320 posted

    Thanks for point me to this link. 

    What ended up working for me is the following:

    App Service Logs (Application Logging) set to Information.

    My appsettings.json set to:

    "Logging": {
         "IncludeScopes": false,
         "AzureAppServicesBlob": {
              "LogLevel": {
                   "Default": "Warning",
                   "Microsoft": "Warning",
                   "System": "Warning",
                   "Web.Areas.Identity.Pages.Account.RegisterModel": "Information"
             }
         },
    "LogLevel": {
    "Default": "Warning"
    }
    }

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, July 1, 2019 6:07 PM