diff --git a/python/ray/data/_internal/logging.py b/python/ray/data/_internal/logging.py index f62357940ad3..0f6eb6b7fab8 100644 --- a/python/ray/data/_internal/logging.py +++ b/python/ray/data/_internal/logging.py @@ -7,9 +7,53 @@ import ray -DEFAULT_CONFIG_PATH = os.path.abspath( - os.path.join(os.path.dirname(__file__), "logging.yaml") -) +DEFAULT_CONFIG = { + "version": 1, + "disable_existing_loggers": False, + "formatters": { + "ray": { + "format": "%(asctime)s\t%(levelname)s %(filename)s:%(lineno)s -- %(message)s" # noqa: E501 + }, + "ray_json": {"class": "ray._private.ray_logging.formatters.JSONFormatter"}, + }, + "filters": { + "console_filter": {"()": "ray.data._internal.logging.HiddenRecordFilter"}, + "core_context_filter": { + "()": "ray._private.ray_logging.filters.CoreContextFilter" + }, + }, + "handlers": { + "file": { + "class": "ray.data._internal.logging.SessionFileHandler", + "formatter": "ray", + "filename": "ray-data.log", + }, + "file_json": { + "class": "ray.data._internal.logging.SessionFileHandler", + "formatter": "ray_json", + "filename": "ray-data.log", + "filters": ["core_context_filter"], + }, + "console": { + "class": "ray._private.log.PlainRayHandler", + "formatter": "ray", + "level": "INFO", + "filters": ["console_filter"], + }, + }, + "loggers": { + "ray.data": { + "level": "DEBUG", + "handlers": ["file", "console"], + "propagate": False, + }, + "ray.air.util.tensor_extensions": { + "level": "DEBUG", + "handlers": ["file", "console"], + "propagate": False, + }, + }, +} # Dictionary of substitutions to be performed when using JSON mode. Handlers with names # corresponding to keys will be replaced by those corresponding to values. @@ -119,7 +163,7 @@ def _load_logging_config(config_path: str): if config_path is not None: config = _load_logging_config(config_path) else: - config = _load_logging_config(DEFAULT_CONFIG_PATH) + config = DEFAULT_CONFIG if log_encoding is not None and log_encoding.upper() == "JSON": for logger in config["loggers"].values(): for ( diff --git a/python/ray/data/_internal/logging.yaml b/python/ray/data/_internal/logging.yaml deleted file mode 100644 index 170d7c6605d8..000000000000 --- a/python/ray/data/_internal/logging.yaml +++ /dev/null @@ -1,40 +0,0 @@ -version: 1 -disable_existing_loggers: False - -formatters: - ray: - format: "%(asctime)s\t%(levelname)s %(filename)s:%(lineno)s -- %(message)s" - ray_json: - class: ray._private.ray_logging.formatters.JSONFormatter - -filters: - console_filter: - (): ray.data._internal.logging.HiddenRecordFilter - core_context_filter: - (): ray._private.ray_logging.filters.CoreContextFilter - -handlers: - file: - class: ray.data._internal.logging.SessionFileHandler - formatter: ray - filename: ray-data.log - file_json: - class: ray.data._internal.logging.SessionFileHandler - formatter: ray_json - filename: ray-data.log - filters: [core_context_filter] - console: - class: ray._private.log.PlainRayHandler - formatter: ray - level: INFO - filters: [console_filter] - -loggers: - ray.data: - level: DEBUG - handlers: [file, console] - propagate: False - ray.air.util.tensor_extensions: - level: DEBUG - handlers: [file, console] - propagate: False diff --git a/python/setup.py b/python/setup.py index 35cd57a70f20..92b9d5c8adea 100644 --- a/python/setup.py +++ b/python/setup.py @@ -809,7 +809,7 @@ def has_ext_modules(self): ] }, package_data={ - "ray": ["includes/*.pxd", "*.pxd", "data/_internal/logging.yaml"], + "ray": ["includes/*.pxd", "*.pxd"], }, include_package_data=True, exclude_package_data={