-
Notifications
You must be signed in to change notification settings - Fork 7k
[core] Ray Core / Ray Data logging configuration leads to unexpected behavior #48958
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
Changes from all commits
ba782ab
9bcd02a
b4fdbc7
ead2175
8a71e3a
fe8d7d0
e545afd
8f63c01
dc80d12
863ac4c
4307bc0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| def get_dict_config_provider(): | ||
| from ray._private.ray_logging.logging_config import DefaultDictConfigProvider | ||
| def get_logging_configurator(): | ||
| from ray._private.ray_logging.logging_config import DefaultLoggingConfigurator | ||
|
|
||
| return DefaultDictConfigProvider() | ||
| return DefaultLoggingConfigurator() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -207,17 +207,9 @@ def test_record_with_exception(self): | |
| assert s in formatted | ||
|
|
||
|
|
||
| class TestLoggingConfig: | ||
| def test_log_level(self): | ||
| log_level = "DEBUG" | ||
| logging_config = LoggingConfig(log_level=log_level) | ||
| dict_config = logging_config._get_dict_config() | ||
| assert dict_config["handlers"]["console"]["level"] == log_level | ||
| assert dict_config["root"]["level"] == log_level | ||
|
|
||
| def test_invalid_dict_config(self): | ||
| with pytest.raises(ValueError): | ||
| LoggingConfig(encoding="INVALID")._get_dict_config() | ||
| def test_invalid_encoding(): | ||
| with pytest.raises(ValueError): | ||
| LoggingConfig(encoding="INVALID") | ||
|
|
||
|
|
||
| class TestTextModeE2E: | ||
|
|
@@ -477,6 +469,27 @@ def print_message(self): | |
| assert "(MyActor pid=" not in stderr | ||
|
|
||
|
|
||
| def test_configure_both_structured_logging_and_lib_logging(shutdown_only): | ||
| """ | ||
| Configure the `ray.test` logger. Then, configure the `root` and `ray` | ||
| loggers in `ray.init()`. Ensure that the `ray.test` logger is not affected. | ||
| """ | ||
| script = """ | ||
| import ray | ||
| import logging | ||
|
|
||
| old_test_logger = logging.getLogger("ray.test") | ||
| assert old_test_logger.getEffectiveLevel() != logging.DEBUG | ||
| old_test_logger.setLevel(logging.DEBUG) | ||
|
|
||
| ray.init(logging_config=ray.LoggingConfig(encoding="TEXT", log_level="INFO")) | ||
|
|
||
| new_test_logger = logging.getLogger("ray.test") | ||
| assert old_test_logger.getEffectiveLevel() == logging.DEBUG | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. so with dictConfig, log level will also be cleared not just handlers?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, see https://github.com/python/cpython/blob/71ede1142ddad2d31cc966b8fe4a5aff664f4d53/Lib/logging/config.py#L193-L196 for more details. Child logger's level will be set to |
||
| """ | ||
| run_string_as_driver(script) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| if os.environ.get("PARALLEL_CI"): | ||
| sys.exit(pytest.main(["-n", "auto", "--boxed", "-vs", __file__])) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.