{
  "id": "python/pytest-logging-capture-missing",
  "signature": "LogCaptureWarning: No logger named 'myapp' found in caplog",
  "signature_zh": "日志捕获警告：在caplog中未找到名为'myapp'的日志记录器",
  "regex": "LogCaptureWarning:\\ No\\ logger\\ named\\ 'myapp'\\ found\\ in\\ caplog",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "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.",
  "root_cause_type": "generic",
  "root_cause_zh": "使用caplog fixture捕获日志消息，但指定的日志记录器名称不存在或未配置，因此未捕获到任何日志记录。",
  "versions": [
    {
      "version": "7.0.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": "Using caplog.clear() before capturing logs",
      "why_fails": "This clears existing logs but does not fix the logger name issue.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Setting the log level to DEBUG globally",
      "why_fails": "This may generate more logs but does not ensure the correct logger is captured.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Verify the logger name used in the code under test and match it in caplog",
      "success_rate": 0.9,
      "how": "In the test:\nimport logging\nlogger = logging.getLogger('myapp')\nlogger.info('test message')\nwith caplog.at_level(logging.INFO, logger='myapp'):\n    # run code\n    assert 'test message' in caplog.text",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use caplog.set_level() to enable capturing for all loggers",
      "success_rate": 0.85,
      "how": "caplog.set_level(logging.DEBUG)\n# Now all log messages are captured\nassert 'expected message' in caplog.text",
      "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": "2025-12-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}