Skip to content

Commit 8e2b6e1

Browse files
committed
Lower the root logger's log level to --log-level instead of to NOTSET
Fixes pytest-dev#2977
1 parent 476d4df commit 8e2b6e1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

_pytest/logging.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,8 @@ def __init__(self, config):
242242
The formatter can be safely shared across all handlers so
243243
create a single one for the entire test session here.
244244
"""
245+
self.log_level = get_actual_log_level(
246+
config, 'log_level') or logging.WARNING
245247
self.log_cli_level = get_actual_log_level(
246248
config, 'log_cli_level', 'log_level') or logging.WARNING
247249

@@ -287,7 +289,8 @@ def __init__(self, config):
287289
def _runtest_for(self, item, when):
288290
"""Implements the internals of pytest_runtest_xxx() hook."""
289291
with catching_logs(LogCaptureHandler(),
290-
formatter=self.formatter) as log_handler:
292+
formatter=self.formatter,
293+
level=self.log_level) as log_handler:
291294
item.catch_log_handler = log_handler
292295
try:
293296
yield # run test

0 commit comments

Comments
 (0)