Logging

optuna.logging.get_verbosity()[source]

Return the current level for the Optuna’s root logger.

Returns:Logging level, e.g., optuna.logging.DEBUG and optuna.logging.INFO.

Note

Optuna has following logging levels:

  • optuna.logging.CRITICAL, optuna.logging.FATAL
  • optuna.logging.ERROR
  • optuna.logging.WARNING, optuna.logging.WARN
  • optuna.logging.INFO
  • optuna.logging.DEBUG
optuna.logging.set_verbosity(verbosity)[source]

Set the level for the Optuna’s root logger.

Parameters:verbosity – Logging level, e.g., optuna.logging.DEBUG and optuna.logging.INFO.
optuna.logging.disable_default_handler()[source]

Disable the default handler of the Optuna’s root logger.

Example

Stop and then resume logging to standard output.

>> study = optuna.create_study()
>> optuna.logging.disable_default_handler()
>> study.optimize(objective, n_trials=10)
>> len(study.trials)
10
>> optuna.logging.enable_default_handler()
>> study.optimize(objective, n_trials=10)
[I 2018-11-07 16:11:28,285] Finished a trial resulted in value: 3787.44371584515. ...
optuna.logging.enable_default_handler()[source]

Enable the default handler of the Optuna’s root logger.

Please refer to the example shown in disable_default_handler().