Use RFC 3986 compliant addresses in log messages
When log messages are written with both address and port information, IPv6
addresses can cause confusion if the normal address:port formatting is
used. The RFC 3986 suggests that all IPv6 addresses are expressed as a
bracket enclosed address optionally followed by the port that is separate
from the address by a colon.
In practice, the "all interfaces" address and port number 3306 can be
written in IPv4 numbers-and-dots notation as 0.0.0.0:3306 and in IPv6
notation as [::]:3306. Using the latter format in log messages keeps the
output consistent with all types of addresses.
The details of the standard can be found at the following addresses:
https://www.ietf.org/rfc/rfc3986.txt
https://www.rfc-editor.org/std/std66.txt
This commit is contained in:
@ -762,14 +762,14 @@ static void clientReply(MXS_ROUTER *instance,
|
||||
{
|
||||
bool succp;
|
||||
|
||||
MXS_INFO("Backend %s:%d processed reply and starts to execute active cursor.",
|
||||
MXS_INFO("Backend [%s]:%d processed reply and starts to execute active cursor.",
|
||||
bref->ref->server->name, bref->ref->server->port);
|
||||
|
||||
succp = execute_sescmd_in_backend(bref);
|
||||
|
||||
if (!succp)
|
||||
{
|
||||
MXS_INFO("Backend %s:%d failed to execute session command.",
|
||||
MXS_INFO("Backend [%s]:%d failed to execute session command.",
|
||||
bref->ref->server->name, bref->ref->server->port);
|
||||
}
|
||||
}
|
||||
@ -1087,7 +1087,7 @@ int router_handle_state_switch(DCB *dcb, DCB_REASON reason, void *data)
|
||||
goto return_rc;
|
||||
}
|
||||
|
||||
MXS_DEBUG("%lu [router_handle_state_switch] %s %s:%d in state %s",
|
||||
MXS_DEBUG("%lu [router_handle_state_switch] %s [%s]:%d in state %s",
|
||||
pthread_self(), STRDCBREASON(reason), srv->name, srv->port,
|
||||
STRSRVSTATUS(srv));
|
||||
CHK_SESSION(((MXS_SESSION *)dcb->session));
|
||||
@ -1318,7 +1318,7 @@ static void handleError(MXS_ROUTER *instance,
|
||||
}
|
||||
else if (!SERVER_IS_MASTER(srv) && !srv->master_err_is_logged)
|
||||
{
|
||||
MXS_ERROR("Server %s:%d lost the master status. Readwritesplit "
|
||||
MXS_ERROR("Server [%s]:%d lost the master status. Readwritesplit "
|
||||
"service can't locate the master. Client sessions "
|
||||
"will be closed.", srv->name, srv->port);
|
||||
srv->master_err_is_logged = true;
|
||||
@ -1336,7 +1336,7 @@ static void handleError(MXS_ROUTER *instance,
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Server %s:%d lost the master status but could not locate the "
|
||||
MXS_ERROR("Server [%s]:%d lost the master status but could not locate the "
|
||||
"corresponding backend ref.", srv->name, srv->port);
|
||||
}
|
||||
}
|
||||
|
||||
@ -369,7 +369,7 @@ void check_session_command_reply(GWBUF *writebuf, sescmd_cursor_t *scur, backend
|
||||
|
||||
ss_dassert(len + 4 == GWBUF_LENGTH(scur->scmd_cur_cmd->my_sescmd_buf));
|
||||
|
||||
MXS_ERROR("Failed to execute session command in %s:%d. Error was: %s %s",
|
||||
MXS_ERROR("Failed to execute session command in [%s]:%d. Error was: %s %s",
|
||||
bref->ref->server->name,
|
||||
bref->ref->server->port, err, replystr);
|
||||
MXS_FREE(err);
|
||||
|
||||
@ -209,7 +209,7 @@ bool route_session_write(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO) &&
|
||||
BREF_IS_IN_USE((&backend_ref[i])))
|
||||
{
|
||||
MXS_INFO("Route query to %s \t%s:%d%s",
|
||||
MXS_INFO("Route query to %s \t[%s]:%d%s",
|
||||
(SERVER_IS_MASTER(backend_ref[i].ref->server)
|
||||
? "master" : "slave"),
|
||||
backend_ref[i].ref->server->name,
|
||||
@ -316,7 +316,7 @@ bool route_session_write(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
|
||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO))
|
||||
{
|
||||
MXS_INFO("Route query to %s \t%s:%d%s",
|
||||
MXS_INFO("Route query to %s \t[%s]:%d%s",
|
||||
(SERVER_IS_MASTER(backend_ref[i].ref->server)
|
||||
? "master" : "slave"),
|
||||
backend_ref[i].ref->server->name,
|
||||
@ -339,7 +339,7 @@ bool route_session_write(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
if (sescmd_cursor_is_active(scur) && &backend_ref[i] != router_cli_ses->rses_master_ref)
|
||||
{
|
||||
nsucc += 1;
|
||||
MXS_INFO("Backend %s:%d already executing sescmd.",
|
||||
MXS_INFO("Backend [%s]:%d already executing sescmd.",
|
||||
backend_ref[i].ref->server->name,
|
||||
backend_ref[i].ref->server->port);
|
||||
}
|
||||
@ -351,7 +351,7 @@ bool route_session_write(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Failed to execute session command in %s:%d",
|
||||
MXS_ERROR("Failed to execute session command in [%s]:%d",
|
||||
backend_ref[i].ref->server->name,
|
||||
backend_ref[i].ref->server->port);
|
||||
}
|
||||
@ -607,7 +607,7 @@ bool rwsplit_get_dcb(DCB **p_dcb, ROUTER_CLIENT_SES *rses, backend_type_t btype,
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_INFO("Server %s:%d is too much behind the master, %d s. and can't be chosen.",
|
||||
MXS_INFO("Server [%s]:%d is too much behind the master, %d s. and can't be chosen.",
|
||||
b->server->name, b->server->port, b->server->rlag);
|
||||
}
|
||||
}
|
||||
@ -1230,7 +1230,7 @@ handle_got_target(ROUTER_INSTANCE *inst, ROUTER_CLIENT_SES *rses,
|
||||
|
||||
ss_dassert(target_dcb != NULL);
|
||||
|
||||
MXS_INFO("Route query to %s \t%s:%d <",
|
||||
MXS_INFO("Route query to %s \t[%s]:%d <",
|
||||
(SERVER_IS_MASTER(bref->ref->server) ? "master"
|
||||
: "slave"), bref->ref->server->name, bref->ref->server->port);
|
||||
/**
|
||||
|
||||
@ -277,7 +277,7 @@ bool select_connect_backend_servers(backend_ref_t **p_master_ref,
|
||||
{
|
||||
if (BREF_IS_IN_USE((&backend_ref[i])))
|
||||
{
|
||||
MXS_INFO("Selected %s in \t%s:%d",
|
||||
MXS_INFO("Selected %s in \t[%s]:%d",
|
||||
STRSRVSTATUS(backend_ref[i].ref->server),
|
||||
backend_ref[i].ref->server->name,
|
||||
backend_ref[i].ref->server->port);
|
||||
@ -443,7 +443,7 @@ static bool connect_server(backend_ref_t *bref, MXS_SESSION *session, bool execu
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Failed to execute session command in %s (%s:%d). See earlier "
|
||||
MXS_ERROR("Failed to execute session command in %s ([%s]:%d). See earlier "
|
||||
"errors for more details.",
|
||||
bref->ref->server->unique_name,
|
||||
bref->ref->server->name,
|
||||
@ -456,7 +456,7 @@ static bool connect_server(backend_ref_t *bref, MXS_SESSION *session, bool execu
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_ERROR("Unable to establish connection with server %s:%d",
|
||||
MXS_ERROR("Unable to establish connection with server [%s]:%d",
|
||||
serv->name, serv->port);
|
||||
}
|
||||
|
||||
@ -489,26 +489,26 @@ static void log_server_connections(select_criteria_t select_criteria,
|
||||
switch (select_criteria)
|
||||
{
|
||||
case LEAST_GLOBAL_CONNECTIONS:
|
||||
MXS_INFO("MaxScale connections : %d in \t%s:%d %s",
|
||||
MXS_INFO("MaxScale connections : %d in \t[%s]:%d %s",
|
||||
b->server->stats.n_current, b->server->name,
|
||||
b->server->port, STRSRVSTATUS(b->server));
|
||||
break;
|
||||
|
||||
case LEAST_ROUTER_CONNECTIONS:
|
||||
MXS_INFO("RWSplit connections : %d in \t%s:%d %s",
|
||||
MXS_INFO("RWSplit connections : %d in \t[%s]:%d %s",
|
||||
b->connections, b->server->name,
|
||||
b->server->port, STRSRVSTATUS(b->server));
|
||||
break;
|
||||
|
||||
case LEAST_CURRENT_OPERATIONS:
|
||||
MXS_INFO("current operations : %d in \t%s:%d %s",
|
||||
MXS_INFO("current operations : %d in \t[%s]:%d %s",
|
||||
b->server->stats.n_current_ops,
|
||||
b->server->name, b->server->port,
|
||||
STRSRVSTATUS(b->server));
|
||||
break;
|
||||
|
||||
case LEAST_BEHIND_MASTER:
|
||||
MXS_INFO("replication lag : %d in \t%s:%d %s",
|
||||
MXS_INFO("replication lag : %d in \t[%s]:%d %s",
|
||||
b->server->rlag, b->server->name,
|
||||
b->server->port, STRSRVSTATUS(b->server));
|
||||
default:
|
||||
|
||||
@ -216,7 +216,7 @@ GWBUF *sescmd_cursor_process_replies(GWBUF *replybuf,
|
||||
RW_CLOSE_BREF(&ses->rses_backend_ref[i]);
|
||||
}
|
||||
*reconnect = true;
|
||||
MXS_INFO("Disabling slave %s:%d, result differs from "
|
||||
MXS_INFO("Disabling slave [%s]:%d, result differs from "
|
||||
"master's result. Master: %d Slave: %d",
|
||||
ses->rses_backend_ref[i].ref->server->name,
|
||||
ses->rses_backend_ref[i].ref->server->port,
|
||||
|
||||
Reference in New Issue
Block a user