[SERVER-35203] Unittests accept --logLevel Created: 24/May/18  Updated: 29/Oct/23  Resolved: 22/Aug/18

Status: Closed
Project: Core Server
Component/s: Testing Infrastructure
Affects Version/s: None
Fix Version/s: 4.1.3

Type: Improvement Priority: Major - P3
Reporter: Kevin Pulo Assignee: Jonathan Abrahams
Resolution: Fixed Votes: 0
Labels: tig-qwin-eligible, tig-unittests
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
depends on SERVER-25788 Accept command line arguments in unit... Closed
Duplicate
is duplicated by SERVER-15558 Enable log level setting for unit tests Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.0
Sprint: TIG 2018-08-27
Participants:
Story Points: 1

 Description   

It might be nice to add an optional --logLevel=<int> parameter to unittest_main, so that when locally debugging unittest failures it's possible to ramp up any debugging log output from the main code that's called by the tests.



 Comments   
Comment by Jonathan Abrahams [ 22/Aug/18 ]

Might be worthwhile to backport to just 4.0

Comment by Githook User [ 22/Aug/18 ]

Author:

{'name': 'Jonathan Abrahams', 'email': 'jonathan@mongodb.com', 'username': 'hptabster'}

Message: SERVER-35203 Add verbose option to unittests
Branch: master
https://github.com/mongodb/mongo/commit/6dd6e4d307c54912f6aaa502a581af9cb9dbf055

Comment by Max Hirschhorn [ 27/May/18 ]

I think we should use --verbose rather than --logLevel to be consistent with the server.

options->addOptionChaining("verbose", "verbose", moe::String, "log more verbose output")
    .setImplicit(moe::Value(std::string("v")));
...
if (params.count("verbose")) {
    std::string verbosity = params["verbose"].as<std::string>();
    if (std::any_of(verbosity.cbegin(), verbosity.cend(), [](char ch) { return ch != 'v'; })) {
        return {ErrorCodes::BadValue,
                "The string for the --verbose option cannot contain characters other than 'v'"};
    }
    logger::globalLogDomain()->setMinimumLoggedSeverity(
        logger::LogSeverity::Debug(verbosity.length()));
}

is what we do in mongobridge already. Something similar could probably be added to unittest_main.cpp.

Generated at Thu Feb 08 04:39:08 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.