Print port with 'enable-statement-logging'

This commit is contained in:
Esa Korhonen
2018-08-30 18:13:52 +03:00
parent 2b42011250
commit 763e1395ae
2 changed files with 9 additions and 12 deletions

View File

@ -227,11 +227,11 @@ const DEBUG_ARGUMENT debug_arguments[] =
}, },
{ {
"enable-statement-logging", enable_statement_logging, "enable-statement-logging", enable_statement_logging,
"enable the logging of SQL statements sent by MaxScale to the servers" "enable the logging of monitor and authenticator SQL statements sent by MaxScale to the servers"
}, },
{ {
"disable-statement-logging", disable_statement_logging, "disable-statement-logging", disable_statement_logging,
"disable the logging of SQL statements sent by MaxScale to the servers" "disable the logging of monitor and authenticator SQL statements sent by MaxScale to the servers"
}, },
{NULL, NULL, NULL} {NULL, NULL, NULL}
}; };
@ -1011,7 +1011,7 @@ static void usage(void)
for (int i = 0; debug_arguments[i].action != NULL; i++) for (int i = 0; debug_arguments[i].action != NULL; i++)
{ {
fprintf(stderr, fprintf(stderr,
" %-24s %s\n", debug_arguments[i].name, debug_arguments[i].description); " %-25s %s\n", debug_arguments[i].name, debug_arguments[i].description);
} }
fprintf(stderr, fprintf(stderr,
" -v, --version print version info and exit\n" " -v, --version print version info and exit\n"

View File

@ -249,15 +249,12 @@ int mxs_mysql_query(MYSQL* conn, const char* query)
if (this_unit.log_statements) if (this_unit.log_statements)
{ {
const char* host; const char* host = "0.0.0.0";
if (mariadb_get_info(conn, MARIADB_CONNECTION_HOST, &host) != 0) unsigned int port = 0;
{ MXB_AT_DEBUG(int rc1 =) mariadb_get_info(conn, MARIADB_CONNECTION_HOST, &host);
// No idea about the host, but let's use something that looks like MXB_AT_DEBUG(int rc2 =) mariadb_get_info(conn, MARIADB_CONNECTION_PORT, &port);
// an IP-address as a placeholder. mxb_assert(!rc1 && !rc2);
host = "0.0.0.0"; MXS_NOTICE("SQL([%s]:%u): %d, \"%s\"", host, port, rc, query);
}
MXS_NOTICE("SQL(%s): %d, \"%s\"", host, rc, query);
} }
return rc; return rc;