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


The following commit(s) were added to refs/heads/master by this push:
     new 4f38296f28 MailSizeEsmtpExtension - change log level when Quota 
exceeded (#2053)
4f38296f28 is described below

commit 4f38296f2851d2de68006281d26eb0938e6ede1d
Author: vttran <vtt...@linagora.com>
AuthorDate: Tue Feb 27 21:24:59 2024 +0700

    MailSizeEsmtpExtension - change log level when Quota exceeded (#2053)
---
 .../james/protocols/smtp/core/esmtp/MailSizeEsmtpExtension.java   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/MailSizeEsmtpExtension.java
 
b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/MailSizeEsmtpExtension.java
index 9de63f01ce..a2f90e9d67 100644
--- 
a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/MailSizeEsmtpExtension.java
+++ 
b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/MailSizeEsmtpExtension.java
@@ -117,8 +117,8 @@ public class MailSizeEsmtpExtension implements 
MailParametersHook, EhloExtension
         long maxMessageSize = session.getConfiguration().getMaxMessageSize();
         if ((maxMessageSize > 0) && (size > maxMessageSize)) {
             // Let the client know that the size limit has been hit.
-            LOGGER.error("Rejected message from {} to {} of size {} exceeding 
system maximum message size of {} based on SIZE option.",
-                tempSender,
+            LOGGER.info("Rejected message from {} to {} of size {} exceeding 
system maximum message size of {} based on SIZE option.",
+                tempSender.asPrettyString(),
                 session.getRemoteAddress().getAddress().getHostAddress(),
                 size,
                 maxMessageSize);
@@ -178,7 +178,9 @@ public class MailSizeEsmtpExtension implements 
MailParametersHook, EhloExtension
     public HookResult onMessage(SMTPSession session, MailEnvelope mail) {
         Optional<Boolean> failed = session.getAttachment(MESG_FAILED, 
State.Transaction);
         if (failed.orElse(false)) {
-            LOGGER.error("Rejected message from {} from {} exceeding system 
maximum message size of {}", session.getAttachment(SMTPSession.SENDER, 
State.Transaction), session.getRemoteAddress().getAddress().getHostAddress(), 
session.getConfiguration().getMaxMessageSize());
+            LOGGER.info("Rejected message from {} from {} exceeding system 
maximum message size of {}",
+                session.getAttachment(SMTPSession.SENDER, 
State.Transaction).orElse(MaybeSender.nullSender()).asPrettyString(),
+                session.getRemoteAddress().getAddress().getHostAddress(), 
session.getConfiguration().getMaxMessageSize());
             return QUOTA_EXCEEDED;
         } else {
             return HookResult.DECLINED;


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscr...@james.apache.org
For additional commands, e-mail: notifications-h...@james.apache.org

Reply via email to