使用漂亮的EtwStream库,可以监听ETW事件。但是,在侦听SQL提供程序时,不会捕获命令文本:
ObservableEventListener.FromTraceEvent(WellKnownEventSources.SqlEventSource).LogToConsole(ev => ev.ToString());关于如何通过ETW发布这些数据,您有什么想法吗?
发布于 2019-09-23 16:24:55
此属性仅为存储过程填充:
private void WriteBeginExecuteEvent()
{
if (SqlEventSource.Log.IsEnabled() && Connection != null)
{
string commandText = CommandType == CommandType.StoredProcedure ? CommandText : string.Empty;
SqlEventSource.Log.BeginExecute(GetHashCode(), Connection.DataSource, Connection.Database, commandText);
}
}您只能重写对存储过程调用的查询或编写您自己的etw提供程序。
https://stackoverflow.com/questions/48991816
复制相似问题