Uploaded image for project: 'Ruby Driver'
  1. Ruby Driver
  2. RUBY-916

Don't use a single global logger

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.1.0
    • Affects Version/s: 2.0.4
    • Component/s: Private API
    • Labels:
      None
    • Environment:
      JRuby 1.7.19, Fedora 20

      Right now, the Ruby 2.x driver provides Mongo::Logger.logger, which is the single point of logging for the entire driver, even across multiple connections (and more to the point, multiple threads!)

      This may potentially result in log interleaving when run across multiple threads (depending on the logger used), and it prevents individual connections from being able to opt out of logging, or to log at a different level from other connections.

      A simple fix would be to allow `Mongo::Client#new` to accept a `logger` option which `Loggable` would pass to `Logger`, which would use it as an override log device. That way, individual connections could use their own loggers as desired, while maintaining the single global logger usage pattern.

      As a side note, the on-by-default STDOUT log with regular ismaster pings when connected to a replica set makes using the client in an irb console rather frustrating.

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            cheald Chris Heald
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: