# LogCaptureWarning: No logger named 'myapp' found in caplog

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

## Root Cause

The caplog fixture is used to capture log messages, but the specified logger name does not exist or has not been configured, so no log records are captured.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 7.0.0 | active | — | — |
| 8.0.0 | active | — | — |

## Workarounds

1. **Verify the logger name used in the code under test and match it in caplog** (90% success)
   ```
   In the test:
import logging
logger = logging.getLogger('myapp')
logger.info('test message')
with caplog.at_level(logging.INFO, logger='myapp'):
    # run code
    assert 'test message' in caplog.text
   ```
2. **Use caplog.set_level() to enable capturing for all loggers** (85% success)
   ```
   caplog.set_level(logging.DEBUG)
# Now all log messages are captured
assert 'expected message' in caplog.text
   ```

## Dead Ends

- **Using caplog.clear() before capturing logs** — This clears existing logs but does not fix the logger name issue. (50% fail)
- **Setting the log level to DEBUG globally** — This may generate more logs but does not ensure the correct logger is captured. (40% fail)
