locked
App Service Application Logs not showing in Linux containerized application RRS feed

  • Question

  • We have an ASP.NET Core Web API that we deploy to App Service after we put it in a linux-based docker container.  The logging to the console works fine locally (running as a console app), but the application level logging does not get picked up in the cloud.

    We've enabled App Service Logs as the documentation tells you to, but we still don't see any application logs anywhere.  So then we decided to move to Application Insights, but they don't appear there either.

    Here is how we set up logging (probably more than we need, but we were trying lots of things):

    public class Program
        {
            #region Public Methods
            public static IHostBuilder CreateHostBuilder(string[] args)
            {
                return Host.CreateDefaultBuilder(args)
                    .ConfigureLogging(logging =>
                    {
                        logging.ClearProviders();
                        logging.AddAzureWebAppDiagnostics();
                        logging.AddConsole();
                        logging.AddFilter<ApplicationInsightsLoggerProvider>
                                ("Microsoft"LogLevel.Information)
                            .AddFilter<ApplicationInsightsLoggerProvider>
                                (""LogLevel.Warning)
                            .AddFilter<ApplicationInsightsLoggerProvider>
                                ("Microsoft"LogLevel.Error);
                    })
                    .ConfigureServices(serviceCollection => serviceCollection.Configure<AzureFileLoggerOptions>(options =>
                        {
                            options.FileName = "api-diagnostics-";
                            options.FileSizeLimit = 50 * 1024;
                            options.RetainedFileCountLimit = 5;
                        })
                        .Configure<AzureBlobLoggerOptions>(options => { options.BlobName = "log.txt"; }))
                    .ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
            }
            public static void Main(string[] args)
            {
                CreateHostBuilder(args).Build().Run();
            }
            #endregion
        }

    I'm not sure what else to show on this post, but I'm very lost as to how to diagnose this.

    Tuesday, April 14, 2020 11:21 PM

All replies

  • Thanks for asking question! Just to confirm if you are using Blob storage to enable application logging for Linux containerized application? If so, currently there is a limitation with this and Saving to blob storage is not available for Linux application logs although Filesystem is available.

    You may refer to this link on this: https://docs.microsoft.com/en-us/learn/modules/capture-application-logs-app-service/2-enable-and-configure-app-service-application-logging 

    Also, the best way to share your feedback would be to create a User Voice feedback item and upvote it. The product group monitors this site for feedback. This is the best way to ensure you are heard and you may receive a response depending on how much they information they can currently share.

    --------------------------------------------------------------------------------------------------------------

    We're migrating from MSDN to Microsoft Q&A as our new forums and Azure App Service has already made the move!  In future, you can ask and look for the discussion for Azure App Service related questions here:   https://docs.microsoft.com/answers/topics/azure-webapps.html

    We are actively working to onboard remaining Azure services on Microsoft Q&A. We will make a public announcement once complete. Want to Learn more about new platform: Microsoft Q&A Getting Started



    Wednesday, April 15, 2020 10:54 AM
  • I really want to respond to your post here, but I can't share the images I think are important because my account hasn't been verified.  Once it is verified (I'm waiting Verify Accounts 43 forum post, and I can't even give you the link because of my account.), I will answer your questions and clarify a few things
    Wednesday, April 15, 2020 3:53 PM
  • Alright, since I can't seem to get my account verified on the other forum post, I'll try my best without pictures...

    I set App Service Logs to 

    Application Logging > File System 

                                 > Quota 35 MB

                                 > Retention Period 14 days

    I set Diagnostic Settings (Preview) to

    All Logs and Metrics checked

    Send to Log Analytics checked

     > specified my Log Analytics workspace.

    I'm not sure I'm ready to ask for a feature on this because the documentation led me to believe that this just works.  If it doesn't, I think the documentation should say that.  And that will probably cause me to want to rethink the services I'm using.  I had a working session with Microsoft Experts that told me to use linux-based docker containers, and if that is the reason why I can't view my logs, I don't think I want to use Docker containers... or linux-based ones, I guess...

    Wednesday, April 15, 2020 8:05 PM
  • Thanks for the update on this will let get back to you shortly on this.
    Thursday, April 16, 2020 12:29 PM
  • Thanks for the reply! Yes you are correct according to the documentation with new Azure Monitor integration, you can create Diagnostic Settings (preview) to send logs to Storage Accounts, Event Hubs and Log Analytics. Please double check if you've enabled all the logs and set up endpoints before you see those specific logs. You may also want to investigate this article for Troubleshoot an App Service app with Azure Monitor might be helpful.  

    Let me know in case issue persists.  


    Friday, April 17, 2020 5:34 PM
  •  Just checking in to see if the above answer helped. If this answers your query, do click “Mark as Answer” and Up-Vote for the same, which might be beneficial to other community members reading this thread. And, if you have any further query do let us know.
    Wednesday, April 22, 2020 5:12 AM
  • Just checking in to see if the above answer helped. If this answers your query, do click “Mark as Answer” and Up-Vote for the same, which might be beneficial to other community members reading this thread. And, if you have any further query do let us know.
    Monday, April 27, 2020 3:46 PM
  • Is there any update on the issue?

    If the suggested answer helped for your issue, do click on "Mark as Answer" and “Vote as Helpful” on the post that helps you, this can be beneficial to other community members.

    Wednesday, May 6, 2020 3:47 PM