Search code examples
c#loggingslabsemantic-logging

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. 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?


Solution

  • It sounds like TraceEvent is not detecting the update to your message. 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.