[CDRIVER-3710] Log monitoring errors with warning/error levels instead of debug Created: 07/Jun/20  Updated: 10/Feb/23

Status: Backlog
Project: C Driver
Component/s: tests
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Kevin Albertson Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Epic Link: CDRIVER-4576

 Description   

Network and command errors encountered in multi-threaded monitoring are logged as debug errors (with level MONGOC_LOG_LEVEL_DEBUG). They should be logged as MONGOC_LOG_LEVEL_ERROR and MONGOC_LOG_LEVEL_WARNING.

They were left as debug logs in CDRIVER-3535. This was because error/warning logs are printed to stderr. The test script compile-unix.sh asserts that tests nothing is printed to stderr. But many tests simulate monitoring errors with the mock server. See this conversation in the PR for more context. https://github.com/mongodb/mongo-c-driver/pull/625/files/65977607f7e1d500dfa4123711452c435ab08d3c#r435400372

We may need to add calls to capture_logs() in all tests where we expect monitoring errors to occur, so they do not get printed to stderr.

Also consider:

  1. Errors encountered in single-threaded monitoring are not logged. If these are generally useful, it follows we should add similar logs for single-threaded monitoring in mongoc-async.c.
  2. have test-libmongoc make assertions that unexpected error logs are not encountered. This way, it will be easier to test these assertions locally, and on any platform.

Generated at Wed Feb 07 21:18:49 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.