optuna / kurobako-py

A Python library to help implement kurobako's solvers and problems
MIT License
9 stars 7 forks source link

Log level of `_optuna_logger` not in sync with Optuna's logger #20

Open contramundum53 opened 2 years ago

contramundum53 commented 2 years ago

In kurobako/solver/optuna.py, _optuna_logger is used for outputting optimization progress. However, although _optuna_logger is created with optuna.logging.getLogger(__name__), the __name__ does not belong in optuna, returning a separate logger from Optuna's logging system. Thus _optuna_logger's log level does not change by optuna.logging._configure_library_root_logger().

This results in invisible logs when the trials are pruned, because no handler is set for _optuna_logger's info level. When a trial succeeds, _study._log_completed_trial is called, which in turn calls logger created inside Optuna, thus the log is outputted. However, this is not a good design either, because _log_completed_trial is a private member and is subject to future change.

We suggest the following changes:

contramundum53 commented 2 years ago

19 has some discussion about this.