【发布时间】:2011-05-06 14:55:46
【问题描述】:
我正在使用 Enterprise Library 4.1、Visual Studio 2008、SQL Server 2008,并且正在使用数据库跟踪侦听器将错误记录到数据库中。
在我的开发系统中,一切正常,但在实时系统中,它无法正常工作。
权限没有问题——我确定存储过程中存在一些错误。
有没有办法追踪存储过程的错误?
【问题讨论】:
标签: database logging enterprise-library
我正在使用 Enterprise Library 4.1、Visual Studio 2008、SQL Server 2008,并且正在使用数据库跟踪侦听器将错误记录到数据库中。
在我的开发系统中,一切正常,但在实时系统中,它无法正常工作。
权限没有问题——我确定存储过程中存在一些错误。
有没有办法追踪存储过程的错误?
【问题讨论】:
标签: database logging enterprise-library
您的问题没有什么好说的。
但首先,我会检查您是否已将错误源配置为使用 非数据库 侦听器(例如平面文件或事件日志)。如果您使用的是配置文件,它看起来像:
<listeners>
<add source="Logging Quick Start" formatter="Text Formatter"
log="" machineName="." listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null"
traceOutputOptions="None" filter="All" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null"
name="Event Log Destination" />
</listeners>
<specialSources>
<errors switchValue="All" name="Logging Errors & Warnings">
<listeners>
<add name="Event Log Destination" />
</listeners>
</errors>
</specialSources>
如果(或曾经)您已经设置了该设置,则尝试将某些内容记录到数据库侦听器并检查是否记录了任何错误,表明数据库侦听器无法正常工作的原因。
如果我猜我会把钱花在某种连接问题上。
如果您认为问题出在 SQL 上,那么您可以启动 SQL Server Profiler 来跟踪 SQL Server 活动。您应该能够看到连接进来和正在执行的 SQL。如果您没有看到连接和存储过程的任何活动,那么您就知道没有调用 SQL Server。这意味着问题不在于 SQL Server/存储过程,而在于代码、配置、权限、防火墙等。
【讨论】: