Closed adonboli closed 2 years ago
@adonboli I actually had created a fork a while back that did this. I've since moved back to the default behavior (using logger to output to the system log), but all you would need to do is replace the first code block under "Validation and Error Checking" with the following:
# Create a log folder and direct output to individual logs
if [[ ! -d "/var/log/install_or_defer_logs" ]]; then
echo "log directory does not exist. Creating."
/bin/mkdir "/var/log/install_or_defer_logs"
fi
exec 1>/var/log/install_or_defer_logs/install_or_defer_`date '+%Y%m%d_%H%M%S'`.log 2>&1
echo "Starting $(/usr/bin/basename "$0"). Performing validation and error checking..."
The code above creates a directory (var/log/install_or_defer_logs/) and then creates a log file with the date every time it runs.
Nicely done! I imagine we could wrap that into an optional config profile flag to change default output behavior. Currently working on bringing in some other changes from my local copy of the project but I'll work on implementing this soon.
Added static log output support in version 5.0! Just create a configuration profile and set DiagnosticLog
to true
(see README for config profile details). Thanks for the suggestion!
It would be great if we could specify a custom log file to be created for this, so it is not logging in the system itself and that way the log can be kept on the computer in case there is a need to review it later to find what might have gone wrong.