docker-crontab/test_logging

21 lines
522 B
Plaintext
Raw Permalink Normal View History

2017-06-17 20:55:56 -06:00
#!/usr/bin/env bash
set -e
2017-11-14 14:04:30 -07:00
# This file is for testing the logging of docker output #8
2017-06-17 20:55:56 -06:00
LOG_FILE=./jobs.log
touch ${LOG_FILE}
UUID="xxxxxxxxxxxxxxxxx"
2017-06-21 13:14:00 -06:00
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)
2017-06-17 20:55:56 -06:00
echo "Start"
docker run alpine sh -c 'while :; do echo "ping"; sleep 1; done'
# [error] write /dev/stdout: broken pipe
2017-06-17 21:01:49 -06:00
# --log-driver syslog <- errors
# --log-driver none <- errors
2017-06-17 20:55:56 -06:00
echo "End"