diff --git a/changelog b/changelog index fe9edc277..817d1666d 100644 --- a/changelog +++ b/changelog @@ -2,6 +2,10 @@ Changes in 1.1.1 (not released) * Disable binlog for all entrypoint client commands (#87305) This was previously only done only for the script to set the root password, but should be done for all client commands, or group replication will fail + * Add flag for logging to stdout (#87458) + Setting -e MYSQL_LOG_STDOUT=true will make the server log to stdout, so the + server log is available through Docker's log interface. + Changes in 1.1.0 (2017-07-24) * Fixed broken MYSQL_ONETIME_PASSWORD support (#86523) The functionality wasn't correctly updated when the entrypoint script was diff --git a/genOracleLinux.sh b/genOracleLinux.sh index d835a06bb..0c297a928 100755 --- a/genOracleLinux.sh +++ b/genOracleLinux.sh @@ -87,6 +87,13 @@ TZINFO_WORKAROUND["5.6"]="sed 's/Local time zone must be set--see zic manual pag TZINFO_WORKAROUND["5.7"]="" TZINFO_WORKAROUND["8.0"]="" +# Logging to stdout makes server log available with the «docker logs command» +declare -A DEFAULT_LOG +DEFAULT_LOG["5.5"]="" +DEFAULT_LOG["5.6"]="" +DEFAULT_LOG["5.7"]="" +DEFAULT_LOG["8.0"]="stdout" + for VERSION in ${VERSIONS} do # Dockerfile @@ -103,6 +110,7 @@ do sed -i 's#%%INIT_STARTUP%%#'"${INIT_STARTUP[${VERSION}]}"'#g' tmpfile sed -i 's#%%STARTUP_WAIT%%#'"${STARTUP_WAIT[${VERSION}]}"'#g' tmpfile sed -i 's#%%SERVER_VERSION_FULL%%#'"${SERVER_VERSION_FULL[${VERSION}]}"'#g' tmpfile + sed -i 's#%%DEFAULT_LOG%%#'"${DEFAULT_LOG[${VERSION}]}"'#g' tmpfile mv tmpfile ${VERSION}/docker-entrypoint.sh chmod +x ${VERSION}/docker-entrypoint.sh diff --git a/template/docker-entrypoint.sh b/template/docker-entrypoint.sh index 03c6a711f..2f291e27e 100644 --- a/template/docker-entrypoint.sh +++ b/template/docker-entrypoint.sh @@ -46,6 +46,10 @@ if [ "$1" = 'mysqld' ]; then DATADIR="$(_get_config 'datadir' "$@")" SOCKET="$(_get_config 'socket' "$@")" + if [ -n "$MYSQL_LOG_STDOUT" ] || [ -n "%%DEFAULT_LOG%%" ]; then + sed -i 's/^log-error=/#&/' /etc/my.cnf + fi + if [ ! -d "$DATADIR/mysql" ]; then if [ -z "$MYSQL_ROOT_PASSWORD" -a -z "$MYSQL_ALLOW_EMPTY_PASSWORD" -a -z "$MYSQL_RANDOM_ROOT_PASSWORD" ]; then echo >&2 '[Entrypoint] ERROR: No password option specified for new database.'