Skip to content

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

@contramundum53

Description

@contramundum53

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:

  • Propagate logs to the root logger, so that the library users can set the handlers themselves
  • Define a custom log format on successful trials and remove the dependency on _study._log_completed_trial

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions