Millar
Millar

Reputation: 1095

logging error to azure VM?

I am dumping my Webapplications try catch exceptions Error trace messages to C:\Temp folder on webserver But when my webapp is on azure I was expecting see them inside azure VM c:\Temp folder,But I am getting an error message saying access to the path C:\temp denied .How can I write error logs to a text file and save to azure VM's C:\Temp ? or is this not possible on azure ? Any alternative solutions.

Upvotes: 0

Views: 276

Answers (1)

astaykov
astaykov

Reputation: 30893

Are you using Azure Web Role, or Azure Virtual Mashines, or Azure WebSites? I assume Azure Web Role (a.k.a. Cloud Service).

If this is the case you need to use Local Storage resource for your WebRole. Then you could use the Windows Azure Diagnostics to occasionally transfer your logs to a blob storage. The part you need from Diagnostics.Wadcfg is <DataSources> element, and its Sub-element <DirectoryConfiguration> which can have a child of type <LocalResource>. The former will have attribute name pointing to the Local Storage Resource you have configured for the WebRole.

If it is the case for Virtual Machine - you shall not have any issues as you have full Admin access rights and you can configure any aspects of the ACLs on that machine.

If it is Azure WebSites - do not write to C:\TEMP but instead make a local for the web application folder and just write there with Server.MapPath("~/local.logs/somelog.txt");

Upvotes: 2

Related Questions