ray.LoggingConfig#

class ray.LoggingConfig(encoding: str = 'TEXT', log_level: str = 'INFO')[source]#

Logging configuration for a Ray job. These configurations are used to set up the root logger of the driver process and all Ray tasks and actor processes that belong to the job.

Examples

import ray
import logging

ray.init(
    logging_config=ray.LoggingConfig(encoding="TEXT", log_level="INFO")
)

@ray.remote
def f():
    logger = logging.getLogger(__name__)
    logger.info("This is a Ray task")

ray.get(f.remote())
2024-06-03 07:53:50,815 INFO test.py:11 -- This is a Ray task job_id=01000000 worker_id=0dbbbd0f17d5343bbeee8228fa5ff675fe442445a1bc06ec899120a8 node_id=577706f1040ea8ebd76f7cf5a32338d79fe442e01455b9e7110cddfc task_id=c8ef45ccd0112571ffffffffffffffffffffffff01000000
Parameters:
  • encoding – Encoding type for the logs. The valid values are [‘TEXT’]

  • log_level – Log level for the logs. Defaults to ‘INFO’. You can set it to ‘DEBUG’ to receive more detailed debug logs.

Methods

Attributes

encoding

log_level