Skip to content

Prevent log file from being overwritten, redirect STDOUT even when not run as daemon, log timestamp#15

Closed
amalek215 wants to merge 3 commits intopgaudit:masterfrom
amalek215:logging_fixes
Closed

Prevent log file from being overwritten, redirect STDOUT even when not run as daemon, log timestamp#15
amalek215 wants to merge 3 commits intopgaudit:masterfrom
amalek215:logging_fixes

Conversation

@amalek215
Copy link
Contributor

No description provided.

@dwsteele dwsteele self-requested a review January 12, 2021 17:25
@dwsteele dwsteele self-assigned this Jan 12, 2021
Copy link
Collaborator

@dwsteele dwsteele left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like 3 PRs to me:

  1. Add timestamp to log (looks very committable if applied to all cases)
  2. Don't overwrite log file (also very committable)
  3. Redirect stdout to log (needs discussion)

Please separate #1 and #2 into separate PRs so they can be committed and leave this PR for the STDOUT topic.

open (STDOUT, '>&', $hLog)
or confess "Couldn't close standard output and redirect to logfile: $!";

# Daemonize the process
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why would you like to make this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the issue is when run as a systemd process without the --daemon flag all of the print statements do not make it into the logfile
I will also make this its own PR

@dwsteele
Copy link
Collaborator

Closing since this PR was split into #18, #19, #20.

@dwsteele dwsteele closed this May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants