docker-crontab/test_logging
2017-11-14 14:04:30 -07:00

21 lines
522 B
Bash
Executable File

#!/usr/bin/env bash
set -e
# This file is for testing the logging of docker output #8
LOG_FILE=./jobs.log
touch ${LOG_FILE}
UUID="xxxxxxxxxxxxxxxxx"
exec > >(read message; echo "${UUID} $(date) [info] $message" | tee -a ${LOG_FILE} )
exec 2> >(read message; echo "${UUID} $(date) [error] $message" | tee -a ${LOG_FILE} >&2)
echo "Start"
docker run alpine sh -c 'while :; do echo "ping"; sleep 1; done'
# [error] write /dev/stdout: broken pipe
# --log-driver syslog <- errors
# --log-driver none <- errors
echo "End"