I\'m sure I have missed something simple but I can\'t get simple Trace.WriteLine to work on Azure.
Steps I have taken:
Microsoft.WindowsAzure.Plugins.Diagnostics
I had this same problem. I was using the solution here. I believe the piece you are missing is the location where logs are scheduled to be transferred (in this case, using a LocalResource path):
public override bool OnStart()
{
Trace.WriteLine("Entering OnStart...");
var traceResource = RoleEnvironment.GetLocalResource("TraceFiles");
var config = DiagnosticMonitor.GetDefaultInitialConfiguration();
// *** this part specifies where transfers should be stored ***
config.Directories.DataSources.Add(
new DirectoryConfiguration
{
Path = traceResource.RootPath,
Container = "traces",
DirectoryQuotaInMB = 100
});
config.Directories.ScheduledTransferPeriod = TimeSpan.FromMinutes(10);
DiagnosticMonitor.Start("DiagnosticsConnectionString", config);
return base.OnStart();
}
In order for this to work, you have to create a LocalStorage node to store these files in your ServiceDefinition.csdef
:
and you need to have a way to transfer these files to some place where you can get to them, because they are not available in the storage account, but on a local resource folder on the VM itself. I accomplish that with a webpage that allows me to download local resource files.