-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[Core][Data] Ray Core / Ray Data logging configuration leads to unexpected behavior #48732
Comments
To be clear about the expected behavior some examples / modifications of the repro: 1. Ray Data Import then Ray Core Init [UNEXPECTED BEHAVIOR]Script: print("BEFORE")
report_logger(logging.getLogger("ray.data"))
print()
import ray.data
ray.init(logging_config=ray.LoggingConfig(encoding="JSON", log_level="INFO"))
print("AFTER:")
report_logger(logging.getLogger("ray.data")) Output:
Notes: 2. Ray Core Init then Ray Data Import [EXPECTED BEHAVIOR]Script: print("BEFORE")
report_logger(logging.getLogger("ray.data"))
print()
ray.init(logging_config=ray.LoggingConfig(encoding="JSON", log_level="INFO"))
import ray.data
print("AFTER:")
report_logger(logging.getLogger("ray.data")) Output:
Notes: 3. Only Ray Data Import [EXPECTED BEHAVIOR]Script: print("BEFORE")
report_logger(logging.getLogger("ray.data"))
print()
import ray.data
print("AFTER:")
report_logger(logging.getLogger("ray.data")) Output:
Notes: 4. Only Ray Core Init [EXPECTED BEHAVIOR]Script: print("BEFORE")
report_logger(logging.getLogger("ray.data"))
print()
ray.init(logging_config=ray.LoggingConfig(encoding="JSON", log_level="INFO"))
print("AFTER:")
report_logger(logging.getLogger("ray.data")) Output:
Notes: |
@omatthew98 why don't we just do
|
Update from some more offline discussion with @alexeykudinkin: An alternative to this would be to just wrap this configuration at the ray core level by:
|
I am trying to understand the structured logging behavior as well. One of my question is |
What happened + What you expected to happen
We use
logging.config.dictConfig(config)
to configure the ray data logger (here), but this is also how ray core configures the ray logger (here).For both of these logging configs, we use
disable_existing_loggers: False
. The behavior for this is described as (logging docs):This description makes it seem like these two logging calls are commutative (regardless of ordering they will produce the same result), but that is not exactly how the python logging module works. If we configure the ray module logger then the ray.data module logger, the results are expected and both are configured. If we instead configure the ray.data module then configure the ray module logger, then the ray.data logging configuration is clobbered. This happens because when configuring the parent logger of a module (e.g. ray module logger is the parent logger of the ray.data module logger), the various handlers associated with the child logger are not guaranteed to be preserved.
Our end goal should be a state where the call order of the logging configurations should not affect the logging behavior.
Versions / Dependencies
ray==2.39.0
Reproduction script
Issue Severity
High: It blocks me from completing my task.
The text was updated successfully, but these errors were encountered: