issue #565 - Logfile is overwritten when parsedmarc (re)starts (#569)

Do not re-write the log file if already exists. Add a log handler in "append" mode (that should be an implicit value but it's defined explicitly for the visibility).
This commit is contained in:
Alexej Sidorenko
2024-10-10 21:27:15 +02:00
committed by GitHub
parent 8444053476
commit 92b12eaacf

View File

@@ -1179,9 +1179,7 @@ def _main():
logger.setLevel(logging.DEBUG)
if opts.log_file:
try:
log_file = open(opts.log_file, "w")
log_file.close()
fh = logging.FileHandler(opts.log_file)
fh = logging.FileHandler(opts.log_file, "a")
formatter = logging.Formatter(
"%(asctime)s - "
"%(levelname)s - [%(filename)s:%(lineno)d] - %(message)s"