看看windows azure sdk 2.0 - Enable Diagnostics中引入的新功能。
刚刚使用MVC4Web角色创建了一个新的azure云项目,并从配置部分启用了诊断,但没有日志保存在azure表中- WADLogsTable,WADDiagnosticInfrastructureLogsTable。
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
<?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
<?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应用程序
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。
任何帮助都将不胜感激。
谢谢
Bhavesh
发布于 2013-06-04 02:03:42
如果部署diagnostics.wadcfg文件,则不需要向OnStart()方法添加任何自定义检测代码。
问题出在包含"DevelopmentStorage=true"的ServiceConfiguration.Cloud.cscfg文件中--用您的实际存储帐户替换它,或者确保您的部署工具能够做到这一点。
https://stackoverflow.com/questions/16899093
复制相似问题