pytest-catchlog
py.test plugin to catch log messages. This is a fork of pytest-capturelog.
What it is and what it does
pytest-catchlog is a pytest plugin that intercepts log messages emitted during test execution and displays them in the test output when tests fail. It provides a caplog fixture that lets you set log levels, format log output, and access captured log records and text within your tests. The plugin was originally a fork of pytest-capturelog and supports both Python 2 and Python 3.
The package integrates logging capture into pytest's standard output capture mechanism, showing logs alongside stdout and stderr in failure reports. You can customize log formatting via command-line options or pytest configuration files, disable log reporting entirely, and programmatically inspect or filter captured records within test code. However, modern pytest versions have absorbed this functionality into the core caplog fixture, making this package largely redundant for current projects.
Use it for:
- Debugging test failures by examining log output that was emitted during the test run.
- Asserting on the content and severity of log messages within test code using caplog.records or caplog.text.
- Customizing log message format and timestamps in pytest output for specific testing workflows.
- Testing legacy code bases that require Python 2.6–3.5 and an older pytest version with explicit log capture.
- Temporarily adjusting log levels within a test using caplog.at_level() context manager.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A pytest plugin that automatically captures log messages during test runs and displays them alongside captured stdout and stderr when tests fail.
No. The package is abandoned (last release 2016, last commit 2018) and modern pytest (since ~5.0) includes native logging capture via the caplog fixture, making this plugin unnecessary and potentially incompatible with current pytest versions. Install pytest's built-in caplog support instead.
Install
pytest-catchlog on PyPI
pip
pip install pytest-catchloguv
uv add pytest-catchlogpoetry
poetry add pytest-catchlogInstalling pytest-catchlog
Before you install
Low install friction with only py and pytest as runtime dependencies. However, the package is abandoned—last commit was 2018-01-27 and no releases since 2016-01-24. Modern pytest versions have integrated logging capture natively, making this plugin largely obsolete.
License in practice
MIT License (permissive) places no significant restrictions on use, modification, or distribution.
Quickstart
pip install pytest-catchlog
# In your test file:
import logging
def test_example(caplog):
caplog.set_level(logging.INFO)
logging.info('test message')
assert 'test message' in caplog.text
This plugin targets older pytest versions and Python 2.6–3.5. Modern pytest (7.0+) has native logging capture; this package may conflict or behave unexpectedly with current pytest releases.
Verify before relying
- Compatibility with pytest versions released after 2018; modern pytest includes native caplog fixture that may supersede this plugin.
- Whether the package works reliably with Python 3.6 and later, given the last release was 2016 and classifiers only list up to 3.5.
Package facts
| License | MIT License (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — py, pytest |
| Maintenance | abandoned — 3,855 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 82,215/month — #14,176 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pytest_catchlog-1.2.2-py2.py3-none-any.whl
Keywords: py.test, pytest, logging
Tags
More Testing packages
Pluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
pytestpytest is a testing framework that lets you…
permissive · top 100 on PyPI
virtualenvvirtualenv creates isolated Python environments…
permissive · top 100 on PyPI
coverageCoverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
pytest-asynciopytest-asyncio is a pytest plugin that enables…
permissive · top 1,000 on PyPI
pytest-json-ctrfA pytest plugin that generates test reports in…
permissive · top 1,000 on PyPI
pytest-loggerPytest-logger is a pytest plugin that…
permissive · top 15,000 on PyPI
pytest-loguruExtends pytest's caplog fixture to capture and…
permissive · top 15,000 on PyPI
pytest_taggingA pytest plugin that lets you tag tests with…
permissive · top 15,000 on PyPI
pytest-progressA pytest plugin that displays real-time test…
permissive · top 15,000 on PyPI
pytest-harvestpytest-harvest captures and stores data…
permissive · top 15,000 on PyPI
pytest-pytestrailA pytest plugin that decorates test functions…
permissive · top 15,000 on PyPI
pytest-cagouleA pytest plugin that identifies which tests…
permissive · top 15,000 on PyPI
pytest-grpcA pytest plugin that provides fixtures to write…
permissive · top 15,000 on PyPI
pytest-orderingA pytest plugin that lets you control the…
permissive · top 5,000 on PyPI
pytest-cacheA pytest plugin that persists test state across…
permissive · top 15,000 on PyPI