You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/05/15 03:32:43 UTC

[james-project] 02/02: JAMES-2768 make DelaysAndMaxRetry logs more clear

This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 6e7ae94eb4ea7ab920ac0758621f4add6db25e8d
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Mon May 13 17:04:37 2019 +0700

    JAMES-2768 make DelaysAndMaxRetry logs more clear
---
 .../transport/mailets/remote/delivery/DelaysAndMaxRetry.java      | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/DelaysAndMaxRetry.java b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/DelaysAndMaxRetry.java
index 8279b58..4b4df00 100644
--- a/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/DelaysAndMaxRetry.java
+++ b/server/mailet/mailets/src/main/java/org/apache/james/transport/mailets/remote/delivery/DelaysAndMaxRetry.java
@@ -24,6 +24,7 @@ import java.util.List;
 
 import javax.mail.MessagingException;
 
+import org.apache.commons.lang3.time.DurationFormatUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -64,12 +65,15 @@ public class DelaysAndMaxRetry {
     private static DelaysAndMaxRetry addExtraAttemptToLastDelay(int intendedMaxRetries, int extra, List<Delay> delayTimesList) throws MessagingException {
         if (delayTimesList.size() != 0) {
             Delay lastDelay = delayTimesList.get(delayTimesList.size() - 1);
-            LOGGER.warn("Delay of {} msecs is now attempted: {} times", lastDelay.getDelayTime(), lastDelay.getAttempts());
+            Duration lastDelayTime = lastDelay.getDelayTime();
+            LOGGER.warn("Delay of {} is now attempted: {} times",
+                DurationFormatUtils.formatDurationWords(lastDelayTime.toMillis(), true, true),
+                lastDelay.getAttempts());
             return new DelaysAndMaxRetry(intendedMaxRetries,
                 ImmutableList.copyOf(
                     Iterables.concat(
                         Iterables.limit(delayTimesList, delayTimesList.size() - 1),
-                        ImmutableList.of(new Delay(lastDelay.getAttempts() + extra, lastDelay.getDelayTime())))));
+                        ImmutableList.of(new Delay(lastDelay.getAttempts() + extra, lastDelayTime)))));
         } else {
             throw new MessagingException("No delaytimes, cannot continue");
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org