From d1a2786c6e1df1b5927b7c1920cb30f04f5c995d Mon Sep 17 00:00:00 2001 From: Marc Cataford Date: Sat, 6 Jul 2024 16:37:10 -0400 Subject: [PATCH] fix: configure logging for file-writing --- backup-podman-volumes.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backup-podman-volumes.py b/backup-podman-volumes.py index 787118a..e0eb012 100644 --- a/backup-podman-volumes.py +++ b/backup-podman-volumes.py @@ -18,7 +18,10 @@ import pydantic import boto3 logger = logging.getLogger(__file__) -logging.basicConfig(level=logging.INFO) +logging.basicConfig( + filename="/var/log/backup-volumes.log", encoding="utf-8", level=logging.INFO +) + class Config(pydantic.BaseModel): # List of volumes to back up. @@ -62,6 +65,7 @@ if __name__ == "__main__": config_path = sys.argv[1] if not pathlib.Path(config_path).exists(): + logger.error("Did not find configuration file at %s.", config_path) raise RuntimeError(f"Did not find configuration at {config_path}") config = Config.parse_file(config_path)