Skip to content

Commit 9479679

Browse files
authored
create empty thread errors log (#2524)
1 parent 3474009 commit 9479679

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

packages/helpermodules/logger.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,10 @@ def mb_to_bytes(megabytes: int) -> int:
177177
logging.getLogger("uModbus").setLevel(logging.WARNING)
178178
logging.getLogger("websockets").setLevel(logging.WARNING)
179179

180+
thread_errors_path = Path(Path(__file__).resolve().parents[2]/"ramdisk"/"thread_errors.log")
181+
with thread_errors_path.open("w") as f:
182+
f.write("")
183+
180184
def threading_excepthook(args):
181185
with open(RAMDISK_PATH+"thread_errors.log", "a") as f:
182186
f.write("Uncaught exception in thread:\n")

packages/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@ def handler5Min(self):
146146
def handler_midnight(self):
147147
try:
148148
save_log(LogType.MONTHLY)
149-
Path(Path(__file__).resolve().parents[1]/"ramdisk"/"thread_errors.log").unlink(missing_ok=True)
149+
thread_errors_path = Path(Path(__file__).resolve().parents[1]/"ramdisk"/"thread_errors.log")
150+
with thread_errors_path.open("w") as f:
151+
f.write("")
150152
except KeyboardInterrupt:
151153
log.critical("Ausführung durch exit_after gestoppt: "+traceback.format_exc())
152154
except Exception:

0 commit comments

Comments
 (0)