Bug #87087 mysqld completely silent even in failure if log-error is not writable
Submitted: 16 Jul 2017 18:46 Modified: 4 Sep 2017 3:21
Reporter: Terje Røsten Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:5.7.19 OS:Any
Assigned to: Dyre Tjeldvoll CPU Architecture:Any

[16 Jul 2017 18:46] Terje Røsten
Description:
Starting mysqld with invalid config in some way mysqld still don't print anything if log error is not writable.

In case mysqld should abort and log to stderr/stdout.

How to repeat:
As normal OS user do:

$ mysqld --datadir=/tmp/root --log-error=/root/mysqld.log --initialize
$ 

No files are created in /tmp/root, however no error or warnings are printed.

Suggested fix:
When in error and log error is not writable, switch to printing to stdout/stdout.
[16 Aug 2017 7:56] Terje Røsten
Posted by developer:
 
8.0-3-rc has correct output. 

Compare:

$ bin/mysqld -V # current 5.7 + patch
bin/mysqld  Ver 5.7.20 for Linux on x86_64 (Source distribution)

$ bin/mysqld --no-defaults --basedir=. --datadir=/tmp/a --initialize --log-error=/root/not-writable
2017-08-16T07:49:16.113389Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-08-16T07:49:16.114871Z 0 [ERROR] Aborting

and

$ bin/mysqld -V # current trunk                                                                        
/dev/shm/j/usr/local/mysql/bin/mysqld  Ver 8.0.3-rc for Linux on x86_64 (Source distribution)

$ bin/mysqld --no-defaults --datadir=/tmp/a --initialize --log-error=/root/not-writable
2017-08-16T07:53:28.722730Z 0 [Note] Basedir set to /dev/shm/j/usr/local/mysql/
2017-08-16T07:53:28.724209Z 0 [ERROR] Could not open /root/not-writable.err file for error logging: Permission denied.
2017-08-16T07:53:28.724225Z 0 [ERROR] Aborting

Line 

2017-08-16T07:53:28.724209Z 0 [ERROR] Could not open /root/not-writable.err file for error logging: Permission denied.

is missing from 5.7 + patch.
[16 Aug 2017 9:00] Terje Røsten
Posted by developer:
 
New version works fine, thanks.
[4 Sep 2017 3:21] Paul DuBois
Posted by developer:
 
Fixed in 5.7.20, 8.0.4.

If the error log was misconfigured and the server could not start, no
output indicating the problem was produced.