SLAB,进程外:更改事件源方法的签名会导致错误的事件记录 [英] SLAB, out-of-process: changing the signature of an event source method causes incorrect event logging

查看:97
本文介绍了SLAB,进程外:更改事件源方法的签名会导致错误的事件记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现了一个用于记录事件的事件源类.重复更改一种记录事件的方法的签名(参数名称和参数类型)后,将不再正确记录事件.例如,当记录事件时,不是使用当前参数名称设置有效负载,而是使用方法的先前版本使用的参数记录事件.例如:

方法的版本n:

    [Event(5, Message = "Action: {0}",
    Task = Tasks.PAGE,
    Keywords = Keywords.USER_ACTION,
    Level = EventLevel.Informational)]
    public void LogAction(string action, string paramName)
    {
        this.WriteEvent(5, action, paramName);
    }

方法的n + 1版:

    [Event(5, Message = "Action: {0}",
    Task = Tasks.PAGE,
    Keywords = Keywords.USER_ACTION,
    Level = EventLevel.Informational)]
    public void LogAction(string action, string newParamName)
    {
        this.WriteEvent(5, action, newParamName);
    }

调用此方法记录事件时,将使用参数名称paramName而不是newParamName设置有效负载值进行记录.

现在,问题是:如何清除缓存",以便系统忘记该方法的旧版本,而新方法可以正确记录事件?

LE:我测试了PerfView的日志记录.有趣的是,它可以正确读取日志.我再次使用SemanticLogging-svc.exe测试,日志仍然显示不正确.看来问题不在于记录事件,而是在于读取事件.

解决方案

我猜事件源没有发布清单更改,或者SLAB无法识别更改.

请注意,仅通过更改看起来违反事件源版本控制规则的参数名称即可:但是,我可以看到,在开发过程中,在将接口形式化之前,这仍然可能会引起问题.

您还可以检查清单文件架构缓存文件夹,该文件夹位于Path.GetTempPath()\ 7D2611AE-6432-4639-8B91-3E46​​EB56CADF \文件夹中.例如C:\ Users \\ AppData \ Local \ Temp \ 7D2611AE-6432-4639-8B91-3E46​​EB56CADF或也许C:\ Windows \ ServiceProfiles \ LocalService \ AppData \ Local \ Temp \ 7D2611AE-6432-4639-8B91-3E46​​EB56CADF >

如果您在缓存中看到清单,则可以将其删除以查看是否有助于获取最新更改.

I implemented an event source class for logging events. After repeatedly changing the signature (parameters names and parameters types) of one method that logs events, the events are no longer correctly logged. For instance when an event is logged, instead of setting the Payload with the current parameters name, the events are logged using the parameters used for the previous version of the method. Eg:

Version n of the method:

    [Event(5, Message = "Action: {0}",
    Task = Tasks.PAGE,
    Keywords = Keywords.USER_ACTION,
    Level = EventLevel.Informational)]
    public void LogAction(string action, string paramName)
    {
        this.WriteEvent(5, action, paramName);
    }

Version n+1 of the method:

    [Event(5, Message = "Action: {0}",
    Task = Tasks.PAGE,
    Keywords = Keywords.USER_ACTION,
    Level = EventLevel.Informational)]
    public void LogAction(string action, string newParamName)
    {
        this.WriteEvent(5, action, newParamName);
    }

When this method is called for logging events, they are logged setting the Payload value with the parameter name paramName instead of newParamName.

And now, the question: how do I clear the "cache", so the system forgets the old version of the method and the new method can log the events correctly?

LE: I tested logging with PerfView. Funny thing, it reads the logs correctly. I tested again with SemanticLogging-svc.exe, the logs are still displayed incorrect. It looks like the problem is not on logging the events, but in reading them.

解决方案

I would guess that event source is not publishing the manifest changes or SLAB is not recognizing the changes.

Note that by just changing the parameter name that looks to be violating the Event Source versioning rules: "Once you add an event with certain set of payload properties, you cannot rename the event, remove any properties, or change the meaning of the existing properties." However, I can see that in development before the interface is formalized this can still cause issues.

You can also check the manifest schema cache folder which is in the Path.GetTempPath()\7D2611AE-6432-4639-8B91-3E46EB56CADF\ folder. e.g. C:\Users\\AppData\Local\Temp\7D2611AE-6432-4639-8B91-3E46EB56CADF or perhaps C:\Windows\ServiceProfiles\LocalService\AppData\Local\Temp\7D2611AE-6432-4639-8B91-3E46EB56CADF.

If you see your manifest in the cache you can delete it to see if that helps with picking up the latest changes.

这篇关于SLAB,进程外:更改事件源方法的签名会导致错误的事件记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆