skillfed

pytest-catchlog

py.test plugin to catch log messages. This is a fork of pytest-capturelog.

pytest-catchlog v1.2.2 82.2K downloads/30d#14,176 on PyPI80
Permissive license MIT License Abandoned released

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-catchlog

uv

uv add pytest-catchlog

poetry

poetry add pytest-catchlog

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Programming Language :: Python :: 3.2Programming Language :: Python :: 3.3Programming Language :: Python :: 3.4Programming Language :: Python :: 3.5Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Software Development :: Testing

Tags

pytest log capture plugincapture logging in pytestpytest test log outputpytest logging fixturedebug logs in pytest testspytest caplog alternative
legacypytest-plugin

More Testing packages