timreibe / vaccipy

Automatisierte Impfterminbuchung für www.impfterminservice.de
MIT License
516 stars 115 forks source link

Writing to log file does not work when running multiple vaccipy instances #484

Open Spenhouet opened 3 years ago

Spenhouet commented 3 years ago

The logging for vaccipy does currently not create a config specific log file. If you run multiple vaccipy instances (e.g. for the different groups) it fails when trying to write to the log file:

--- Logging error --- Traceback (most recent call last): File "C:\Users\XXXX\AppData\Local\Programs\Python\Python37\lib\logging\handlers.py", line 70, in emit self.doRollover() File "C:\Users\XXXX\AppData\Local\Programs\Python\Python37\lib\logging\handlers.py", line 394, in doRollover self.rotate(self.baseFilename, dfn) File "C:\Users\XXXX\AppData\Local\Programs\Python\Python37\lib\logging\handlers.py", line 111, in rotate os.rename(source, dest) PermissionError: [WinError 32] Der Prozess kann nicht auf die Datei zugreifen, da sie von einem anderen Prozess verwendet wird: 'C:\Users\XXXX\Documents\vaccipy\tools\log\impfterminservice.log' -> 'C:\Users\XXXX\Documents\vaccipy\tools\log\impfterminservice.log.2021-06-15'

It would be good if the config file name would be included as prefix or postfix in the log name or if a prefix or postfix is configurable in the config file. Then every instance started with a different config file can write to an individual log file.

More complicated but probably even better would be a log file per PLZ.

batcats commented 3 years ago

Denn kann ich bestätigen 🙂

PLZ könnte zu aufwendig werden. Ich persönlich wäre schon mit einem nicht kollidierenden LogFile-Namen zufrieden (z.B. die Prozess-Id oder Startzeit(+Microtime) an den Namen hängen).