Logging 企业库5:未将异常记录到Windows Azure上的事件日志
我有一个部署为Windows Azure Web角色的WCF服务 我正在使用企业库进行异常处理,在我的本地开发结构中,似乎可以使用事件日志处理程序(记录到应用程序事件日志)正确地处理和记录异常 当它在Azure上运行时,虽然似乎应用了异常策略(因为我观察到某些预期异常的正确处理),但没有任何内容记录到事件日志中 以下是异常处理策略:Logging 企业库5:未将异常记录到Windows Azure上的事件日志,logging,azure,enterprise-library,enterprise-library-5,Logging,Azure,Enterprise Library,Enterprise Library 5,我有一个部署为Windows Azure Web角色的WCF服务 我正在使用企业库进行异常处理,在我的本地开发结构中,似乎可以使用事件日志处理程序(记录到应用程序事件日志)正确地处理和记录异常 当它在Azure上运行时,虽然似乎应用了异常策略(因为我观察到某些预期异常的正确处理),但没有任何内容记录到事件日志中 以下是异常处理策略: <add name="Entity"> <exceptionTypes> <add name="All Exception
<add name="Entity">
<exceptionTypes>
<add name="All Exceptions"
type="System.Exception, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
postHandlingAction="NotifyRethrow">
<exceptionHandlers>
<add name="Logging Exception Handler"
type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
logCategory="General"
eventId="100"
severity="Error"
title="Enterprise Library Exception Handling"
formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling"
priority="0" />
</exceptionHandlers>
</add>
</exceptionTypes>
</add>
下面是日志记录配置:
<loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
<listeners>
<add name="Event Log Listener"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" source="Enterprise Library Logging" formatter="Text Formatter"
log="Application"
machineName="."
traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack" />
</listeners>
<formatters>
<add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
template="Timestamp: {timestamp}{newline}
Message: {message}{newline}
Category: {category}{newline}
Priority: {priority}{newline}
EventId: {eventid}{newline}
Severity: {severity}{newline}
Title:{title}{newline}
Machine: {localMachine}{newline}
App Domain: {localAppDomain}{newline}
ProcessId: {localProcessId}{newline}
Process Name: {localProcessName}{newline}
Thread Name: {threadName}{newline}
Win32 ThreadId:{win32ThreadId}{newline}
Extended Properties: {dictionary({key} - {value}{newline})}"
name="Text Formatter" />
</formatters>
<categorySources>
<add switchValue="All" name="General">
<listeners>
<add name="Event Log Listener" />
</listeners>
</add>
</categorySources>
<specialSources>
<allEvents switchValue="All" name="All Events" />
<notProcessed switchValue="All" name="Unprocessed Category" />
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Event Log Listener" />
</listeners>
</errors>
</specialSources>
</loggingConfiguration>
知道出了什么问题吗?最好的日志记录方法是使用诊断跟踪侦听器。Windows Azure中事件日志的名称不同。要使用此企业库,您需要将事件日志侦听器更改为Windows Azure诊断跟踪侦听器。我们在书中有更多关于这方面的信息。代码在VS2008中,但您可以在VS2010中打开以查看示例。在代码中,查看如何使用Windows Azure诊断跟踪侦听器设置企业库日志记录。您将需要确保移动日志以查看信息。这本书对此进行了详细介绍 如果您只想快速浏览一下,您可以从我们的codeplex网站下载音乐应用程序,该网站展示了如何在Windows Azure中使用企业库。这是我们正在努力升级的旧版本
有关跟踪的详细信息。进行日志记录的最佳方法是使用诊断跟踪侦听器。Windows Azure中事件日志的名称不同。要使用此企业库,您需要将事件日志侦听器更改为Windows Azure诊断跟踪侦听器。我们在书中有更多关于这方面的信息。代码在VS2008中,但您可以在VS2010中打开以查看示例。在代码中,查看如何使用Windows Azure诊断跟踪侦听器设置企业库日志记录。您将需要确保移动日志以查看信息。这本书对此进行了详细介绍 如果您只想快速浏览一下,您可以从我们的codeplex网站下载音乐应用程序,该网站展示了如何在Windows Azure中使用企业库。这是我们正在努力升级的旧版本
有关跟踪的详细信息。使用带有默认设置的事件日志跟踪侦听器的先决条件是确保安装了默认事件源(“企业库日志记录”)。要安装此事件源(或任何其他自定义源)并使用此侦听器,可以使用执行Windows PowerShell脚本的启动任务。这些脚本安装自定义源代码。与相应的PowerShell脚本一起使用此方法。使用具有默认设置的事件日志跟踪侦听器的先决条件是确保安装了默认事件源(“企业库日志记录”)。要安装此事件源(或任何其他自定义源)并使用此侦听器,可以使用执行Windows PowerShell脚本的启动任务。这些脚本安装自定义源代码。与相应的PowerShell脚本一起使用此方法。您的意思是没有任何内容记录到事件日志中吗?还是在表存储中创建Azure诊断?如果不是azure diagnostics,那么您如何检查事件日志中没有任何内容?Stuart,事件日志中没有任何内容。我通过RDP(在SDK v1.3中引入)连接到正在运行的实例,并使用事件查看器。你是说没有任何内容记录到事件日志中吗?还是在表存储中创建Azure诊断?如果不是azure diagnostics,那么您如何检查事件日志中没有任何内容?Stuart,事件日志中没有任何内容。我通过RDP(在SDK v1.3中引入)和Event Viewer连接到正在运行的实例。Scott,感谢您的回复。通常,我会使用Azure诊断跟踪侦听器;当然是生产用的。当然,问题是如何读取日志。在一家大公司工作,获得购买Brabrata的Azure Diagnostic Manager的批准是徒劳的,出于某种原因,Windows Azure MMC版本似乎已经从code.msdn.microsoft.com中消失了(请参阅本书附录E)。对于快速分析,能够查看角色实例上的事件日志仍然很有用。我仍然想知道为什么它没有登录。Steve,我们在patterns&practices公司,正在开始为EntLib开发一个新的集成包——Azure包。请随意建议您希望在此处看到支持的特定场景:。我们将与其他项目一起评估它们,并形成一个优先待办事项。Scott,感谢您的回复。通常,我会使用Azure诊断跟踪侦听器;当然是生产用的。当然,问题是如何读取日志。在一家大公司工作,获得购买Brabrata的Azure Diagnostic Manager的批准是徒劳的,出于某种原因,Windows Azure MMC版本似乎已经从code.msdn.microsoft.com中消失了(请参阅本书附录E)。对于快速分析,能够查看角色实例上的事件日志仍然很有用。我仍然想知道为什么它没有登录。Steve,我们在patterns&practices公司,正在开始为EntLib开发一个新的集成包——Azure包。请随意建议您希望在此处看到支持的特定场景:。我们将与其他项目一起评估它们,并形成一个优先待办事项。