【问题标题】:Windows Azure: Can't see trace listener's output in diagnostics logsWindows Azure:在诊断日志中看不到跟踪侦听器的输出
【发布时间】:2013-03-20 17:03:55
【问题描述】:

我想在 Windows azure 诊断程序中使用跟踪侦听器记录一些消息。我可以看到诊断在我的永久存储上创建的 blob,但我看不到跟踪侦听器的输出。

这是我在工作角色 onStart 方法中的尝试:

            var config = DiagnosticMonitor.GetDefaultInitialConfiguration();
            config.Logs.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(1.0); 
            DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString", config);
            System.Diagnostics.Trace.Listeners.Add(new Microsoft.WindowsAzure.Diagnostics.DiagnosticMonitorTraceListener());
            System.Diagnostics.Trace.AutoFlush = true;
            System.Diagnostics.Trace.Write("some logging");

【问题讨论】:

标签: .net azure azure-storage azure-blob-storage azure-diagnostics


【解决方案1】:

您的日志中似乎缺少缓冲区。如果没有可读取的缓冲区,则将没有可传输的内容。尝试添加类似:

config.OverallQuotaInMB = 4096;
config.Logs.BufferQuotaInMB = 512;

您角色的诊断 blob(在 wad-control-container 中找到)内容应该类似于

<?xml version="1.0"?>
<ConfigRequest xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <DataSources>
        <OverallQuotaInMB>4096</OverallQuotaInMB>
        <Logs>
            <BufferQuotaInMB>512</BufferQuotaInMB>
            <ScheduledTransferPeriodInMinutes>1</ScheduledTransferPeriodInMinutes>
            <ScheduledTransferLogLevelFilter>Information</ScheduledTransferLogLevelFilter>
        </Logs>
        ....

【讨论】:

    【解决方案2】:

    我专门为在 Workerroles 中启用跟踪写了一篇博客文章。你在这里找到它: http://blog.amtopm.be/2014/07/20/azure-diagnostics-how-to-troubleshoot-your-code/

    如果您还有问题,请告诉我。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-10-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-09-24
      • 1970-01-01
      • 2011-04-04
      相关资源
      最近更新 更多