add This to Bash code to ceate error log with time stemp
# Optional:
# exec 1<&- # Close STDOUT file descriptor
# exec 2<&- # Close STDERR FD
parent_path=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
LOG_FILE=$parent_path'/err.log' #Config file name to save
exec 1>> $LOG_FILE # Open STDOUT as $LOG_FILE file for read and write.
exec 2>&1 # Redirect STDERR to STDOUT
echo | ts '[%Y-%m-%d %H:%M:%S]'
echo "this sould be show in the err.log file"