Mongocxx - how to configure the log level

How to configure the Log level for the mongocxx?
I have provided custom logger implementation to instance. However, I could not find any way to configure the log level. Looking forward to some help

Hi @Milind_T ,

You should be able to set the log level with log_level enum - mongo-cxx-driver/logger.hpp at master · mongodb/mongo-cxx-driver · GitHub
API Doc - MongoDB C++ Driver: mongocxx::logger Class Reference
Example - mongo-cxx-driver/logging.cpp at master · mongodb/mongo-cxx-driver · GitHub

thanks for reply. Yes, I did follow this.

I could not figure out where to set this enum - log_level

Is there any global or any where we need to set “log_level” ?

I found old issue here:
However, this does not seem to be applicable as mongo::logLevel does not exist

Which Mongo client are you using?
If you want to set log level using database command, you can try db.setLogLevel.
Refer setLogLevel Doc - db.setLogLevel

This question is specific to C++ mongo driver.
Want to enable debug /trace logging for mongo driver (Mongocxx).

I guess, db.setLogLevel is for changing log level for database. I need it to configure log level for Mongo Driver (c++)

Hello @Milind_T
Yes . db.setLogLevel is for configuring log level for database.
What is your purpose of Mongo Driver(c++) ? If database connectivity, and then db.setLogLevel can be useful.

You can try logger.operator() . refer, doc

This does not help. It is just interface method to invoke logging from Mongo driver.
I need something to configure the log level for the mongo c++ driver.