RedLock.net icon indicating copy to clipboard operation
RedLock.net copied to clipboard

Logging improvements

Open IharYakimush opened this issue 6 years ago • 0 comments

Some times I have following issues: Failed to extend lock, NoQuorum (Acquired: 0, Conflicted: 0, Error: 1)

It is hard to find details about error preventing lock extension because it is logged with "Debug" level. logger.LogDebug($"Error extending lock instance {host}: {ex.Message}");

I would propose to have following improvements in logging:

  1. Create and use EventId for every log message
  2. Pass entire exception to logger
  3. Be able to configure log level for some key events

For instance in my case it might be like

public static class LogEvents
    {
        public static EventId ErrorExtendingLockInstance = new EventId(123, "ErrorExtendingLockInstance");
    }

logger.LogDebug(LogEvents.ErrorExtendingLockInstance, ex, $"Error extending lock instance {host}: {ex.Message}");

Right now can't propose how to make log level for events configurable, but it should be doable.

IharYakimush avatar Apr 23 '19 09:04 IharYakimush