Skip to content

Commit

Permalink
issue #565 - Logfile is overwritten when parsedmarc (re)starts (#569)
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
fra-iesus authored Oct 10, 2024
1 parent 8444053 commit 92b12ea
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions parsedmarc/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,9 +1179,7 @@ def process_reports(reports_):
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"
Expand Down

0 comments on commit 92b12ea

Please sign in to comment.