{"record":{"id":"b12a80578cdf665f","repo":"sgl-project/sglang","slug":"setting-sglang-logging-config-path-from-env-with","errorCode":null,"errorMessage":"Setting SGLANG_LOGGING_CONFIG_PATH from env with {SGLANG_LOGGING_CONFIG_PATH} but it does not exist!","messagePattern":"Setting SGLANG_LOGGING_CONFIG_PATH from env with (.+?) but it does not exist!","errorType":"exception","errorClass":"Exception","httpStatus":null,"severity":"error","filePath":"python/sglang/srt/utils/common.py","lineNumber":2328,"sourceCode":"                resource_type, (target_soft_limit_stack_size, current_hard)\n            )\n        except ValueError as e:\n            logger.warning(f\"Fail to set RLIMIT_STACK: {e}\")\n\n\ndef rank0_log(msg: str):\n    from sglang.srt.distributed import (\n        model_parallel_is_initialized,\n    )\n\n    if not model_parallel_is_initialized() or get_parallel().tp_rank == 0:\n        logger.info(msg)\n\n\ndef configure_logger(server_args, prefix: str = \"\"):\n    if SGLANG_LOGGING_CONFIG_PATH := os.getenv(\"SGLANG_LOGGING_CONFIG_PATH\"):\n        if not os.path.exists(SGLANG_LOGGING_CONFIG_PATH):\n            raise Exception(\n                \"Setting SGLANG_LOGGING_CONFIG_PATH from env with \"\n                f\"{SGLANG_LOGGING_CONFIG_PATH} but it does not exist!\"\n            )\n        with open(SGLANG_LOGGING_CONFIG_PATH, encoding=\"utf-8\") as file:\n            custom_config = orjson.loads(file.read())\n        logging.config.dictConfig(custom_config)\n        return\n    maybe_ms = \".%(msecs)03d\" if envs.SGLANG_LOG_MS.get() else \"\"\n    format = f\"[%(asctime)s{maybe_ms}{prefix}] %(message)s\"\n    logging.basicConfig(\n        level=getattr(logging, server_args.log_level.upper()),\n        format=format,\n        datefmt=\"%Y-%m-%d %H:%M:%S\",\n        force=True,\n    )\n\n    # Suppress noisy httpx/httpcore loggers in every process that calls\n    # configure_logger (main, scheduler, detokenizer). Spawned subprocesses","sourceCodeStart":2310,"sourceCodeEnd":2346,"githubUrl":"https://github.com/sgl-project/sglang/blob/0132848349585cfe6aae51c4941cbae872505f8a/python/sglang/srt/utils/common.py#L2310-L2346","documentation":"configure_logger reads SGLANG_LOGGING_CONFIG_PATH from the environment and requires that the file exists before loading the logging dictConfig. A typo'd path or a file not mounted into the container aborts server startup.","triggerScenarios":"Launching the sglang server with SGLANG_LOGGING_CONFIG_PATH set to a nonexistent/mismounted path (typo, wrong container volume, relative path resolved from a different cwd).","commonSituations":"Docker/K8s deployments where the config file is in an image layer but the env var points elsewhere; CI where the var leaks from another job.","solutions":["Verify the path exists in the environment the server runs in: ls -l $SGLANG_LOGGING_CONFIG_PATH","Use an absolute path inside the container/image","Unset the variable if custom logging is not intended","Ensure the file is valid JSON as it is parsed with orjson"],"exampleFix":"# before\nexport SGLANG_LOGGING_CONFIG_PATH=/cfg/logging.json  # file not mounted\n# after\nexport SGLANG_LOGGING_CONFIG_PATH=/app/configs/logging.json  # mounted path","handlingStrategy":"validation","validationCode":"import os\nfrom pathlib import Path\nif (p := os.getenv(\"SGLANG_LOGGING_CONFIG_PATH\")) and not Path(p).is_file():\n    raise SystemExit(f\"missing logging config: {p}\")","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use absolute paths inside containers","Add a config-exists check to deploy scripts/entrypoints","Unset the var when custom logging is not needed"],"tags":["logging","configuration","env-var","startup"],"backgroundTag":"missing-env-var-file","analyzedSha":"0132848349585cfe6aae51c4941cbae872505f8a","analyzedAt":"2026-08-28T05:10:05.995Z","schemaVersion":2},"datasetVersion":"2026-08-28T06:17:29.519Z"}