Disabling ServerDescriptionChanged events being logged in Ruby driver

Hi,

I am using MongoDB with Mongoid (i.e. Ruby driver). The DB is in Atlas. When driver log level is set to debug, a lot of Mongo::Monitoring::Event::ServerDescriptionChanged events are printed to the log.

Is there a way for me to disable only these events? I want to see the queries that are being made but I do not want these topology changed events.

I tried setting monitoring to false, but that disabled the query logging also. The same happens when I set the log level of the driver logger to INFO.

I want to see the queries being made for debugging my application but the server EVENT log lines are just drowning all the wanted log lines.

You can define your own event listeners for command events that would log queries. You could also copy-paste the driver’s listener implementations and adjust their log level. https://docs.mongodb.com/ruby-driver/master/tutorials/ruby-driver-monitoring/#command-monitoring

1 Like