Bug #49168 --log-warnings is not defined properly
Submitted: 27 Nov 2009 15:42 Modified: 27 Nov 2009 16:48
Reporter: Andrei Elkin Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: General Severity:S3 (Non-critical)
Version:5.0+ OS:Any
Assigned to: CPU Architecture:Any

[27 Nov 2009 15:42] Andrei Elkin
There is 

1. an apparent disagreement in the way how --log-warnings server option is defined  between the source code

{"log-warnings", 'W', "Log some not critical warnings to the log file.",

and the doc pages:

* `--log-warnings[=LEVEL]', `-W [LEVEL]'

mentioning LEVELs. LEVELs are not explained in that section of the docs although 
there is an indirect def at `show-warnings' sql command to make one
think of "Level: Note" or "Level: Warning" or "Level: Error".

2. Lack of clear semantics of --log-warnings hurts in many ways as to the 
user so to the programmer (e.g consider discussions around bug#42851).

It's not quite clear from the existing use cases what is "some" in the source code sense. On one hand --log-warnings tries
to error-log messages that user can not receive via client-server protocol
(show warnings) such as ` Aborted connection ', oth recently the set of cases gained error-logging of "Statement is not safe to log..." replication warning

How to repeat:
To follow the description to read the lines of the code and the docs. 

Suggested fix:
   to define --log-warnings to deal with the LEVEL as defined per 
   `show-warnings'. E.g the following dbug-like
   syntax can be offered (per Luis):


   to mean to disable the error level messages and enable 
   the warning and the note level ones for error-logging.

   to elaborate on --log-warning to accept a particular error code


   The template line excludes error-logging of the error 4711 and to forces it for the note 1001.
   notice that the fine-granularity filtering can be possible only if all the messages will be enumerated. Let's enumerate `Aborted connection' etc (if they are not yet) and make such administration errors be error-loggable by default.
[27 Nov 2009 16:48] Valeriy Kravchuk
As suggested change is different from what manual (http://dev.mysql.com/doc/refman/5.0/en/server-options.html#option_mysqld_log-warnings) says, I'd say this is clearly a (useful) feature request.