--- id: pytest-logger version: "1.1.1" license: MIT license_treatment: permissive maintenance: active --- # pytest-logger — Plugin configuring handlers for loggers from Python logging module. License: permissive · Maintenance: active · Downloads: 257.5K/mo ## What it is and what it does Pytest-logger extends pytest with structured logging capture for individual named loggers. Instead of pytest's built-in log capture, it lets you configure which loggers to monitor, at what level, and routes their output to both stdout (during test runs) and to separate files organized by test and logger name in a session directory. You set it up via pytest hooks in conftest.py, naming the loggers you care about and their default output levels, then control which loggers appear during a test run using command-line options like `--log foo,bar.debug`. The plugin is useful when your code or test fixtures use Python's standard logging module and you want fine-grained control over which log streams appear in test output and where they're stored. It organizes logs by test and logger name on disk, making it easy to review detailed logs for specific tests without cluttering the main test output. Use it for: - Debugging test failures by reviewing per-logger log files organized by test name and logger - Selectively enabling verbose logging for specific loggers during test runs via command-line flags - Capturing logs from library code and fixtures without polluting the main pytest output stream - Archiving test logs on a per-logger basis for post-test analysis and troubleshooting ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Pytest-logger is a pytest plugin that configures Python logging handlers to capture and display logs from named loggers during test execution, routing output to both the terminal and per-logger files. Yes. It has low install friction (pytest-only dependency), active maintenance, permissive MIT license, no known vulnerabilities, and solves a real problem for teams using Python logging in tests. Install it if you need structured per-logger log capture and file organization during pytest runs. ## Install pip install pytest-logger uv add pytest-logger poetry add pytest-logger ## Installing pytest-logger Before you install: Low install friction; depends only on pytest. Actively maintained with a recent commit (2026-04-13) and marked Production/Stable, supporting Python 3.7 through 3.12 and PyPy. License in practice: MIT license (permissive); you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions. Quickstart: pip install pytest-logger # In conftest.py: def pytest_logger_config(logger_config): logger_config.add_loggers(['foo'], stdout_level='info') # In test_example.py: import logging foo = logging.getLogger('foo') def test_something(): foo.info('test message') # Run: pytest -s test_example.py Verify before relying: - Whether the plugin works with pytest versions older than those listed in classifiers - Performance impact when capturing logs from many loggers across large test suites ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 257.5K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags pytest logging plugin, capture logs in pytest tests, pytest logger configuration, test logging output, pytest log files by logger, logging, pytest-plugin, test-debugging [View on SkillFed](https://skillfed.io/packages/pytest-logger) · [View on PyPI](https://pypi.org/project/pytest-logger/)