Skip to content

Commit 4299e1d

Browse files
Do not quote connection duration
It cannot contain spaces like username, virtual host and user-provided connection name can.
1 parent 3440e37 commit 4299e1d

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

deps/rabbit/src/rabbit_reader.erl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -366,13 +366,13 @@ start_connection(Parent, HelperSups, RanchRef, Deb, Sock) ->
366366
connected_at = ConnectedAt0}} ->
367367
ConnName = dynamic_connection_name(Name),
368368
ConnDuration = connection_duration(ConnectedAt0),
369-
rabbit_log_connection:info("closing AMQP connection (~ts, vhost: '~ts', user: '~ts', duration: '~ts')",
369+
rabbit_log_connection:info("closing AMQP connection (~ts, vhost: '~ts', user: '~ts', duration: ~ts)",
370370
[ConnName, VHost, Username, ConnDuration]);
371371
%% just to be more defensive
372372
_ ->
373373
ConnName = dynamic_connection_name(Name),
374374
ConnDuration = connection_duration(ConnectedAt),
375-
rabbit_log_connection:info("closing AMQP connection (~ts, duration: '~ts')",
375+
rabbit_log_connection:info("closing AMQP connection (~ts, duration: ~ts)",
376376
[ConnName, ConnDuration])
377377
end
378378
catch
@@ -417,7 +417,7 @@ log_connection_exception(Name, ConnectedAt, Ex) ->
417417

418418
log_connection_exception(Severity, Name, ConnectedAt, {heartbeat_timeout, TimeoutSec}) ->
419419
ConnDuration = connection_duration(ConnectedAt),
420-
Fmt = "closing AMQP connection ~tp (~ts, duration: '~ts'):~n"
420+
Fmt = "closing AMQP connection ~tp (~ts, duration: ~ts):~n"
421421
"missed heartbeats from client, timeout: ~ps",
422422
%% Long line to avoid extra spaces and line breaks in log
423423
log_connection_exception_with_severity(Severity, Fmt,
@@ -428,15 +428,15 @@ log_connection_exception(Severity, Name, _ConnectedAt,
428428
vhost = VHost,
429429
connected_at = ConnectedAt}}}) ->
430430
ConnDuration = connection_duration(ConnectedAt),
431-
Fmt = "closing AMQP connection ~tp (~ts, vhost: '~ts', user: '~ts', duration: '~ts'):~n"
431+
Fmt = "closing AMQP connection ~tp (~ts, vhost: '~ts', user: '~ts', duration: ~ts):~n"
432432
"client unexpectedly closed TCP connection",
433433
log_connection_exception_with_severity(Severity, Fmt,
434434
[self(), Name, VHost, Username, ConnDuration]);
435435
%% when client abruptly closes connection before connection.open/authentication/authorization
436436
%% succeeded, don't log username and vhost as 'none'
437437
log_connection_exception(Severity, Name, ConnectedAt, {connection_closed_abruptly, _}) ->
438438
ConnDuration = connection_duration(ConnectedAt),
439-
Fmt = "closing AMQP connection ~tp (~ts, duration: '~ts'):~n"
439+
Fmt = "closing AMQP connection ~tp (~ts, duration: ~ts):~n"
440440
"client unexpectedly closed TCP connection",
441441
log_connection_exception_with_severity(Severity, Fmt,
442442
[self(), Name, ConnDuration]);
@@ -450,20 +450,20 @@ log_connection_exception(Severity, Name, ConnectedAt, {handshake_error, tuning,
450450
log_connection_exception_with_severity(Severity, Fmt, [self(), Name, ConnDuration, Explanation]);
451451
log_connection_exception(Severity, Name, ConnectedAt, {sasl_required, ProtocolId}) ->
452452
ConnDuration = connection_duration(ConnectedAt),
453-
Fmt = "closing AMQP 1.0 connection (~ts, duration: '~ts'): RabbitMQ requires SASL "
453+
Fmt = "closing AMQP 1.0 connection (~ts, duration: ~ts): RabbitMQ requires SASL "
454454
"security layer (expected protocol ID 3, but client sent protocol ID ~b)",
455455
log_connection_exception_with_severity(Severity, Fmt,
456456
[Name, ConnDuration, ProtocolId]);
457457
%% old exception structure
458458
log_connection_exception(Severity, Name, ConnectedAt, connection_closed_abruptly) ->
459459
ConnDuration = connection_duration(ConnectedAt),
460-
Fmt = "closing AMQP connection ~tp (~ts, duration: '~ts'):~n"
460+
Fmt = "closing AMQP connection ~tp (~ts, duration: ~ts):~n"
461461
"client unexpectedly closed TCP connection",
462462
log_connection_exception_with_severity(Severity, Fmt,
463463
[self(), Name, ConnDuration]);
464464
log_connection_exception(Severity, Name, ConnectedAt, Ex) ->
465465
ConnDuration = connection_duration(ConnectedAt),
466-
Fmt = "closing AMQP connection ~tp (~ts, duration: '~ts'):~n"
466+
Fmt = "closing AMQP connection ~tp (~ts, duration: ~ts):~n"
467467
"~tp",
468468
log_connection_exception_with_severity(Severity, Fmt,
469469
[self(), Name, ConnDuration, Ex]).

0 commit comments

Comments
 (0)