本文介绍了语义记录IsEnabled si始终为false?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SLAB进程外程序在应用程序中记录ETW事件.

I'm using SLAB out-of-process to log ETW events in my applications.

今天我在WcfTestClient.exe下托管的WCF服务中有问题

Today I have a problem within WCF services hosted Under WcfTestClient.exe

当我将断点放入EventSource继承类的WriteEvent方法中时,IsEnabled()返回false!因此,没有任何事件写入进程外控制台日志:(

When I put breakpoint into WriteEvent methods of my EventSource inherited class, IsEnabled() return false !!!So no event is written to my console log out-of-process :(

启动ConsoleEventSink时,我可以看到我的eventSource已注册为LogAlways级别,而MatchAnyKeyword属性为None

When starting my ConsoleEventSink, I can see my eventSource registered with a LogAlways level and None for MatchAnyKeyword property

是否有任何想法检查此问题出了什么问题?

Any idea to check what is wrong for this problem ?

预先感谢

推荐答案

您的 EventSource 类中可能有一个错误.

You probably have an error in your EventSource class.

您可以分析EventSource以查看其是否正确定义.参见 https://dzimchuk.net/post/troubleshooting-slab-out-of-process-logging

You can analyze your EventSource to see whether it is correctly defined. See https://dzimchuk.net/post/troubleshooting-slab-out-of-process-logging

有一个Nuget软件包: https://www.nuget.org/packages/EnterpriseLibrary.SemanticLogging.EventSourceAnalyzer/

There's a Nuget package for it: https://www.nuget.org/packages/EnterpriseLibrary.SemanticLogging.EventSourceAnalyzer/

尝试为其创建单元测试并检查结果

Try creating a unit test for it and inspect the result

[TestClass]
public class EventSourceTests
{
    [TestMethod]
    public void MyEventSourceShouldBeValid()
    {
        var analyzer = new EventSourceAnalyzer();

        analyzer.Inspect(MyEventSource.Log);
    }
}

编辑

还提供到.Net Core的(非官方)端口,请参见此程序包.

A (non-official) port to .Net Core is available as well, see this package.

这篇关于语义记录IsEnabled si始终为false?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 14:01