Adding new method to ServiceEventSource disables logging (Service Fabric service)

152 Views Asked by At

I am trying to add new method to ServiceEventSource class in a Service Fabric service (web app, web api or stateless services), to log warnings and exceptions separately from information-type messages.

When I add new method to ServiceEventSource class, it does not output any message and this.IsEnabled() returns false. Out of the box, and if I remove newly added method, ServiceEventSource outputs messages as expected, and this.IsEnabled() returns true.

I am following Using EventSource generically sample. For example, just adding following code will cause ServiceEventSource to stop logging:

    private const int ErrorEventId = 7;
    [Event(ErrorEventId, Level = EventLevel.Error, Message = "Error: {0} - {1}")]
    public void Error(string error, string msg)
    {
        WriteEvent(ErrorEventId, error, msg);
    }

I've looked everywhere and can't find any reference to this unexpected behaviour.

0

There are 0 best solutions below