VSCode, and pytest version 7.4.3
Consider pyproject.toml like below, with live logs enabled
[tool.pytest.ini_options]
log_cli = "true"
log_level = "WARNING"
log_cli_format = "%(asctime)s %(levelname)s %(message)s"
addopts = "-ra -q"
testpaths = [
"tests",
]
and a test like this one
def test_import_decl(caplog):
caplog.set_level(logging.DEBUG, logger="runtime.python.dynamic_parser")
# caplog.set_level(logging.DEBUG)
...
My problem: neither of the caplog.set_level(..) calls, changes what gets logged. It does not print the debug log messages. I must change pytest config in pyproject.toml (log_level = "DEBUG"). However, if I do this, I get an overwhelming amount of debug messages from all modules/packages. But I want the debug message only for specific loggers.
Any ideas how to achieve this?