From afa6d3adc30bd4898825af38763ce008cab5a774 Mon Sep 17 00:00:00 2001 From: Jeremy Harris Date: Sun, 8 May 2016 01:24:47 +0100 Subject: [PATCH] logging --- doc/doc-docbook/spec.xfpt | 1 + src/src/deliver.c | 9 +++++++++ src/src/receive.c | 3 +++ test/log/0574 | 4 ++-- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/doc/doc-docbook/spec.xfpt b/doc/doc-docbook/spec.xfpt index 4bc2e1118..bb00fa1d2 100644 --- a/doc/doc-docbook/spec.xfpt +++ b/doc/doc-docbook/spec.xfpt @@ -35566,6 +35566,7 @@ the following table: &`P `& on &`<=`& lines: protocol used &` `& on &`=>`& and &`**`& lines: return path &`PRX `& on &'<='& and&`=>`& lines: proxy address +&`Q `& alternate queue name &`QT `& on &`=>`& lines: time spent on queue so far &` `& on &"Completed"& lines: time spent on queue &`R `& on &`<=`& lines: reference for local bounce diff --git a/src/src/deliver.c b/src/src/deliver.c index 631a3e18a..1fd3d46c0 100644 --- a/src/src/deliver.c +++ b/src/src/deliver.c @@ -880,6 +880,9 @@ if (LOGGING(sender_on_delivery) || msg) sender_address, US">"); +if (*queue_name) + s = string_append(s, &size, &ptr, 2, US" Q=", queue_name); + #ifdef EXPERIMENTAL_SRS if(addr->prop.srs_sender) s = string_append(s, &size, &ptr, 3, US" SRS=<", addr->prop.srs_sender, US">"); @@ -1267,6 +1270,9 @@ else if (result == DEFER || result == PANIC) s = string_cat(s, &size, &ptr, log_address); + if (*queue_name) + s = string_append(s, &size, &ptr, 2, US" Q=", queue_name); + /* Either driver_name contains something and driver_kind contains " router" or " transport" (note the leading space), or driver_name is a null string and driver_kind contains "routing" without the leading @@ -1388,6 +1394,9 @@ else if (LOGGING(sender_on_delivery)) s = string_append(s, &size, &ptr, 3, US" F=<", sender_address, US">"); + if (*queue_name) + s = string_append(s, &size, &ptr, 2, US" Q=", queue_name); + /* Return path may not be set if no delivery actually happened */ if (used_return_path && LOGGING(return_path_on_delivery)) diff --git a/src/src/receive.c b/src/src/receive.c index ea99cfb2b..c783cedfd 100644 --- a/src/src/receive.c +++ b/src/src/receive.c @@ -3804,6 +3804,9 @@ if (LOGGING(8bitmime)) s = string_append(s, &size, &sptr, 2, US" M8S=", big_buffer); } +if (*queue_name) + s = string_append(s, &size, &sptr, 2, US" Q=", queue_name); + /* If an addr-spec in a message-id contains a quoted string, it can contain any characters except " \ and CR and so in particular it can contain NL! Therefore, make sure we use a printing-characters only version for the log. diff --git a/test/log/0574 b/test/log/0574 index cf13480bc..206a95f38 100644 --- a/test/log/0574 +++ b/test/log/0574 @@ -1,5 +1,5 @@ 1999-03-02 09:44:33 10HmaX-0005vi-00 <= CALLER@the.local.host.name U=CALLER P=local-smtp S=sss for normal@test.ex -1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@the.local.host.name U=CALLER P=local-smtp S=sss for alternate@test.ex +1999-03-02 09:44:33 10HmaY-0005vi-00 <= CALLER@the.local.host.name U=CALLER P=local-smtp S=sss Q=alternate for alternate@test.ex 1999-03-02 09:44:33 Start queue run: pid=pppp -qq 1999-03-02 09:44:33 10HmaX-0005vi-00 => normal@test.ex F= R=all T=out H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmaZ-0005vi-00" 1999-03-02 09:44:33 10HmaX-0005vi-00 Completed @@ -7,7 +7,7 @@ 1999-03-02 09:44:33 Start 'nosuchqueue' queue run: pid=pppp 1999-03-02 09:44:33 End 'nosuchqueue' queue run: pid=pppp 1999-03-02 09:44:33 Start 'alternate' queue run: pid=pppp -1999-03-02 09:44:33 10HmaY-0005vi-00 => alternate@test.ex F= R=all T=out H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmbA-0005vi-00" +1999-03-02 09:44:33 10HmaY-0005vi-00 => alternate@test.ex F= Q=alternate R=all T=out H=127.0.0.1 [127.0.0.1] C="250 OK id=10HmbA-0005vi-00" 1999-03-02 09:44:33 10HmaY-0005vi-00 Completed 1999-03-02 09:44:33 End 'alternate' queue run: pid=pppp -- 2.25.1