Howard Hoffman
Howard Hoffman

Reputation: 917

Azure App Service Application Logs for permanent availability

We've 3 separate deployments:

  1. Azure App Service (Web API application) w/ no web-jobs
  2. Azure Dummy Web Site w/ 1 Web Job
  3. Azure Dummy Web site w/ 1 Web Job

We will update them from time-to-time; publishing to a Staging Deployment-Slot and then swapping the Staging slot to Production once we're comfortable w/ what was deployed. We sometimes do this for all 3 at the same time, and sometimes only 1 at a time.

The applications use NLog to to log interesting things (at DEBUG, INFO, etc.). We've configured xsi:type="File" targets that write to the local drive (which I realize is blob-backed and shared across all instances). We currently write to a location under %HOME%\site\wwwroot.

Problem with our approach is the log-files are bound to the particular Slot we happen to be running in.

So when we log in Production for a month, deploy to a Staging slot, then swap it to Production ... we wipe out the month's worth of NLog application logs. Actually it gets swapped over to Staging and we'd have to do some manually copying/moving to merge it with the new Production application log.

I am pretty sure we're missing something simple and we're doing this wrong, or the hard-way.

What is a way that we can "log" to one place assigned to "Production" and have that log data contain, in only one place, all the data logged by our application over multiple deployments to Production.

Upvotes: 0

Views: 1389

Answers (1)

Jambor - MSFT
Jambor - MSFT

Reputation: 3293

As Suwat Ch said. If you swap your web app from production to staging, the log file will move to staging too. If you want to keep the logging file in production, I would suggest you save the log info at Azure storage. Please try AzureTableStorageNLogTarget to save log info at azure table storage. Here is a github resource which demonstrator how to use it. Hope this could give you tips.

Upvotes: 1

Related Questions