1. Severity of the issue: (select one)
Medium: Significantly affects my productivity but can find a workaround.
2. Environment:
- Ray version: 2.58.0
- Python version: 3.13.15
- OS: Arch Linux
3. What happened vs. what you expected:
- Expected: To be able to disable the
(foo pid=123)-style prefixing to log messages. - Actual: I can’t seem to achieve this despite following Ray’s docs and Python’s
loggingmodule
Hi there, we have a fairly customized logging environment in our app, into which we are trying to integrate Ray. We format all of our messages as logfmt , but Ray insists on prepending every log message with process information like (foo pid=81717). I’d like to disable this completely. However, all my experiments have failed so far. I’m attempting things like this:
def configure_ray_logging() -> None:
ray_logger = logging.getLogger("ray")
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)
formatter = logging.Formatter("%(message)s")
ch.setFormatter(formatter)
ray_logger.addHandler(ch)
if __name__ == "__main__":
ray.init(runtime_env={"worker_process_setup_hook": configure_ray_logging})
# etc.
But this has no effect. The Ray workers still prepend the process info, which conflicts with logfmt. It prints a message like this:
(foo pid=81717) ts=2026-09-25T10:52:47.003 level=INFO msg=\"Got: 0\" run_id=TDIO9HpDwzAaBULy-FAYi exec_name=default_worker parent_run_id=6o1AtAS3jur-qnmC3di9z
How can I fix this? Thank you.