sgl-project/sglang · error · Exception

Setting SGLANG_LOGGING_CONFIG_PATH from env with {SGLANG_LOG

Error message

Setting SGLANG_LOGGING_CONFIG_PATH from env with {SGLANG_LOGGING_CONFIG_PATH} but it does not exist!

What it means

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.

Source

Thrown at python/sglang/srt/utils/common.py:2328

                resource_type, (target_soft_limit_stack_size, current_hard)
            )
        except ValueError as e:
            logger.warning(f"Fail to set RLIMIT_STACK: {e}")


def rank0_log(msg: str):
    from sglang.srt.distributed import (
        model_parallel_is_initialized,
    )

    if not model_parallel_is_initialized() or get_parallel().tp_rank == 0:
        logger.info(msg)


def configure_logger(server_args, prefix: str = ""):
    if SGLANG_LOGGING_CONFIG_PATH := os.getenv("SGLANG_LOGGING_CONFIG_PATH"):
        if not os.path.exists(SGLANG_LOGGING_CONFIG_PATH):
            raise Exception(
                "Setting SGLANG_LOGGING_CONFIG_PATH from env with "
                f"{SGLANG_LOGGING_CONFIG_PATH} but it does not exist!"
            )
        with open(SGLANG_LOGGING_CONFIG_PATH, encoding="utf-8") as file:
            custom_config = orjson.loads(file.read())
        logging.config.dictConfig(custom_config)
        return
    maybe_ms = ".%(msecs)03d" if envs.SGLANG_LOG_MS.get() else ""
    format = f"[%(asctime)s{maybe_ms}{prefix}] %(message)s"
    logging.basicConfig(
        level=getattr(logging, server_args.log_level.upper()),
        format=format,
        datefmt="%Y-%m-%d %H:%M:%S",
        force=True,
    )

    # Suppress noisy httpx/httpcore loggers in every process that calls
    # configure_logger (main, scheduler, detokenizer). Spawned subprocesses

View on GitHub (pinned to 0132848349)

Solutions

  1. Verify the path exists in the environment the server runs in: ls -l $SGLANG_LOGGING_CONFIG_PATH
  2. Use an absolute path inside the container/image
  3. Unset the variable if custom logging is not intended
  4. Ensure the file is valid JSON as it is parsed with orjson

Example fix

# before
export SGLANG_LOGGING_CONFIG_PATH=/cfg/logging.json  # file not mounted
# after
export SGLANG_LOGGING_CONFIG_PATH=/app/configs/logging.json  # mounted path
Defensive patterns

Strategy: validation

Validate before calling

import os
from pathlib import Path
if (p := os.getenv("SGLANG_LOGGING_CONFIG_PATH")) and not Path(p).is_file():
    raise SystemExit(f"missing logging config: {p}")

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of sgl-project/sglang@0132848349 (2026-08-28). Data as JSON: /api/errors/b12a80578cdf665f. Report an issue: GitHub.