# AssertionError: assert 'expected log' in []

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

## Root Cause

caplog captures via logging's root logger by default; if the code under test uses a custom logger with propagate=False or a different handler, caplog sees nothing.

## Version Compatibility

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

## Workarounds

1. **** (90% success)
   ```
   def test_logs(caplog):
    logger = logging.getLogger('myapp.worker')
    logger.propagate = True
    with caplog.at_level(logging.INFO):
        run_worker()
    assert 'expected log' in caplog.text
   ```
2. **** (85% success)
   ```
   def test_logs(caplog):
    logger = logging.getLogger('myapp.worker')
    logger.addHandler(caplog.handler)
    run_worker()
    assert 'expected log' in caplog.text
   ```

## Dead Ends

- **** — Sets the level but does not fix propagation; if propagate=False, records still never reach caplog's handler. (85% fail)
- **** — Adds a root handler but caplog replaces handlers per test; custom loggers with propagate=False still bypass. (80% fail)
- **** — capsys captures stdout/stderr; logging output may not be written there depending on handler configuration. (90% fail)
