# Log message not captured in caplog.records

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

## Root Cause

日志记录器未配置为使用 pytest 的捕获处理器，通常因为日志器名称错误或传播设置问题。

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 3.9 | active | — | — |

## Workarounds

1. **确保日志器名称正确** (90% success)
   ```
   logger = logging.getLogger('my_module')
caplog.set_level(logging.INFO)
logger.info('test')
   ```
2. **配置文件配置** (80% success)
   ```
   在 conftest.py 中配置 logging 插件，确保传播开启
   ```

## Dead Ends

- **在测试内配置 basicConfig** — 尝试在测试中调用 logging.basicConfig，但 pytest 已经配置了处理器 (60% fail)
- **错误地使用 __name__** — 使用 logging.getLogger(__name__) 但测试模块名称与预期不符 (50% fail)
