pytest-logger
Plugin configuring handlers for loggers from Python logging module.
Decision gist · record as of 2026-08-14
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.AI-flagged interpretation of the facts on this page — verify before relying
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 · maintenance · safety
MIT (permissive) — MIT license (permissive); you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2024-03-10 (887 days) · last repo commit 2026-04-13 · 35 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 257,462 downloads/mo, #8,446 on PyPI
Alternatives
Verify before relying
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- 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
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 on this page. Verify before relying on it.
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
pytest-logger on PyPI
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 | Not specified |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagepytest |
| Maintenance | Actively maintained 887 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 257,462 / month, #8,446 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableFramework :: PytestIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing |
Evidence: pytest_logger-1.1.1-py2.py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “capture logs in pytest tests”
- pytest-loggerPytest-logger is a pytest plugin that configures Python logging…
- pytest-catchlogA pytest plugin that automatically captures log messages during test…
- pytest-loguruExtends pytest's caplog fixture to capture and assert on logs…
Give your agent the search over MCP, or paste the wish link into any chat.
More Testing packages
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
virtualenv creates isolated Python environments where packages can be installed independently without affecting the system Python or other projects.
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
pytest-asyncio is a pytest plugin that enables writing and running async test functions using the asyncio library, allowing developers to await code directly within test cases.
Install it if you write tests for any asyncio-based code.
A pytest plugin that generates test reports in Common Test Report Format (CTRF) as JSON, compatible with pytest-xdist and pytest-playwright for distributed and browser-based testing.
Install it if you need CTRF-formatted test output for CI/CD integration or cross-tool reporting.
See also logger · pytest-catchlog · pytest-pytestrail · pytest-recording · kgb · pytest-mypy · pylint-pytest · pytest-logging · logfury · logging-tree