mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#12873214 WINDOWS AUTHENTICATION PLUGIN PRODUCES EXCESSIVE RECORDS IN SERVER ERROR LOG
Changed semantics of AUTHENTICATION_WIN_LOG environment variable recognized by client library to accept the following values which are levels of logging done during Windows authentication handshake: 0 - no logging 1 - log only error messages 2 - additionally log warnings 3 - additionally log info notes 4 - also log debug messages Setting it to 'on', 'yes' or 'true' will request log level 2 and setting it to 'debug' or 'dbug' will request log level 4.
This commit is contained in:
@ -16,36 +16,32 @@
|
||||
#include <my_global.h>
|
||||
#include "common.h"
|
||||
|
||||
/**
|
||||
This option is set in win_auth_handshake_client() function
|
||||
in handshake_client.cc.
|
||||
|
||||
Values:
|
||||
0 - no logging
|
||||
1 - log error/warning/info messages
|
||||
2 - also log debug messages
|
||||
|
||||
Note: No error or debug messages are logged in production code
|
||||
(see logging macros in common.h).
|
||||
*/
|
||||
int opt_auth_win_client_log= 0;
|
||||
|
||||
|
||||
// Client-side logging function
|
||||
|
||||
void error_log_vprint(error_log_level::type level,
|
||||
const char *fmt, va_list args)
|
||||
{
|
||||
if (0 == opt_auth_win_client_log)
|
||||
return;
|
||||
|
||||
const char *level_string= "";
|
||||
int log_level= get_log_level();
|
||||
|
||||
switch (level)
|
||||
{
|
||||
case error_log_level::INFO: level_string= "Note"; break;
|
||||
case error_log_level::WARNING: level_string= "Warning"; break;
|
||||
case error_log_level::ERROR: level_string= "ERROR"; break;
|
||||
case error_log_level::INFO:
|
||||
if (3 > log_level)
|
||||
return;
|
||||
level_string= "Note";
|
||||
break;
|
||||
case error_log_level::WARNING:
|
||||
if (2 > log_level)
|
||||
return;
|
||||
level_string= "Warning";
|
||||
break;
|
||||
case error_log_level::ERROR:
|
||||
if (1 > log_level)
|
||||
return;
|
||||
level_string= "ERROR";
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf(stderr, "Windows Authentication Plugin %s: ", level_string);
|
||||
@ -53,3 +49,17 @@ void error_log_vprint(error_log_level::type level,
|
||||
fputc('\n', stderr);
|
||||
fflush(stderr);
|
||||
}
|
||||
|
||||
|
||||
// Trivial implementation of log-level setting storage.
|
||||
|
||||
void set_log_level(unsigned int level)
|
||||
{
|
||||
opt_auth_win_log_level= level;
|
||||
}
|
||||
|
||||
|
||||
unsigned int get_log_level(void)
|
||||
{
|
||||
return opt_auth_win_log_level;
|
||||
}
|
||||
|
Reference in New Issue
Block a user