Skip to content

Commit 1538fdd

Browse files
committed
Simplify
1 parent 25a4a1d commit 1538fdd

File tree

4 files changed

+5
-10
lines changed

4 files changed

+5
-10
lines changed

.evergreen/scripts/run_tests.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from __future__ import annotations
22

33
import json
4+
import logging
45
import os
56
import platform
67
import shutil
@@ -172,6 +173,9 @@ def run() -> None:
172173
handle_aws_lambda()
173174
return
174175

176+
if os.environ.get("DEBUG_LOG"):
177+
TEST_ARGS.extend(f"-o log_cli_level={logging.DEBUG}".split())
178+
175179
# Run local tests.
176180
ret = pytest.main(TEST_ARGS + sys.argv[1:])
177181
if ret != 0:

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ If you are running one of the `no-responder` tests, omit the `run-server` step.
352352
## Enable Debug Logs
353353

354354
- Use `-o log_cli_level="DEBUG" -o log_cli=1` with `just test` or `pytest` to output all debug logs to the terminal. **Warning**: This will output a huge amount of logs.
355-
- Add `log_cli_level = "DEBUG` to the `tool.pytest.ini_options` section in `pyproject.toml` to enable debug logs in this manner by default on your machine.
355+
- Add `log_cli=1` and `log_cli_level="DEBUG"` to the `tool.pytest.ini_options` section in `pyproject.toml` to enable debug logs in this manner by default on your machine.
356356
- Set `DEBUG_LOG=1` and run `just setup-tests`, `just-test`, or `pytest` to enable debug logs only for failed tests.
357357
- Finally, you can use `just setup-tests --debug-log`.
358358
- For evergreen patch builds, you can use `evergreen patch --param DEBUG_LOG=1` to enable debug logs for failed tests in the patch.

pymongo/logger.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515

1616
import enum
1717
import logging
18-
import logging.handlers
1918
import os
2019
import warnings
2120
from typing import Any
@@ -96,13 +95,6 @@ class _SDAMStatusMessage(str, enum.Enum):
9695
ConnectionCheckOutFailedReason.TIMEOUT: "Connection exceeded the specified timeout",
9796
}
9897

99-
if os.environ.get("DEBUG_LOG"):
100-
_COMMAND_LOGGER.setLevel(logging.DEBUG)
101-
_SERVER_SELECTION_LOGGER.setLevel(logging.DEBUG)
102-
_CONNECTION_LOGGER.setLevel(logging.DEBUG)
103-
_CLIENT_LOGGER.setLevel(logging.DEBUG)
104-
_SDAM_LOGGER.setLevel(logging.DEBUG)
105-
10698

10799
def _log_client_error() -> None:
108100
# This is called from a daemon thread so check for None to account for interpreter shutdown.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ minversion = "7"
9898
addopts = ["-ra", "--strict-config", "--strict-markers", "--junitxml=xunit-results/TEST-results.xml", "-m default or default_async"]
9999
testpaths = ["test"]
100100
log_cli_level = "INFO"
101-
log_cli = true
102101
faulthandler_timeout = 1500
103102
asyncio_default_fixture_loop_scope = "session"
104103
xfail_strict = true

0 commit comments

Comments
 (0)