Skip to content

Commit

Permalink
[Misc] Add an env var VLLM_LOGGING_PREFIX, if set, it will be prepend…
Browse files Browse the repository at this point in the history
… to all logging messages (vllm-project#9590)

Signed-off-by: Sumit Dubey <[email protected]>
  • Loading branch information
sfc-gh-zhwang authored and sumitd2 committed Nov 14, 2024
1 parent ac3d0b3 commit f28b5c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions vllm/envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
VLLM_USAGE_SOURCE: str = ""
VLLM_CONFIGURE_LOGGING: int = 1
VLLM_LOGGING_LEVEL: str = "INFO"
VLLM_LOGGING_PREFIX: str = ""
VLLM_LOGGING_CONFIG_PATH: Optional[str] = None
VLLM_TRACE_FUNCTION: int = 0
VLLM_ATTENTION_BACKEND: Optional[str] = None
Expand Down Expand Up @@ -268,6 +269,10 @@ def get_default_config_root():
"VLLM_LOGGING_LEVEL":
lambda: os.getenv("VLLM_LOGGING_LEVEL", "INFO"),

# if set, VLLM_LOGGING_PREFIX will be prepended to all log messages
"VLLM_LOGGING_PREFIX":
lambda: os.getenv("VLLM_LOGGING_PREFIX", ""),

# Trace function calls
# If set to 1, vllm will trace function calls
# Useful for debugging
Expand Down
4 changes: 3 additions & 1 deletion vllm/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
VLLM_CONFIGURE_LOGGING = envs.VLLM_CONFIGURE_LOGGING
VLLM_LOGGING_CONFIG_PATH = envs.VLLM_LOGGING_CONFIG_PATH
VLLM_LOGGING_LEVEL = envs.VLLM_LOGGING_LEVEL
VLLM_LOGGING_PREFIX = envs.VLLM_LOGGING_PREFIX

_FORMAT = "%(levelname)s %(asctime)s %(filename)s:%(lineno)d] %(message)s"
_FORMAT = (f"{VLLM_LOGGING_PREFIX}%(levelname)s %(asctime)s "
"%(filename)s:%(lineno)d] %(message)s")
_DATE_FORMAT = "%m-%d %H:%M:%S"

DEFAULT_LOGGING_CONFIG = {
Expand Down

0 comments on commit f28b5c3

Please sign in to comment.