[CXX-876] Custom logger ins not working Created: 23/Mar/16 Updated: 26/Mar/16 Resolved: 26/Mar/16 |
|
| Status: | Closed |
| Project: | C++ Driver |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Major - P3 |
| Reporter: | Pavel Odintsov | Assignee: | Andrew Morrow (Inactive) |
| Resolution: | Incomplete | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Hello! I'm trying to enabled detailed mongo client logging with my C++ code. I've wrote my custom logger: 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: ; 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. |
| Comments |
| Comment by Andrew Morrow (Inactive) [ 26/Mar/16 ] |
|
Closing this as I've not heard back in a while, but feel free to re-open it if you are still having problems. |
| Comment by Andrew Morrow (Inactive) [ 24/Mar/16 ] |
|
Hi pavel.odintsov - Did the above solutions work out for you? Is there anything more we can help you with in this ticket? Otherwise I would like to close it out. |
| Comment by Andrew Morrow (Inactive) [ 23/Mar/16 ] |
|
Have a look at this test for a good example: |
| Comment by Andrew Morrow (Inactive) [ 23/Mar/16 ] |
|
Perhaps it is working, but the driver hasn't felt the need to log anything. After setting up your custom logger, you could try calling the C driver mongoc_log function directly to force it to log and see if your logger is called. As far as level, we call you back with the level, you decide whether to log at that level or not. There doesn't seem to be a way to tell the C driver to filter internally. |