3

MVC プロジェクトで azure を使用してログを記録しようとしましたが、これまでのところあまり成功していません。

私のServiceConfiguration.Cloud.cscfgファイルには、ブロブ ストレージを指すDiagnostics 接続文字列があります。

   ...
  <Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.DiagnosticsConnectionString" value="**ConectionString**" />
</ConfigurationSettings>

トレースweb.configが設定されています

    ...
    <tracing>
      <traceFailedRequests>
        <remove path="*"/>
        <add path="*">
          <traceAreas>
            <add provider="ASP" verbosity="Verbose" />
            <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
            <add provider="ISAPI Extension" verbosity="Verbose" />
            <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module" verbosity="Verbose" />
          </traceAreas>
          <failureDefinitions timeTaken="00:00:15" statusCodes="400-599" />
        </add>
      </traceFailedRequests>
    </tracing>
  </system.webServer>

WebRole.csの中には次のものがあります

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Diagnostics;
using Microsoft.WindowsAzure.ServiceRuntime;

namespace MvcWebRole1
{
    public class WebRole : RoleEntryPoint
    {
        public override bool OnStart()
        {
         // Get the factory configuration so that it can be edited
         DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration();


         // Set scheduled transfer interval for infrastructure logs to 1 minute
         config.DiagnosticInfrastructureLogs.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(1);

         // Specify a logging level to filter records to transfer

         config.DiagnosticInfrastructureLogs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;

         // Set scheduled transfer interval for user's Windows Azure Logs to 1 minute
         config.Logs.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(1);


         DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.DiagnosticsConnectionString", config);

         //RoleEnvironment.Changing += this.RoleEnvironmentChanging;

         return base.OnStart();
        }
    }
}

しかし、診断ログが表示されません

Azure Blob Stoage のスクリーンショット

フォルダーにはとmamが含まれているだけで、フォルダーは空で、展開ごとにファイルがあります。MACommanda.xmlMASecretvsdeploywad-control-container

私は何かを見逃していますか/何か間違っていますか?

http://msdn.microsoft.com/en-us/library/windowsazure/gg433048.aspx、特にhttp://channel9.msdn.com/learn/courses/Azure/Deployment/のガイドに従おうとしていますDeployingApplicationsinWindowsAzure/Exercise-3-Monitoring-Applications-in-Windows-Azure

アップデート:

問題の一部である可能性のある以下を見つけました

IIS7 ログが正しく収集されない - http://msdn.microsoft.com/en-us/library/hh134842

これは 404 が機能していないことのみを説明する必要がありますが、障害定義が 15 秒の場合、コントローラー アクションでの 17 秒のスリープはまだログに記録されているはずです。

4

3 に答える 3

2

最終的に Azure Web ロールですべてのログを取得できた方法は次のとおりです。

WebRole.cs に以下を含めます。

 // Get the default initial configuration for DiagnosticMonitor.
        var config = DiagnosticMonitor.GetDefaultInitialConfiguration();

        // Filter the logs so that only error-level logs are transferred to persistent storage.
        config.DiagnosticInfrastructureLogs.ScheduledTransferLogLevelFilter = config.Logs.ScheduledTransferLogLevelFilter = 
            config.WindowsEventLog.ScheduledTransferLogLevelFilter = LogLevel.Verbose;

        // Schedule a transfer period of 30 minutes.
        config.DiagnosticInfrastructureLogs.ScheduledTransferPeriod = config.Logs.ScheduledTransferPeriod = config.WindowsEventLog.ScheduledTransferPeriod = 
            config.Directories.ScheduledTransferPeriod = config.PerformanceCounters.ScheduledTransferPeriod = TimeSpan.FromMinutes(1);

        // Specify a buffer quota.
        config.DiagnosticInfrastructureLogs.BufferQuotaInMB = config.Logs.BufferQuotaInMB = config.WindowsEventLog.BufferQuotaInMB = 
            config.Directories.BufferQuotaInMB = config.PerformanceCounters.BufferQuotaInMB = 512;

        // Set an overall quota of 8GB maximum size.
        config.OverallQuotaInMB = 8192;

        // WindowsEventLog data buffer being added to the configuration, which is defined to collect event data from the System and Application channel
        config.WindowsEventLog.DataSources.Add("System!*");
        config.WindowsEventLog.DataSources.Add("Application!*");

        // Use 30 seconds for the perf counter sample rate.
        TimeSpan perfSampleRate = TimeSpan.FromSeconds(30D);

        config.PerformanceCounters.DataSources.Add(new PerformanceCounterConfiguration()
        {
            CounterSpecifier = @"\Memory\Available Bytes",
            SampleRate = perfSampleRate
        });

        config.PerformanceCounters.DataSources.Add(new PerformanceCounterConfiguration()
        {
            CounterSpecifier = @"\Processor(_Total)\% Processor Time",
            SampleRate = perfSampleRate
        });

        config.PerformanceCounters.DataSources.Add(new PerformanceCounterConfiguration()
        {
            CounterSpecifier = @"\ASP.NET\Applications Running",
            SampleRate = perfSampleRate
        });



        // Start the DiagnosticMonitor using the diagnosticConfig and our connection string.
        DiagnosticMonitor.Start("Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString",config);


        return base.OnStart();

system.WebServer の下の web.config で、次を追加します。

    <tracing>
  <traceFailedRequests>
    <remove path="*"/>
    <add path="*">
      <traceAreas>
        <add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
        <add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module" verbosity="Verbose" />
      </traceAreas>
      <failureDefinitions statusCodes="400-599" />
    </add>
  </traceFailedRequests>
</tracing>

サービス定義ファイルで、Web ロールの下に以下を追加します。

 <LocalResources>
  <LocalStorage name="DiagnosticStore" sizeInMB="8192" cleanOnRoleRecycle="false"/>
</LocalResources>

これにより、MVC アプリケーションですべてのログが有効になります。

于 2012-09-13T23:43:46.027 に答える
0

wad-control-container 内の適切なファイルを表示して、デプロイメントの診断設定を確認します。

私の経験では、DiagnosticInfrastructureLogs または Logs に必要なすべての値を設定していないことに注意してください。

これを試して:

             // Get the factory configuration so that it can be edited
         DiagnosticMonitorConfiguration config = DiagnosticMonitor.GetDefaultInitialConfiguration();

         config.DiagnosticInfrastructureLogs.bufferQuotaInMB = 512;
         config.DiagnosticInfrastructureLogs.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(1D);
         config.DiagnosticInfrastructureLogs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;

         config.Logs.bufferQuotaInMB = 512;
         config.Logs.ScheduledTransferLogLevelFilter = LogLevel.Verbose;
         config.Logs.ScheduledTransferPeriod = System.TimeSpan.FromMinutes(1D);

それを開始してみてください。トレース リスナーが追加されていることも確認してください。

于 2012-09-05T13:35:25.287 に答える
0

「failureDefinitions」ノードから「timeTaken」属性を削除してみてください。参照: http://msdn.microsoft.com/en-us/library/aa965046(v=VS.90).aspx .

于 2012-09-05T10:15:14.307 に答える