access_time 5 months ago languageEnglish
more_vert

Configure Azure Blob Storage as Application Log Storage

visibility 273 comment 2
Azure App Service is a server-less product that can be used to host websites. For ASP.NET core websites, App Service Log feature allows users to configure logging for the web application. This article will show you how to configure Azure Blog Storage container as logging storage for ASP.NET Core ...
info Last modified by Raymond 5 months ago
thumb_up 0

comment Comments

5 months ago link more_vert

Hi Felix,

Unfortunately, I don't think you can write logs to just one file as it is hard-coded:

var blobName = $"{_appName}/{key.Year}/{key.Month:00}/{key.Day:00}/{key.Hour:00}/{_fileName}";

You have to implement your own customized logger to do that. Azure Blob Storage has .NET APIs you can use to invoke in your ASP.NET core applications to write into blob storage directly. 

For example, the following article uses those APIs to write uploaded images into Azure Blob Storage and you can easily change it to write text files. 
format_quote

person Felix access_time 5 months ago
Re: Configure Azure Blob Storage as Application Log Storage

Hi, great article! 

Is it possible to change the folder structure of the logs from 

"Year (2020) > Month (12) > Day (22) > Hour (05) > Application log file."
To just one simple Logfile? Like ./logs/applicationlogfile.log

I tried several things in .ConfigureLogging()

But I'm not sure if the Azure App Service is just overwriting the settings or not. It's kind of time consuming to find a solution because it always requires a web release + appservice restart to test it... After several hours I'm kind of desperated now :) 

If they would it must work with disabling logging on the Azure portal settings and then define the destination of the logfile manually in .ConfigureLogging().

5 months ago link more_vert

Hi, great article! 

Is it possible to change the folder structure of the logs from 

"Year (2020) > Month (12) > Day (22) > Hour (05) > Application log file."
To just one simple Logfile? Like ./logs/applicationlogfile.log

I tried several things in .ConfigureLogging()

But I'm not sure if the Azure App Service is just overwriting the settings or not. It's kind of time consuming to find a solution because it always requires a web release + appservice restart to test it... After several hours I'm kind of desperated now :) 

If they would it must work with disabling logging on the Azure portal settings and then define the destination of the logfile manually in .ConfigureLogging().

Forum discussions for column Azure.

Follow Kontext

Get our latest updates on LinkedIn or Twitter.

Want to contribute on Kontext to help others?

Learn more