def METHOD_NAME(self):
    """Test to log messages to a file."""
    # Was test-26.1, via test_logger_type.py
    fname = "test_log_messages_to_file_pre_exist_dir"
    assert (
        self.config.logger_type == "devlog"
    ), f"Unexpected logger type encountered, '{self.config.logger_type}', expected 'file'"
    self.config.logger_type = "file"
    with tempfile.TemporaryDirectory(
        suffix=".d", prefix="pbench-common-unit-tests."
    ) as TMP:
        assert Path(TMP).exists()
        self.config.log_dir = str(Path(TMP) / "log-dir")
        assert not Path(
            self.config.log_dir
        ).exists(), (
            f"Test logging directory unexpectedly exists, {self.config.log_dir}"
        )
        Path(self.config.log_dir).mkdir()
        self.logger = get_pbench_logger(fname, self.config)
        assert Path(
            self.config.log_dir
        ).is_dir(), f"Missing logging directory, {self.config.log_dir}"
        assert _handlers[fname] == self.logger.logger.handlers[0]
        assert (
            _handlers[fname].__class__.__name__ == "FileHandler"
        ), f"Unexpected handler set, {_handlers[fname].__class__.__name__!r}"