diff --git a/homeassistant/bootstrap.py b/homeassistant/bootstrap.py index 24268f4f4e2..95f4c8e3334 100644 --- a/homeassistant/bootstrap.py +++ b/homeassistant/bootstrap.py @@ -635,25 +635,15 @@ async def async_enable_logging( err_log_path = os.path.abspath(log_file) if err_log_path: - err_path_exists = os.path.isfile(err_log_path) - err_dir = os.path.dirname(err_log_path) + err_handler = await hass.async_add_executor_job( + _create_log_file, err_log_path, log_rotate_days + ) - # Check if we can write to the error log if it exists or that - # we can create files in the containing directory if not. - if (err_path_exists and os.access(err_log_path, os.W_OK)) or ( - not err_path_exists and os.access(err_dir, os.W_OK) - ): - err_handler = await hass.async_add_executor_job( - _create_log_file, err_log_path, log_rotate_days - ) + err_handler.setFormatter(logging.Formatter(fmt, datefmt=FORMAT_DATETIME)) + logger.addHandler(err_handler) - err_handler.setFormatter(logging.Formatter(fmt, datefmt=FORMAT_DATETIME)) - logger.addHandler(err_handler) - - # Save the log file location for access by other components. - hass.data[DATA_LOGGING] = err_log_path - else: - _LOGGER.error("Unable to set up error log %s (access denied)", err_log_path) + # Save the log file location for access by other components. + hass.data[DATA_LOGGING] = err_log_path async_activate_log_queue_handler(hass)