Uploaded image for project: 'C++ Driver'
  1. C++ Driver
  2. CXX-876

Custom logger ins not working

    XMLWordPrintableJSON

Details

    • Icon: New Feature New Feature
    • Resolution: Incomplete
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None

    Description

      Hello!

      I'm trying to enabled detailed mongo client logging with my C++ code.

      I've wrote my custom logger:
      ```bash
      class fastnetmon_mongo_logger : public mongocxx::logger {
      public:
      fastnetmon_mongo_logger()

      { extern log4cpp::Category& logger; logger << log4cpp::Priority::INFO << "Custom mongo library logger intialized"; }

      void operator() (mongocxx::log_level level, mongocxx::stdx::string_view domain, mongocxx::stdx::string_view message) noexcept final

      { extern log4cpp::Category& logger; logger << log4cpp::Priority::ERROR << "Log message from Mongodb driver!"; }

      };
      ```

      And specified it for mongo instance:
      ```bash
      mongocxx::instance mongo_instance

      { mongocxx::stdx::make_unique<fastnetmon_mongo_logger>() }

      ;
      ```

      But looks like it's not working because I haven't any log records...

      So also I could not find any way to specify log level logging.

      Attachments

        Activity

          People

            andrew.morrow@mongodb.com Andrew Morrow (Inactive)
            pavel.odintsov Pavel Odintsov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: