[Core][Logging] Add built-in JSON formatter (#58739)
Add `--logging-config.formatter=json` to enable the python-json-logger formatter without having to use a complete Python logging dictConfig. Signed-off-by: Mark McLoughlin <markmc@redhat.com> Co-authored-by: OpenAI Codex <noreply@openai.com>
This commit is contained in:
co-authored by
OpenAI Codex
parent
c4fc3c7d32
commit
91fcec1235
@@ -9,6 +9,7 @@ import vllm.envs as envs
|
||||
from vllm.config.utils import config
|
||||
|
||||
LogLevel = Literal["CRITICAL", "ERROR", "WARNING", "INFO", "DEBUG", "NOTSET"]
|
||||
LogFormatter = Literal["text", "json"]
|
||||
|
||||
|
||||
@config
|
||||
@@ -17,8 +18,8 @@ class LoggingConfig:
|
||||
|
||||
Supply a JSON object with ``--logging-config`` or individual fields with
|
||||
dotted arguments such as ``--logging-config.log_level DEBUG`` and
|
||||
``--logging-config.pylogging_config_file logging.json``. ``--log-level``
|
||||
and legacy ``--log-config-file`` override their matching fields. Set
|
||||
``--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``.
|
||||
"""
|
||||
|
||||
@@ -27,6 +28,9 @@ class LoggingConfig:
|
||||
)
|
||||
"""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.
|
||||
|
||||
@@ -41,6 +45,6 @@ class LoggingConfig:
|
||||
"""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`` for logger,
|
||||
handler, and formatter settings.
|
||||
A custom ``dictConfig`` is authoritative over ``log_level`` and
|
||||
``formatter`` for logger, handler, and formatter settings.
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user