MySQL Forums
Forum List  »  NDB clusters

Docker container logging to stderr
Posted by: Sean McDowell
Date: September 28, 2017 09:43AM

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.

Options: ReplyQuote


Subject
Views
Written By
Posted
Docker container logging to stderr
5253
September 28, 2017 09:43AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.