나는 Azure Trace Logs에 의심의 여지가있다. 저는 작업자 역할을 가지고 특정 이벤트를 기록하고 싶습니다.어떻게 Azure Worker 역할의 진단 추적을 볼 수 있습니까?
응용 프로그램을 로컬로 배포 할 때 Cerebrata Cerebrata Cloud Storage를 사용하여 Trace를 읽을 수 있습니다. 그러나 우리가 숙박이나 생산에 배치 할 때 우리는 할 수 없습니다. 우리는 동일한 스토리지 계정을 사용하고 있습니다.
노동자 코드 :
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>
어디 우리가해야 할 것은? 이 코드에 문제가 있습니까?
감사합니다.
당신은 푸른 저장 연결 문자열 를 추가하는 것을 잊었다 수 있음 bb896647 – sll
모든 것이 올바르게 보입니다. "UseDevelopmentStorage = true"가 아닌 https로 시작하는 연결 문자열을 변경 했습니까? – dunnry
여기 Azure 로깅에 대한 유용한 MSDN 문서가 있습니다. http://msdn.microsoft.com/en-us/magazine/ff714589.aspx – dumbledad