I have .Net
Worker role (Azure) and my application write to local log files in this form:
StreamWriter sw = File.AppendText("aaa.log");
sw.WriteLine("Error occured"");
sw.Close();
How can I see this log file ?
I have .Net
Worker role (Azure) and my application write to local log files in this form:
StreamWriter sw = File.AppendText("aaa.log");
sw.WriteLine("Error occured"");
sw.Close();
How can I see this log file ?
Here is the direct answer to your above question as you presented:
If you just create a blank Windows Azure Worker Role from template and add above code exactly in the OnStart() function and then test your application in Compute Emulator:
public override bool OnStart()
{
// Set the maximum number of concurrent connections
ServicePointManager.DefaultConnectionLimit = 12;
StreamWriter sw = File.AppendText("aaa.log");
sw.WriteLine("Error occured");
sw.Close();
return base.OnStart();
}
You will see the aaa.log file is created in the location below and you can match the folder details as my test application name is "TestWorkerRole":
_your_drive_and_Folder_path\TestWorkerRole\TestWorkerRole\csx\Debug\roles\WorkerRole1\approot\aaa.log
I can also verify that it has the text "Error occurred" also in it so the code executed as it supposed to.
When you will deploy the exact same application to Windows Azure, the code will run and you will find the same aaa.log file is generated at:
E:\approot\bin
Is above approach is correct, NOT AT ALL and you must not use it, due to following main reasons: