@tduncan / Nvidia-Optimization-Stack-VLLM Mirror · read-only / commits / b5407869c8
Fork 0

A high-throughput and memory-efficient inference and serving engine for LLMs

Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git

Synced Nov 12, 02:15 UTC

[Bugfix] Respect VLLM_CONFIGURE_LOGGING value (#28671)

Signed-off-by: Elizabeth Thomas <email2eliza@gmail.com> Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Signed-off-by: Roger Wang <hey@rogerw.io> Signed-off-by: Jane Xu <janeyx@meta.com> Signed-off-by: Nick Hill <nhill@redhat.com> Signed-off-by: Johnny Yang <johnnyyang@google.com> Co-authored-by: Harry Mellor <19981378+hmellor@users.noreply.github.com> Co-authored-by: bruceszchen <bruceszchen@tencent.com> Co-authored-by: Roger Wang <hey@rogerw.io> Co-authored-by: Jane (Yuan) Xu <31798555+janeyx99@users.noreply.github.com> Co-authored-by: Nick Hill <nhill@redhat.com> Co-authored-by: Johnny Yang <24908445+jcyang43@users.noreply.github.com>

Elizabeth Thomas committed Dec 3, 2025 at 16:00 UTC b5407869c8594d8e3c4ee3c09ff7cfe454be0798
3 files changed +59 -2
tests/test_envs.py
+51
@@ -365,3 +365,54 @@ class TestEnvSetWithChoices:
365 with patch.dict(os.environ, {"TEST_ENV": "option1,option1,option2"}):
366 env_func = env_set_with_choices("TEST_ENV", [], ["option1", "option2"])
367 assert env_func() == {"option1", "option2"}
368 +
369 +
370 +class TestVllmConfigureLogging:
371 + """Test cases for VLLM_CONFIGURE_LOGGING environment variable."""
372 +
373 + def test_configure_logging_defaults_to_true(self):
374 + """Test that VLLM_CONFIGURE_LOGGING defaults to True when not set."""
375 + # Ensure the env var is not set
376 + with patch.dict(os.environ, {}, clear=False):
377 + if "VLLM_CONFIGURE_LOGGING" in os.environ:
378 + del os.environ["VLLM_CONFIGURE_LOGGING"]
379 +
380 + # Clear cache if it exists
381 + if hasattr(envs.__getattr__, "cache_clear"):
382 + envs.__getattr__.cache_clear()
383 +
384 + result = envs.VLLM_CONFIGURE_LOGGING
385 + assert result is True
386 + assert isinstance(result, bool)
387 +
388 + def test_configure_logging_with_zero_string(self):
389 + """Test that VLLM_CONFIGURE_LOGGING='0' evaluates to False."""
390 + with patch.dict(os.environ, {"VLLM_CONFIGURE_LOGGING": "0"}):
391 + # Clear cache if it exists
392 + if hasattr(envs.__getattr__, "cache_clear"):
393 + envs.__getattr__.cache_clear()
394 +
395 + result = envs.VLLM_CONFIGURE_LOGGING
396 + assert result is False
397 + assert isinstance(result, bool)
398 +
399 + def test_configure_logging_with_one_string(self):
400 + """Test that VLLM_CONFIGURE_LOGGING='1' evaluates to True."""
401 + with patch.dict(os.environ, {"VLLM_CONFIGURE_LOGGING": "1"}):
402 + # Clear cache if it exists
403 + if hasattr(envs.__getattr__, "cache_clear"):
404 + envs.__getattr__.cache_clear()
405 +
406 + result = envs.VLLM_CONFIGURE_LOGGING
407 + assert result is True
408 + assert isinstance(result, bool)
409 +
410 + def test_configure_logging_with_invalid_value_raises_error(self):
411 + """Test that invalid VLLM_CONFIGURE_LOGGING value raises ValueError."""
412 + with patch.dict(os.environ, {"VLLM_CONFIGURE_LOGGING": "invalid"}):
413 + # Clear cache if it exists
414 + if hasattr(envs.__getattr__, "cache_clear"):
415 + envs.__getattr__.cache_clear()
416 +
417 + with pytest.raises(ValueError, match="invalid literal for int"):
418 + _ = envs.VLLM_CONFIGURE_LOGGING
vllm/envs.py
+4 -2
@@ -37,7 +37,7 @@ if TYPE_CHECKING:
37 VLLM_DISABLE_FLASHINFER_PREFILL: bool = False
38 VLLM_DO_NOT_TRACK: bool = False
39 VLLM_USAGE_SOURCE: str = ""
40 - VLLM_CONFIGURE_LOGGING: int = 1
40 + VLLM_CONFIGURE_LOGGING: bool = True
41 VLLM_LOGGING_LEVEL: str = "INFO"
42 VLLM_LOGGING_PREFIX: str = ""
43 VLLM_LOGGING_STREAM: str = "ext://sys.stdout"
@@ -623,7 +623,9 @@ environment_variables: dict[str, Callable[[], Any]] = {
623 # If set to 0, vllm will not configure logging
624 # If set to 1, vllm will configure logging using the default configuration
625 # or the configuration file specified by VLLM_LOGGING_CONFIG_PATH
626 - "VLLM_CONFIGURE_LOGGING": lambda: int(os.getenv("VLLM_CONFIGURE_LOGGING", "1")),
626 + "VLLM_CONFIGURE_LOGGING": lambda: bool(
627 + int(os.getenv("VLLM_CONFIGURE_LOGGING", "1"))
628 + ),
629 "VLLM_LOGGING_CONFIG_PATH": lambda: os.getenv("VLLM_LOGGING_CONFIG_PATH"),
630 # this is used for configuring the default logging level
631 "VLLM_LOGGING_LEVEL": lambda: os.getenv("VLLM_LOGGING_LEVEL", "INFO").upper(),
vllm/utils/system_utils.py
+4
@@ -204,6 +204,10 @@ def _add_prefix(file: TextIO, worker_name: str, pid: int) -> None:
204
205 def decorate_logs(process_name: str | None = None) -> None:
206 """Decorate stdout/stderr with process name and PID prefix."""
207 + # Respect VLLM_CONFIGURE_LOGGING environment variable
208 + if not envs.VLLM_CONFIGURE_LOGGING:
209 + return
210 +
211 if process_name is None:
212 process_name = get_mp_context().current_process().name
213