I have struggled to convince mysqld to log to stderr so its logs can be captured by the Docker log driver...wanted to pass on my experiences.
Relevant bugs:
https://bugs.mysql.com/bug.php?id=57690
https://bugs.mysql.com/bug.php?id=83060
I finally got this to work with the following:
ln -sf /dev/stderr /var/log/mysql/log.err
chown mysql:mysql /var/log/mysql/log.err
and invoke mysqld with:
mysqld --log-error=/var/log/mysql/log.err
The odd thing is that putting the symbolic link creation and chown into a Dockerfile to build a custom image did NOT work. I could only get it to work by writing my own entrypoint script, setting up & chown the link, and then proceed to run the existing entrypoint script, like this:
#!/bin/bash
ln -sf /dev/stderr /var/log/mysql/log.err
chown mysql:mysql /var/log/mysql/log.err
# Hand off to the original script
set -- /entrypoint.sh "$@"
exec "$@"
Did a little bit of digging, seems to be related to:
https://github.com/moby/moby/issues/31243
Hope this is helpful for someone.
Edited 2 time(s). Last edit at 09/29/2017 07:14AM by Sean McDowell.