Azure的诊断是不保存在蔚蓝的日志表 [英] Azure Diagnostic is not saving logs in azure tables
问题描述
刚刚签入的Windows Azure SDK 2.0引入的新功能 - 启用诊断
Just checking the new features introduced in windows azure sdk 2.0 - Enable Diagnostics.
刚刚创建与MVC 4 Web角色一个新的Azure云项目,并从配置部分启用的诊断,但日志没有被保存在蔚蓝表 - WADLogsTable,WADDiagnosticInfrastructureLogsTable
Just created a new azure cloud project with MVC 4 Web Role and enabled diagnostics from the configuration section but the none of the logs are saved on the azure tables - WADLogsTable, WADDiagnosticInfrastructureLogsTable.
diagnostics.wadcfg
diagnostics.wadcfg
<?xml version="1.0" encoding="utf-8"?>
<DiagnosticMonitorConfiguration configurationChangePollInterval="PT1M" overallQuotaInMB="4096" xmlns="http://schemas.microsoft.com/ServiceHosting/2010/10/DiagnosticsConfiguration">
<DiagnosticInfrastructureLogs />
<Directories>
<IISLogs container="wad-iis-logfiles" />
<CrashDumps container="wad-crash-dumps" />
</Directories>
<Logs bufferQuotaInMB="1024" scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Verbose" />
<WindowsEventLog bufferQuotaInMB="1024" scheduledTransferPeriod="PT1M" scheduledTransferLogLevelFilter="Verbose">
<DataSource name="Application!*" />
</WindowsEventLog>
</DiagnosticMonitorConfiguration>
ServiceDefinition.csdef中
ServiceDefinition.csdef
<?xml version="1.0" encoding="utf-8"?>
<ServiceDefinition name="AzureWebApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceDefinition" schemaVersion="2013-03.2.0">
<WebRole name="MvcWebApp" vmsize="Small">
<Sites>
<Site name="Web">
<Bindings>
<Binding name="Endpoint1" endpointName="Endpoint1" />
</Bindings>
</Site>
</Sites>
<Endpoints>
<InputEndpoint name="Endpoint1" protocol="http" port="80" />
</Endpoints>
<Imports>
<Import moduleName="Diagnostics" />
</Imports>
</WebRole>
</ServiceDefinition>
ServiceConfiguration.Cloud.cscfg
ServiceConfiguration.Cloud.cscfg
<?xml version="1.0" encoding="utf-8"?>
<ServiceConfiguration serviceName="AzureWebApp" xmlns="http://schemas.microsoft.com/ServiceHosting/2008/10/ServiceConfiguration" osFamily="3" osVersion="*" schemaVersion="2013-03.2.0">
<Role name="MvcWebApp">
<Instances count="1" />
<ConfigurationSettings>
<Setting name="Microsoft.WindowsAzure.Plugins.Diagnostics.ConnectionString" value="UseDevelopmentStorage=true" />
</ConfigurationSettings>
</Role>
</ServiceConfiguration>
WebRole.cs - 从MVC应用程序
WebRole.cs -- From MVC Application
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using Microsoft.WindowsAzure;
using Microsoft.WindowsAzure.Diagnostics;
using Microsoft.WindowsAzure.ServiceRuntime;
namespace MvcWebApp
{
public class WebRole : RoleEntryPoint
{
public override void Run()
{
// This is a sample webrole implementation. Replace with your logic.
while (true)
{
Thread.Sleep(10000);
Trace.WriteLine("Working", "Information");
}
}
public override bool OnStart()
{
// For information on handling configuration changes
// see the MSDN topic at http://go.microsoft.com/fwlink/?LinkId=166357.
Trace.WriteLine("Starting Web Role ...", "Information");
return base.OnStart();
}
}
}
我期待Trace.WriteLine错误,即启动Web角色...和工作来保存在蔚蓝表 - WADLogsTable
I was expecting the Trace.WriteLine error i.e. "Starting Web Role ..." and "Working" to the saved in the azure table - WADLogsTable.
任何帮助将AP preciated。
Any Help will be appreciated.
感谢
Bhavesh
推荐答案
您不需要任何自定义的仪器code添加到您的OnStart()方法,如果部署一个 diagnostics.wadcfg
文件。
You don't need to add any custom instrumentation code to your OnStart() method if you deploy a diagnostics.wadcfg
file.
问题在于包含 ServiceConfiguration.Cloud.cscfg
文件DevelopmentStorage =真正的
- 更换它与你的实际存储账户或确保您的部署工具做的。
The problem lies in the ServiceConfiguration.Cloud.cscfg
file that contains "DevelopmentStorage=true"
-- replace it with your real storage account or make sure that your deployment tool does it.
这篇关于Azure的诊断是不保存在蔚蓝的日志表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!