Skip to content

[misc] chore: Migrate print statements to logging for better observability#5213

Open
fjosw wants to merge 1 commit intoverl-project:mainfrom
fjosw:logging_migration
Open

[misc] chore: Migrate print statements to logging for better observability#5213
fjosw wants to merge 1 commit intoverl-project:mainfrom
fjosw:logging_migration

Conversation

@fjosw
Copy link
Contributor

@fjosw fjosw commented Feb 5, 2026

What does this PR do?

This PR introduces proper Python logging throughout the verl codebase, replacing ~650+ print statements with structured logging calls. This improves observability, enables log level filtering, and follows Python best practices. This is a surgical change but affects a lot of files.

Key changes:

  • Replace print statements with logger.info(), logger.debug(), logger.warning(), logger.error() calls
  • Standardize logger initialization to use logging.getLogger(name) instead of file
  • Use appropriate log levels: INFO for lifecycle/progress/timing, DEBUG for verbose data, WARNING for recoverable issues, ERROR for failures

Test

This is a refactoring change that doesn't alter runtime behavior. The logging output can be controlled via the standard Python logging configuration or environment variables like VERL_LOGGING_LEVEL.

API and Usage Example

Control log verbosity via environment variable
export VERL_LOGGING_LEVEL=DEBUG # Show all logs
export VERL_LOGGING_LEVEL=INFO # Show info and above (default for most use cases)
export VERL_LOGGING_LEVEL=WARNING # Quieter output

Or configure programmatically

import logging
logging.getLogger("verl").setLevel(logging.DEBUG)

Checklist Before Submitting

Important

Please check all the following items before requesting a review, otherwise the reviewer might deprioritize this PR for review.

@CLAassistant
Copy link

CLAassistant commented Feb 5, 2026

CLA assistant check
All committers have signed the CLA.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request is a large-scale refactoring that migrates over 650 print statements to structured logging using Python's logging module. The changes include standardizing logger initialization to use logging.getLogger(__name__), replacing print calls with appropriate logger methods (.info, .debug, .warning, .error), and changing the default logging level from WARN to INFO for better observability. I have reviewed the changes across the numerous affected files and found them to be consistent, well-executed, and a significant improvement to the codebase's maintainability and debuggability. The code now follows standard Python logging best practices. I did not find any high or critical issues with this refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants