# AssertionError: assert 'expected message' in []

- **ID:** `python/pytest-caplog-empty`
- **Domain:** python
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

caplog captured no records because logger propagation was disabled, the logger level filtered the message, or the logging call happened before caplog was installed (e.g., at import time).

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.x | active | — | — |
| 8.x | active | — | — |

## Workarounds

1. **** (95% success)
   ```
   def test_logs(caplog):
    import logging
    caplog.set_level(logging.INFO, logger="app")
    do_work()
    assert "expected message" in caplog.text
   ```
2. **** (93% success)
   ```
   def test_logs(caplog):
    with caplog.at_level(logging.DEBUG, logger="app"):
        do_work()
    assert "expected message" in caplog.text
   ```
3. **** (88% success)
   ```
   logger = logging.getLogger("app")
logger.propagate = True  # do not disable in tests
   ```

## Dead Ends

- **** — Level must be set before the log call to capture it. (90% fail)
- **** — Defeats the purpose of testing logs and doesn't fix capture. (80% fail)
- **** — clear() empties the buffer; it doesn't populate it. (95% fail)
