Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Data] Move logging configuration to python dictionary from yaml #48093

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 48 additions & 4 deletions python/ray/data/_internal/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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 (
Expand Down
40 changes: 0 additions & 40 deletions python/ray/data/_internal/logging.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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={
Expand Down