我对Azure跟踪日志有疑问。 我有一个工作者角色,我想记录某些事件,如何查看我的Azure Worker角色的诊断跟踪?
当我们在本地部署应用程序时,我们可以使用Cerebrata Cerebrata云存储来读取跟踪。 但是,当我们部署到停留或生产,我们不能。我们正在使用相同的存储帐户。
工人代码:
public override bool OnStart()
{
// Set the maximum number of concurrent connections
ServicePointManager.DefaultConnectionLimit = 12;
DiagnosticMonitorConfiguration diagnosticMonitorConfiguration = DiagnosticMonitor.GetDefaultInitialConfiguration();
diagnosticMonitorConfiguration.Logs.ScheduledTransferPeriod = TimeSpan.FromMinutes(1.0);
diagnosticMonitorConfiguration.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
CloudStorageAccount cloudStorageAccount = CloudStorageAccount.DevelopmentStorageAccount;
DiagnosticMonitor diagnosticMonitor = DiagnosticMonitor.Start(cloudStorageAccount, diagnosticMonitorConfiguration);
return base.OnStart();
}
public override void Run()
{
// This is a sample worker implementation. Replace with your logic.
Trace.WriteLine("UpdateWorker entry point called", "Information");
while (true)
{
Thread.Sleep(5000);
Trace.WriteLine("Working", "Information" + DateTime.Now);
}
}
的App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.diagnostics>
<trace>
<listeners>
<add type="Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener, Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
name="AzureDiagnostics">
<filter type="" />
</add>
</listeners>
</trace>
</system.diagnostics>
</configuration>
我们应该在哪里看?这段代码有问题吗?
谢谢!
试用DbgView.exe实用http://technet.microsoft.com/en-us/sysinternals/ bb896647 – sll
一切都看起来正确。您确定您将连接字符串更改为以https开头的内容,而不是“UseDevelopmentStorage = true” – dunnry
有一篇关于Azure日志记录的有用MSDN文章:http://msdn.microsoft.com/en-us/magazine/ff714589.aspx – dumbledad