diff --git a/apps/authentication/common/log/json_sink.py b/apps/authentication/common/log/json_sink.py index 5c89b31..a798156 100644 --- a/apps/authentication/common/log/json_sink.py +++ b/apps/authentication/common/log/json_sink.py @@ -17,6 +17,10 @@ class JsonSink: self._open_log_file() def _open_log_file(self): + # ensure the parent directory exists + parent_dir = self.log_file_path.parent + if not parent_dir.exists(): + parent_dir.mkdir(parents=True, exist_ok=True) self.log_file = self.log_file_path.open("a", encoding="utf-8") def _should_rotate(self) -> bool: diff --git a/apps/central_storage/common/log/json_sink.py b/apps/central_storage/common/log/json_sink.py index 5c89b31..a798156 100644 --- a/apps/central_storage/common/log/json_sink.py +++ b/apps/central_storage/common/log/json_sink.py @@ -17,6 +17,10 @@ class JsonSink: self._open_log_file() def _open_log_file(self): + # ensure the parent directory exists + parent_dir = self.log_file_path.parent + if not parent_dir.exists(): + parent_dir.mkdir(parents=True, exist_ok=True) self.log_file = self.log_file_path.open("a", encoding="utf-8") def _should_rotate(self) -> bool: diff --git a/apps/content/common/log/json_sink.py b/apps/content/common/log/json_sink.py index 5c89b31..a798156 100644 --- a/apps/content/common/log/json_sink.py +++ b/apps/content/common/log/json_sink.py @@ -17,6 +17,10 @@ class JsonSink: self._open_log_file() def _open_log_file(self): + # ensure the parent directory exists + parent_dir = self.log_file_path.parent + if not parent_dir.exists(): + parent_dir.mkdir(parents=True, exist_ok=True) self.log_file = self.log_file_path.open("a", encoding="utf-8") def _should_rotate(self) -> bool: diff --git a/apps/notification/common/log/json_sink.py b/apps/notification/common/log/json_sink.py index 5c89b31..a798156 100644 --- a/apps/notification/common/log/json_sink.py +++ b/apps/notification/common/log/json_sink.py @@ -17,6 +17,10 @@ class JsonSink: self._open_log_file() def _open_log_file(self): + # ensure the parent directory exists + parent_dir = self.log_file_path.parent + if not parent_dir.exists(): + parent_dir.mkdir(parents=True, exist_ok=True) self.log_file = self.log_file_path.open("a", encoding="utf-8") def _should_rotate(self) -> bool: diff --git a/apps/payment/common/log/json_sink.py b/apps/payment/common/log/json_sink.py index 5c89b31..a798156 100644 --- a/apps/payment/common/log/json_sink.py +++ b/apps/payment/common/log/json_sink.py @@ -17,6 +17,10 @@ class JsonSink: self._open_log_file() def _open_log_file(self): + # ensure the parent directory exists + parent_dir = self.log_file_path.parent + if not parent_dir.exists(): + parent_dir.mkdir(parents=True, exist_ok=True) self.log_file = self.log_file_path.open("a", encoding="utf-8") def _should_rotate(self) -> bool: