Skip to content

Commit

Permalink
issue #565 - Logfile is overwritten when parsedmarc (re)starts
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 7, 2024
1 parent 8444053 commit da039a8
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 da039a8

Please sign in to comment.