# AssertionError: assert 'expected message' in []
  where [] = caplog.messages

- **ID:** `python/pytest-caplog-not-captured`
- **Domain:** python
- **Category:** config_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

The logger used by the code under test has propagate=False, or logging was configured with a handler that bypasses the root logger, so caplog's root handler never receives the record.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   def test_x(caplog):
    logging.getLogger('myapp').propagate = True
    with caplog.at_level(logging.INFO, logger='myapp'):
        run()
    assert 'expected message' in caplog.text
   ```
2. **** (92% success)
   ```
   import logging

def test_x():
    records = []
    h = logging.Handler()
    h.emit = records.append
    log = logging.getLogger('myapp')
    log.addHandler(h)
    try:
        run()
    finally:
        log.removeHandler(h)
    assert any('expected' in r.getMessage() for r in records)
   ```

## Dead Ends

- **** — Level is not the issue if propagate=False; the record never reaches the root logger's handlers regardless of level. (85% fail)
- **** — Both attributes are populated from the same captured records; an empty capture yields empty results in either. (90% fail)
