{"record":{"id":"e3e5a90fa29a5a90","repo":"hiyouga/LlamaFactory","slug":"unknown-logging-level-env-level-str","errorCode":null,"errorMessage":"Unknown logging level: {env_level_str}.","messagePattern":"Unknown logging level: (.+?)\\.","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"src/llamafactory/extras/logging.py","lineNumber":88,"sourceCode":"\n    def info_rank0(self, *args, **kwargs) -> None:\n        self.info(*args, **kwargs)\n\n    def warning_rank0(self, *args, **kwargs) -> None:\n        self.warning(*args, **kwargs)\n\n    def warning_rank0_once(self, *args, **kwargs) -> None:\n        self.warning(*args, **kwargs)\n\n\ndef _get_default_logging_level() -> \"logging._Level\":\n    r\"\"\"Return the default logging level.\"\"\"\n    env_level_str = os.getenv(\"LLAMAFACTORY_VERBOSITY\", None)\n    if env_level_str:\n        if env_level_str.upper() in logging._nameToLevel:\n            return logging._nameToLevel[env_level_str.upper()]\n        else:\n            raise ValueError(f\"Unknown logging level: {env_level_str}.\")\n\n    return _default_log_level\n\n\ndef _get_library_name() -> str:\n    return __name__.split(\".\")[0]\n\n\ndef _get_library_root_logger() -> \"_Logger\":\n    return logging.getLogger(_get_library_name())\n\n\ndef _configure_library_root_logger() -> None:\n    r\"\"\"Configure root logger using a stdout stream handler with an explicit format.\"\"\"\n    global _default_handler\n\n    with _thread_lock:\n        if _default_handler:  # already configured","sourceCodeStart":70,"sourceCodeEnd":106,"githubUrl":"https://github.com/hiyouga/LlamaFactory/blob/f28afaf6355af515454dfb16c97d728307c93897/src/llamafactory/extras/logging.py#L70-L106","documentation":"LlamaFactory reads the LLAMAFACTORY_VERBOSITY environment variable to set its log level. The value (case-insensitive) must be a standard Python logging level name such as DEBUG, INFO, WARNING, ERROR, or CRITICAL; anything else raises ValueError at logger initialization, before any training output appears.","triggerScenarios":"Exporting LLAMAFACTORY_VERBOSITY=verbose / =10 / =Info. (trailing punctuation) in the shell, Dockerfile, or .env; CI pipelines injecting lowercase-with-typos values; values like 'warn' that Python accepts via logging.getLevelName but not via the _nameToLevel name map used here ('WARN' actually works uppercased; 'warn' lowercased also works via .upper(), but 'verbose' does not).","commonSituations":"Copying verbosity settings from other frameworks (transformers uses TRANSFORMERS_VERBOSITY with different accepted values); Docker/k8s env misconfiguration; values like 'TRACE' or 'ALL' that Python logging does not define.","solutions":["Unset or fix the variable: export LLAMAFACTORY_VERBOSITY=INFO (or DEBUG/WARNING/ERROR/CRITICAL).","Check shell profile, Dockerfile ENV, docker-compose, and CI env blocks for the misspelled value.","Use exact Python logging level names only — numeric levels are not accepted by this code path."],"exampleFix":"# before\nENV LLAMAFACTORY_VERBOSITY=verbose\n\n# after\nENV LLAMAFACTORY_VERBOSITY=DEBUG","handlingStrategy":"validation","validationCode":"import logging, os\n\nlevel = os.getenv(\"LLAMAFACTORY_VERBOSITY\")\nif level is not None:\n    assert level.upper() in logging._nameToLevel, f\"bad LLAMAFACTORY_VERBOSITY: {level}\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only DEBUG/INFO/WARNING/ERROR/CRITICAL for LLAMAFACTORY_VERBOSITY.","Audit Dockerfile ENV and CI variables for copy-pasted verbosity values from other frameworks."],"tags":["logging","environment","config"],"backgroundTag":null,"analyzedSha":"f28afaf6355af515454dfb16c97d728307c93897","analyzedAt":"2026-08-14T21:57:28.298Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}