Skip to content

vllm.config.logging

Classes:

  • LoggingConfig –

    vLLM logging. Default dictConfig adds a formatted stream handler.

LoggingConfig

vLLM logging. Default dictConfig adds a formatted stream handler.

Supply a JSON object with --logging-config or individual fields with dotted arguments such as --logging-config.log_level DEBUG and --logging-config.formatter json. --log-level and legacy --log-config-file override their matching fields. Set configure_logging to false to skip applying a dictConfig.

Attributes:

  • configure_logging (bool) –

    Whether to apply a Python logging configuration.

  • formatter (LogFormatter) –

    Formatter used by the built-in logging configuration.

  • log_level (LogLevel) –

    Log level used when no custom logging configuration is provided.

  • pylogging_config_file (str | None) –

    Path to a Python logging JSON file using

Source code in vllm/config/logging.py
@config
class LoggingConfig:
    """vLLM logging. Default ``dictConfig`` adds a formatted stream handler.

    Supply a JSON object with ``--logging-config`` or individual fields with
    dotted arguments such as ``--logging-config.log_level DEBUG`` and
    ``--logging-config.formatter json``. ``--log-level`` and legacy
    ``--log-config-file`` override their matching fields. Set
    ``configure_logging`` to false to skip applying a ``dictConfig``.
    """

    log_level: LogLevel = Field(
        default_factory=lambda: cast(LogLevel, envs.VLLM_LOGGING_LEVEL)
    )
    """Log level used when no custom logging configuration is provided."""

    formatter: LogFormatter = "text"
    """Formatter used by the built-in logging configuration."""

    configure_logging: bool = Field(default_factory=lambda: envs.VLLM_CONFIGURE_LOGGING)
    """Whether to apply a Python logging configuration.

    With no ``pylogging_config_file``, the default config adds a formatted
    stream handler to the ``vllm`` logger. A custom Python logging configuration
    file also requires this to be enabled.
    """

    pylogging_config_file: str | None = Field(
        default_factory=lambda: envs.VLLM_LOGGING_CONFIG_PATH
    )
    """Path to a Python logging JSON file using
    [``dictConfig`` schema](https://docs.python.org/3/library/logging.config.html#configuration-file-format).

    A custom ``dictConfig`` is authoritative over ``log_level`` and
    ``formatter`` for logger, handler, and formatter settings.
    """

configure_logging = Field(default_factory=lambda: envs.VLLM_CONFIGURE_LOGGING) class-attribute instance-attribute

Whether to apply a Python logging configuration.

With no pylogging_config_file, the default config adds a formatted stream handler to the vllm logger. A custom Python logging configuration file also requires this to be enabled.

formatter = 'text' class-attribute instance-attribute

Formatter used by the built-in logging configuration.

log_level = Field(default_factory=lambda: cast(LogLevel, envs.VLLM_LOGGING_LEVEL)) class-attribute instance-attribute

Log level used when no custom logging configuration is provided.

pylogging_config_file = Field(default_factory=lambda: envs.VLLM_LOGGING_CONFIG_PATH) class-attribute instance-attribute

Path to a Python logging JSON file using dictConfig schema.

A custom dictConfig is authoritative over log_level and formatter for logger, handler, and formatter settings.