diff --git a/tianshou/highlevel/experiment.py b/tianshou/highlevel/experiment.py index 0ef81a3..cbea70e 100644 --- a/tianshou/highlevel/experiment.py +++ b/tianshou/highlevel/experiment.py @@ -108,6 +108,9 @@ class ExperimentConfig: in this directory based on the run's experiment name""" persistence_enabled: bool = True """Whether persistence is enabled, allowing files to be stored""" + log_file_enabled: bool = True + """Whether to write to a log file; has no effect if `persistence_enabled` is False. + Disable this if you have externally configured log file generation.""" policy_persistence_mode: PolicyPersistence.Mode = PolicyPersistence.Mode.POLICY """Controls the way in which the policy is persisted""" @@ -205,7 +208,7 @@ class Experiment(ToStringMixin): with logging.FileLoggerContext( os.path.join(persistence_dir, self.LOG_FILENAME), - enabled=use_persistence, + enabled=use_persistence and self.config.log_file_enabled, ): # log initial information log.info(f"Running experiment (name='{experiment_name}'):\n{self.pprints()}")