StackExchange.Redis icon indicating copy to clipboard operation
StackExchange.Redis copied to clipboard

Proposal: Enable a default connection logger

Open philon-msft opened this issue 3 years ago • 0 comments

Currently ConnectionMultiplexer supports outputting logs from connect/reconnect operations. This is helpful for debugging connections issues, but it's difficult to discover and use this capability. Users need to create a TextWriter instance and pass it in to the .Connect() call. Can we make it easier, by turning on logging by default and exposing log output via a string property on ConnectionMultiplexer?

Design details:

  • Control the default connection logger via new ConfigurationOptions field, enabled by default.
  • ConnectionMultiplexer would instantiate its own TextWriter internally and write to it.
  • With automatic reconnections the log could grow unbounded, so it should be a rolling log that retains only one or two most recent connections.
  • If the user passes in a TextWriter via the existing .Connect() parameter, we should continue writing to that as we currently do, in addition to writing to the internal log.
  • Documentation will also need to be updated to cover the simpler experience using the new default logger.

philon-msft avatar Jul 20 '21 04:07 philon-msft