{
  "id": "python/pytest-capture-logging-level-error",
  "signature": "LoggingError: Captured log does not contain expected level 'ERROR'",
  "signature_zh": "日志错误：捕获的日志不包含预期的级别 'ERROR'",
  "regex": "LoggingError:\\ Captured\\ log\\ does\\ not\\ contain\\ expected\\ level\\ 'ERROR'",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "在测试中期望捕获特定级别的日志，但实际日志级别配置不正确或日志未触发。",
  "root_cause_type": "generic",
  "root_cause_zh": "在测试中期望捕获特定级别的日志，但实际日志级别配置不正确或日志未触发。",
  "versions": [
    {
      "version": "7.4.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "可能覆盖了全局配置，且如果日志来自其他模块，设置可能无效。",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "日志是同步的，等待不会解决问题，且降低测试速度。",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "在测试中使用 `caplog.set_level(logging.ERROR)` 并确保被测代码触发 ERROR 日志。",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "确保被测代码在特定条件下确实记录 ERROR 级别日志，例如通过 mock 或真实调用。",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-02",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}