简体   繁体   English

如何在语义记录应用程序块中更改事件的消息

[英]How does one change a message for an event in Semantic Logging Application Block

I've created an EventSource in my application, which is using SLAB. 我在我的应用程序中创建了一个EventSource,它正在使用SLAB。 It's working fine, for the most part. 在大多数情况下,它工作正常。 I had an initial message, but I decided to change the message. 我有一条初始消息,但我决定更改消息。 Whenever the out-of-process logger receives an event, it uses the old message instead of the new one. 每当进程外记录器接收到事件时,它都使用旧消息而不是新消息。 How do I convince SLAB / ETW / out-of-process logger to use the new message? 如何说服SLAB / ETW /进程外记录器使用新消息?

It sounds like TraceEvent is not detecting the update to your message. 听起来TraceEvent没有检测到您的消息的更新。 I would increment the version number of the event: 我会增加事件的版本号:

[Event(1, Message = "New Message: {0}", Version = 1)]
public void Starting(string name)
{
    WriteEvent(1, name);
}

If not specified initial Version value is 0 so 1 is the second version. 如果未指定,则初始版本值为0,因此1是第二个版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM