Bug #8307 log_error variable is blank when not explicitly stated in my.cnf
Submitted: 4 Feb 2005 2:10 Modified: 16 Apr 2013 17:59
Reporter: Matthew Lord Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Logging Severity:S4 (Feature request)
Version:4.1.9, 5.0.83, 5.5.12 OS:Any
Assigned to: CPU Architecture:Any
Triage: Needs Triage: D5 (Feature request)

[4 Feb 2005 2:10] Matthew Lord
Description:
mysql>show variables like "log_error";

+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| log_error         |       |

When not specified it has always showed ./HOSTNAME.err and it still does on windows.

How to repeat:
Install 4.1.9 on *nix and make sure you don't specify a value for log-error in any cnf files.
mysql -e "show variables like "log_error"

Suggested fix:
Show ./HOSTNAME.err as before.
[4 Feb 2005 4:07] Matthew Lord
It turns out that this has always been true on unix so I changed the severity to Feature Request
as 1) I think it should behave the same way on all platforms and 2) It only makes sense that it
shows you where the error log is, whether it's the default location or not.
[22 Feb 2006 11:25] Valeriy Kravchuk
Situation is still the same. (Checked even with 5.1.8-beta on Linux vs. 5.0.18-nt). We should be consistent in this on all platfroms.
[24 Feb 2006 12:49] Valeriy Kravchuk
Bug #17652 is marked as a duplicate of this one.
[11 Mar 2010 2:50] Roel Van de Paar
Not showing on 5.0.83 (Linux):

| log_error     |       | 

Showing on 5.1.23a (Linux) and later versions:

| log_error     | /mysql/mysql-5.1.23a-maria-alpha-linux-i686-icc-glibc23
| log_error     | /mysql/mysql-advanced-gpl-5.1.41-linux-i686-icc-glibc23/data/roel-ubuntu-vm.err |

Showing on 5.1.42 (Windows):

| log_error     | C:\mysql5142\data\MySQL.err |
[11 Mar 2010 3:11] Roel Van de Paar
Partly ignore the above. All tests above were done using mysqld_safe. 

When using mysqld_safe on 5.1, it sets up log_error for mysqld. Doing the same test, not using mysqld_safe gives:

mysql> SHOW GLOBAL VARIABLES LIKE 'log_error';
| log_error     |       |

mysql> SELECT VERSION();
| 5.1.41-enterprise-gpl-advanced |

On 5.0, mysqld_safe does not set log_error correctly at all.
[11 Mar 2010 3:18] Roel Van de Paar
Possibly there should be a GLOBAL STATUS variable to show the current error log location and filename, while the GLOBAL VARIABLE output could show any settings made (in my.cnf/ini or mysqld_safe).
[12 Mar 2010 3:00] Roel Van de Paar
If you hit this bug trying to find where your error log is, and the log_error variable output is empty, check the following locations:

#1 In the directory which is listed in: 

SHOW GLOBAL VARIABLES LIKE 'datadir';

Look for a file named host-name.err (i.e. your actual hostname + .err)

#2 If you are using RedHat:

Check /var/log/mysqld.log

#3 If you are using Debian:

Check your syslog
[24 May 2011 9:19] Santo Leto
Version 5.5.12 on Windows 7 is affected too.

If you do not specify the option --log-error at server startup, you'll get an empty log_error value

mysql> show variables like 'log_error';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_error     |       |
+---------------+-------+
1 row in set (0.00 sec)

If instead you specify this option at server startup, you'll get

mysql> show variables like 'log_error';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_error     | path_to_your_error_log_here |
+---------------+-------+
1 row in set (0.00 sec)

This is not intuitive at all. If we don't want to fix this bug, please at least let's improve the page: 
http://dev.mysql.com/doc/refman/5.5/en/server-system-variables.html#sysvar_log_error

On that page, in fact, I can read that log_error is "The location of the error log.", which is wrong, as this variable is empty on some cases.

Thanks.
[16 Apr 2013 17:59] Paul Dubois
Noted in 5.7.1 changelog.

On Windows, the log_error system variable did not accurately reflect
the error log file name in some cases. For example, if the server was
started without --console or --log-error, the default is to log to
host_name.err in the data directory, but log_error remained blank.
      
Now log_error should be nonblank and reflect the log file name in all
cases, on all platforms. The value is stderr if the server does not
write error messages to a file and sends them to the console
(standard error output) instead. In particular, on Windows, --console
overrides use of an error log and sends error messages to the
console, so log_error will be set to stderr.
[16 Apr 2013 18:00] Paul Dubois
Will also need to update the sections that describe log_error and error logging.