You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2024/02/23 07:41:58 UTC

(james-project) branch master updated: [FIX] More jmap logs (#2037)

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 fa6ec2db42 [FIX] More jmap logs (#2037)
fa6ec2db42 is described below

commit fa6ec2db4261fc2ff479654f96a92fc76cd39a8d
Author: Benoit TELLIER <bt...@linagora.com>
AuthorDate: Fri Feb 23 08:41:53 2024 +0100

    [FIX] More jmap logs (#2037)
---
 .../protocols/smtp/core/esmtp/AuthCmdHandler.java  |  2 +-
 .../apache/james/jmap/core/ProblemDetails.scala    |  5 +-
 .../jmap/method/DelegateSetCreatePerformer.scala   | 18 ++++++--
 .../jmap/method/DelegateSetDeletePerformer.scala   | 10 +++-
 .../method/DelegatedAccountDeletePerformer.scala   | 10 +++-
 .../james/jmap/method/EmailImportMethod.scala      | 23 +++++++--
 .../jmap/method/EmailSetCreatePerformer.scala      | 27 ++++++++---
 .../jmap/method/EmailSetDeletePerformer.scala      | 14 ++++--
 .../jmap/method/EmailSetUpdatePerformer.scala      | 23 +++++++--
 .../jmap/method/EmailSubmissionSetMethod.scala     | 43 +++++++++++------
 .../jmap/method/IdentitySetCreatePerformer.scala   | 18 ++++++--
 .../jmap/method/IdentitySetDeletePerformer.scala   | 14 ++++--
 .../jmap/method/IdentitySetUpdatePerformer.scala   | 22 +++++++--
 .../jmap/method/MailboxSetCreatePerformer.scala    | 26 ++++++++---
 .../jmap/method/MailboxSetDeletePerformer.scala    | 26 ++++++++---
 .../jmap/method/MailboxSetUpdatePerformer.scala    | 54 ++++++++++++++++------
 .../PushSubscriptionSetCreatePerformer.scala       | 22 +++++++--
 .../PushSubscriptionSetDeletePerformer.scala       | 10 +++-
 .../method/PushSubscriptionUpdatePerformer.scala   | 34 ++++++++++----
 .../jmap/method/VacationResponseSetMethod.scala    | 10 +++-
 20 files changed, 313 insertions(+), 98 deletions(-)

diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java
index 5921035393..0a993c29bd 100644
--- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java
+++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java
@@ -366,7 +366,7 @@ public class AuthCmdHandler
         }
 
         res = AUTH_FAILED;
-        LOGGER.error("DELEGATE failed from {}@{}", username, session.getRemoteAddress().getAddress().getHostAddress());
+        LOGGER.info("DELEGATE failed from {}@{}", username, session.getRemoteAddress().getAddress().getHostAddress());
         return res;
     }
 
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/ProblemDetails.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/ProblemDetails.scala
index 85c223d60a..fc75a52d72 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/ProblemDetails.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/core/ProblemDetails.scala
@@ -41,15 +41,18 @@ object ProblemDetails {
 
   def forThrowable(throwable: Throwable): ProblemDetails = throwable match {
     case exception: IllegalArgumentException =>
+      LOGGER.info("The request was successfully parsed as JSON but did not match the type signature of the Request object: {}", exception.getMessage)
       notRequestProblem(
         s"The request was successfully parsed as JSON but did not match the type signature of the Request object: ${exception.getMessage}")
     case e: UnauthorizedException =>
-      LOGGER.warn("Unauthorized", e)
+      LOGGER.info("Unauthorized", e)
       ProblemDetails(status = UNAUTHORIZED, detail = e.getMessage)
     case exception: JsonParseException =>
+      LOGGER.info("The content type of the request was not application/json or the request did not parse as I-JSON: {}", exception.getMessage)
       notJSONProblem(
         s"The content type of the request was not application/json or the request did not parse as I-JSON: ${exception.getMessage}")
     case exception: UnsupportedCapabilitiesException =>
+      LOGGER.info(s"The request used unsupported capabilities: ${exception.capabilities}")
       unknownCapabilityProblem(s"The request used unsupported capabilities: ${exception.capabilities}")
     case e =>
       LOGGER.error("Unexpected error upon API request", e)
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/DelegateSetCreatePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/DelegateSetCreatePerformer.scala
index 5da1111fcb..67755fff86 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/DelegateSetCreatePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/DelegateSetCreatePerformer.scala
@@ -31,10 +31,12 @@ import org.apache.james.mailbox.MailboxSession
 import org.apache.james.mailbox.exception.UserDoesNotExistException
 import org.apache.james.user.api.{DelegationStore, UsersRepository}
 import org.apache.james.util.AuditTrail
+import org.slf4j.LoggerFactory
 import play.api.libs.json.JsObject
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 object DelegateSetCreatePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[DelegateSetCreatePerformer])
   case class CreationResults(results: Seq[CreationResult]) {
     def created: Option[Map[DelegateCreationId, DelegateCreationResponse]] =
       Option(results.flatMap {
@@ -57,10 +59,18 @@ object DelegateSetCreatePerformer {
 
   case class CreationFailure(delegateCreationId: DelegateCreationId, e: Throwable) extends CreationResult {
     def asMessageSetError: SetError = e match {
-      case e: DelegateSetParseException => e.setError
-      case e: UserDoesNotExistException => SetError.invalidArguments(SetErrorDescription(e.getMessage))
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(e.getMessage))
-      case _ => SetError.serverFail(SetErrorDescription(e.getMessage))
+      case e: DelegateSetParseException =>
+        LOGGER.info("Error parsing a delegation request", e)
+        e.setError
+      case e: UserDoesNotExistException =>
+        LOGGER.info("Failed to create a delegation as the target user does not exist", e)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal arguments while creating a delegation", e)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage))
+      case _ =>
+        LOGGER.error("Failed to create a delegation", e)
+        SetError.serverFail(SetErrorDescription(e.getMessage))
     }
   }
 }
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/DelegateSetDeletePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/DelegateSetDeletePerformer.scala
index ed2b2657d7..690c8bb650 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/DelegateSetDeletePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/DelegateSetDeletePerformer.scala
@@ -29,17 +29,23 @@ import org.apache.james.jmap.method.DelegateSetDeletePerformer.{DelegateDeletion
 import org.apache.james.mailbox.MailboxSession
 import org.apache.james.user.api.DelegationStore
 import org.apache.james.util.{AuditTrail, ReactorUtils}
+import org.slf4j.LoggerFactory
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 object DelegateSetDeletePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[DelegateSetDeletePerformer])
   sealed trait DelegateDeletionResult
 
   case class DelegateDeletionSuccess(delegationId: DelegationId) extends DelegateDeletionResult
 
   case class DelegateDeletionFailure(unparsedDelegateId: UnparsedDelegateId, exception: Throwable) extends DelegateDeletionResult {
     def asSetError: SetError = exception match {
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(s"${unparsedDelegateId.id} is not a DelegationId: ${e.getMessage}"))
-      case _ => SetError.serverFail(SetErrorDescription(exception.getMessage))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal arguments while deleting a delegation", exception)
+        SetError.invalidArguments(SetErrorDescription(s"${unparsedDelegateId.id} is not a DelegationId: ${e.getMessage}"))
+      case _ =>
+        LOGGER.error("Failed to delete a delegation", exception)
+        SetError.serverFail(SetErrorDescription(exception.getMessage))
     }
   }
 
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/DelegatedAccountDeletePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/DelegatedAccountDeletePerformer.scala
index 7ca6a21687..5e95768f60 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/DelegatedAccountDeletePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/DelegatedAccountDeletePerformer.scala
@@ -29,17 +29,23 @@ import org.apache.james.jmap.method.DelegatedAccountDeletePerformer.{DelegatedAc
 import org.apache.james.mailbox.MailboxSession
 import org.apache.james.user.api.DelegationStore
 import org.apache.james.util.{AuditTrail, ReactorUtils}
+import org.slf4j.LoggerFactory
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 object DelegatedAccountDeletePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[DelegatedAccountDeletePerformer])
   sealed trait DelegatedAccountDeletionResult
 
   case class DelegatedAccountDeletionSuccess(delegationId: DelegationId) extends DelegatedAccountDeletionResult
 
   case class DelegatedAccountDeletionFailure(unparsedDelegateId: UnparsedDelegateId, exception: Throwable) extends DelegatedAccountDeletionResult {
     def asSetError: SetError = exception match {
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(s"${unparsedDelegateId.id} is not a DelegationId: ${e.getMessage}"))
-      case _ => SetError.serverFail(SetErrorDescription(exception.getMessage))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal arguments while deleting a delegation", exception)
+        SetError.invalidArguments(SetErrorDescription(s"${unparsedDelegateId.id} is not a DelegationId: ${e.getMessage}"))
+      case _ =>
+        LOGGER.error("Failed to delete a delegation", exception)
+        SetError.serverFail(SetErrorDescription(exception.getMessage))
     }
   }
 
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailImportMethod.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailImportMethod.scala
index 774b2bfbd5..7e00fc383d 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailImportMethod.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailImportMethod.scala
@@ -44,11 +44,14 @@ import org.apache.james.mime4j.message.DefaultMessageBuilder
 import org.apache.james.mime4j.stream.MimeConfig
 import org.apache.james.util.ReactorUtils
 import org.reactivestreams.Publisher
+import org.slf4j.LoggerFactory
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 import scala.util.{Try, Using}
 
 object EmailImportMethod {
+  private val LOGGER = LoggerFactory.getLogger(classOf[EmailImportMethod])
+
   case class ImportWithBlob(id: EmailCreationId, request: EmailImport, blob: Blob)
   case class ImportResults(results: Seq[ImportResult]) {
     def created: Option[Map[EmailCreationId, EmailCreationResponse]] =
@@ -71,11 +74,21 @@ object EmailImportMethod {
   case class ImportSuccess(clientId: EmailCreationId, response: EmailCreationResponse) extends ImportResult
   case class ImportFailure(clientId: EmailCreationId, e: Throwable) extends ImportResult {
     def asMessageSetError: SetError = e match {
-      case e: BlobNotFoundException => SetError.notFound(SetErrorDescription(s"Blob ${e.blobId} could not be found"))
-      case e: MailboxNotFoundException => SetError.notFound(SetErrorDescription("Mailbox " + e.getMessage))
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(e.getMessage))
-      case e: OverQuotaException => SetError.overQuota(SetErrorDescription(e.getMessage))
-      case _ => SetError.serverFail(SetErrorDescription(e.getMessage))
+      case e: BlobNotFoundException =>
+        LOGGER.info(s"Could not import email as ${e.blobId} is not found")
+        SetError.notFound(SetErrorDescription(s"Blob ${e.blobId} could not be found"))
+      case e: MailboxNotFoundException =>
+        LOGGER.info(s"Could not import email as Mailbox ${e.getMessage} is not found")
+        SetError.notFound(SetErrorDescription("Mailbox " + e.getMessage))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal arguments while importing email", e)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage))
+      case e: OverQuotaException =>
+        LOGGER.info(s"Could not import email as the user is overquota", e)
+        SetError.overQuota(SetErrorDescription(e.getMessage))
+      case _ =>
+        LOGGER.error("Failed to import email", e)
+        SetError.serverFail(SetErrorDescription(e.getMessage))
     }
   }
 }
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetCreatePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetCreatePerformer.scala
index 74009e04a7..8a8361fd43 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetCreatePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetCreatePerformer.scala
@@ -40,11 +40,14 @@ import org.apache.james.mailbox.{MailboxManager, MailboxSession}
 import org.apache.james.mime4j.dom.Message
 import org.apache.james.util.ReactorUtils
 import org.apache.james.util.html.HtmlTextExtractor
+import org.slf4j.LoggerFactory
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 import scala.jdk.OptionConverters._
 
 object EmailSetCreatePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[EmailSetCreatePerformer])
+
   case class CreationResults(results: Seq[CreationResult]) {
     def created: Option[Map[EmailCreationId, EmailCreationResponse]] =
       Option(results.flatMap{
@@ -66,12 +69,24 @@ object EmailSetCreatePerformer {
   case class CreationSuccess(clientId: EmailCreationId, response: EmailCreationResponse) extends CreationResult
   case class CreationFailure(clientId: EmailCreationId, e: Throwable) extends CreationResult {
     def asMessageSetError: SetError = e match {
-      case e: MailboxNotFoundException => SetError.notFound(SetErrorDescription("Mailbox " + e.getMessage))
-      case e: BlobNotFoundException => SetError.invalidArguments(SetErrorDescription(s"Attachment not found: ${e.blobId.value}"), Some(Properties("attachments")))
-      case e: SizeExceededException => SetError.tooLarge(SetErrorDescription(e.getMessage))
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(e.getMessage))
-      case e: OverQuotaException => SetError.overQuota(SetErrorDescription(e.getMessage))
-      case _ => SetError.serverFail(SetErrorDescription(e.getMessage))
+      case e: MailboxNotFoundException =>
+        LOGGER.info(s"Mailbox ${e.getMessage}")
+        SetError.notFound(SetErrorDescription("Mailbox " + e.getMessage))
+      case e: BlobNotFoundException =>
+        LOGGER.info(s"Attachment not found: ${e.blobId.value}")
+        SetError.invalidArguments(SetErrorDescription(s"Attachment not found: ${e.blobId.value}"), Some(Properties("attachments")))
+      case e: SizeExceededException =>
+        LOGGER.info("Attempt to create too big of a message")
+        SetError.tooLarge(SetErrorDescription(e.getMessage))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal argument in Email/set create", e)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage))
+      case e: OverQuotaException =>
+        LOGGER.info("Email/set failed because overquota")
+        SetError.overQuota(SetErrorDescription(e.getMessage))
+      case _ =>
+        LOGGER.error("Email/set failed to create a message", e)
+        SetError.serverFail(SetErrorDescription(e.getMessage))
     }
   }
 }
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetDeletePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetDeletePerformer.scala
index 8bacc21626..871ddd9572 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetDeletePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetDeletePerformer.scala
@@ -29,12 +29,14 @@ import org.apache.james.jmap.method.EmailSetDeletePerformer.{DestroyFailure, Des
 import org.apache.james.mailbox.model.{DeleteResult, MessageId}
 import org.apache.james.mailbox.{MailboxSession, MessageIdManager}
 import org.apache.james.util.AuditTrail
+import org.slf4j.LoggerFactory
 import reactor.core.scala.publisher.SMono
 
 import scala.jdk.CollectionConverters._
 import scala.jdk.OptionConverters._
 
 object EmailSetDeletePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[EmailSetDeletePerformer])
   case class DestroyResults(results: Seq[DestroyResult]) {
     def destroyed: Option[DestroyIds] =
       Option(results.flatMap{
@@ -65,9 +67,15 @@ object EmailSetDeletePerformer {
   case class DestroySuccess(messageId: MessageId) extends DestroyResult
   case class DestroyFailure(unparsedMessageId: UnparsedMessageId, e: Throwable) extends DestroyResult {
     def asMessageSetError: SetError = e match {
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(s"$unparsedMessageId is not a messageId: ${e.getMessage}"))
-      case e: MessageNotFoundException => SetError.notFound(SetErrorDescription(s"Cannot find message with messageId: ${e.messageId.serialize()}"))
-      case _ => SetError.serverFail(SetErrorDescription(e.getMessage))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal arguments while deleting email", e)
+        SetError.invalidArguments(SetErrorDescription(s"$unparsedMessageId is not a messageId: ${e.getMessage}"))
+      case e: MessageNotFoundException =>
+        LOGGER.info(s"Could not delete ${e.messageId.serialize()} as it was not found", e)
+        SetError.notFound(SetErrorDescription(s"Cannot find message with messageId: ${e.messageId.serialize()}"))
+      case _ =>
+        LOGGER.error("Failed to delete email", e)
+        SetError.serverFail(SetErrorDescription(e.getMessage))
     }
   }
 }
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetUpdatePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetUpdatePerformer.scala
index aead67e3b3..c2d83b6c4d 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetUpdatePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSetUpdatePerformer.scala
@@ -27,26 +27,39 @@ import org.apache.james.jmap.core.SetError.SetErrorDescription
 import org.apache.james.jmap.json.EmailSetSerializer
 import org.apache.james.jmap.mail.KeywordsFactory.LENIENT_KEYWORDS_FACTORY
 import org.apache.james.jmap.mail.{EmailSet, EmailSetRequest, MailboxIds, UnparsedMessageId, ValidatedEmailSetUpdate}
+import org.apache.james.jmap.method.EmailSetCreatePerformer.LOGGER
 import org.apache.james.jmap.method.EmailSetUpdatePerformer.{EmailUpdateFailure, EmailUpdateResult, EmailUpdateResults, EmailUpdateSuccess}
 import org.apache.james.mailbox.MessageManager.FlagsUpdateMode
 import org.apache.james.mailbox.exception.{MailboxNotFoundException, OverQuotaException}
 import org.apache.james.mailbox.model.{ComposedMessageIdWithMetaData, MailboxId, MessageId, MessageRange}
 import org.apache.james.mailbox.{MailboxManager, MailboxSession, MessageIdManager, MessageManager}
+import org.slf4j.LoggerFactory
 import play.api.libs.json.JsObject
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 import scala.jdk.CollectionConverters._
 
 object EmailSetUpdatePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[EmailSetUpdatePerformer])
   trait EmailUpdateResult
   case class EmailUpdateSuccess(messageId: MessageId) extends EmailUpdateResult
   case class EmailUpdateFailure(unparsedMessageId: UnparsedMessageId, e: Throwable) extends EmailUpdateResult {
     def asMessageSetError: SetError = e match {
-      case e: IllegalArgumentException => SetError.invalidPatch(SetErrorDescription(s"Message update is invalid: ${e.getMessage}"))
-      case _: MailboxNotFoundException => SetError.notFound(SetErrorDescription(s"Mailbox not found"))
-      case e: MessageNotFoundException => SetError.notFound(SetErrorDescription(s"Cannot find message with messageId: ${e.messageId.serialize()}"))
-      case e: OverQuotaException => SetError.overQuota(SetErrorDescription(e.getMessage))
-      case _ => SetError.serverFail(SetErrorDescription(e.getMessage))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal argument in Email/set update", e)
+        SetError.invalidPatch(SetErrorDescription(s"Message update is invalid: ${e.getMessage}"))
+      case e: MailboxNotFoundException =>
+        LOGGER.info("Mailbox not found in Email/set update", e)
+        SetError.notFound(SetErrorDescription(s"Mailbox not found"))
+      case e: MessageNotFoundException =>
+        LOGGER.info(s"Message not found in Email/set update: ${e.messageId.serialize()}")
+        SetError.notFound(SetErrorDescription(s"Cannot find message with messageId: ${e.messageId.serialize()}"))
+      case e: OverQuotaException =>
+        LOGGER.info(s"Overquota in email set update")
+        SetError.overQuota(SetErrorDescription(e.getMessage))
+      case _ =>
+        LOGGER.error("Failed to update email", e)
+        SetError.serverFail(SetErrorDescription(e.getMessage))
     }
   }
   case class EmailUpdateResults(results: Seq[EmailUpdateResult]) {
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSubmissionSetMethod.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSubmissionSetMethod.scala
index 3fdbfc5633..63749f2bf5 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSubmissionSetMethod.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/EmailSubmissionSetMethod.scala
@@ -82,21 +82,35 @@ object EmailSubmissionSetMethod {
                              messageId: MessageId) extends CreationResult
   case class CreationFailure(emailSubmissionCreationId: EmailSubmissionCreationId, exception: Throwable) extends CreationResult {
     def asSetError: SetError = exception match {
-      case e: EmailSubmissionCreationParseException => e.setError
-      case _: NoRecipientException => SetError(EmailSubmissionSetMethod.noRecipients,
-        SetErrorDescription("Attempt to send a mail with no recipients"), None)
-      case e: ForbiddenMailFromException => SetError(EmailSubmissionSetMethod.forbiddenMailFrom,
-        SetErrorDescription(s"Attempt to send a mail whose MimeMessage From and Sender fields not allowed for connected user: ${e.from}"), None)
-      case e: ForbiddenFromException => SetError(EmailSubmissionSetMethod.forbiddenFrom,
-        SetErrorDescription(s"Attempt to send a mail whose envelope From not allowed for connected user: ${e.from}"),
-        Some(Properties("envelope.mailFrom")))
-      case _: MessageNotFoundException => SetError(SetError.invalidArgumentValue,
-        SetErrorDescription("The email to be sent cannot be found"),
-        Some(Properties("emailId")))
-      case e: DateTimeParseException => SetError.invalidArguments(SetErrorDescription(e.getMessage))
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(e.getMessage))
+      case e: EmailSubmissionCreationParseException =>
+        LOGGER.info("Failed to parse EMailSubmission/set create", e)
+        e.setError
+      case _: NoRecipientException =>
+        LOGGER.info("Attempt to send a mail with no recipients")
+        SetError(EmailSubmissionSetMethod.noRecipients,
+          SetErrorDescription("Attempt to send a mail with no recipients"), None)
+      case e: ForbiddenMailFromException =>
+        LOGGER.warn(s"Attempt to send a mail whose MimeMessage From and Sender fields not allowed for connected user: ${e.from}")
+        SetError(EmailSubmissionSetMethod.forbiddenMailFrom,
+          SetErrorDescription(s"Attempt to send a mail whose MimeMessage From and Sender fields not allowed for connected user: ${e.from}"), None)
+      case e: ForbiddenFromException =>
+        LOGGER.warn(s"Attempt to send a mail whose envelope From not allowed for connected user: ${e.from}")
+        SetError(EmailSubmissionSetMethod.forbiddenFrom,
+          SetErrorDescription(s"Attempt to send a mail whose envelope From not allowed for connected user: ${e.from}"),
+          Some(Properties("envelope.mailFrom")))
+      case _: MessageNotFoundException =>
+        LOGGER.info(" EmailSubmission/set failed as the underlying email could not be found")
+        SetError(SetError.invalidArgumentValue,
+          SetErrorDescription("The email to be sent cannot be found"),
+          Some(Properties("emailId")))
+      case e: DateTimeParseException =>
+        LOGGER.info("Failed to parse date time", e)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal argument in EmailSubmission/set", e)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage))
       case e: Exception =>
-        e.printStackTrace()
+        LOGGER.error("Failed to send an email with EmailSubmission/set", e)
         SetError.serverFail(SetErrorDescription(exception.getMessage))
     }
   }
@@ -109,7 +123,6 @@ object EmailSubmissionSetMethod {
       .toMap
       .map(creation => (creation._1, creation._2))
 
-
     def retrieveErrors: Map[EmailSubmissionCreationId, SetError] = created
       .flatMap {
         case failure: CreationFailure => Some(failure.emailSubmissionCreationId, failure.asSetError)
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/IdentitySetCreatePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/IdentitySetCreatePerformer.scala
index 6a90c51c0d..5ca63b9550 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/IdentitySetCreatePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/IdentitySetCreatePerformer.scala
@@ -30,10 +30,12 @@ import org.apache.james.jmap.mail.{IdentityCreationId, IdentityCreationResponse,
 import org.apache.james.jmap.method.IdentitySetCreatePerformer.{CreationFailure, CreationResult, CreationResults, CreationSuccess}
 import org.apache.james.mailbox.MailboxSession
 import org.apache.james.util.ReactorUtils
+import org.slf4j.LoggerFactory
 import play.api.libs.json.JsObject
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 object IdentitySetCreatePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[IdentitySetCreatePerformer])
   case class CreationResults(results: Seq[CreationResult]) {
     def created: Option[Map[IdentityCreationId, IdentityCreationResponse]] =
       Option(results.flatMap {
@@ -57,10 +59,18 @@ object IdentitySetCreatePerformer {
 
   case class CreationFailure(clientId: IdentityCreationId, e: Throwable) extends CreationResult {
     def asMessageSetError: SetError = e match {
-      case e: IdentitySetParseException => e.setError
-      case e: ForbiddenSendFromException => SetError.forbiddenFrom(SetErrorDescription(e.getMessage))
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(e.getMessage))
-      case _ => SetError.serverFail(SetErrorDescription(e.getMessage))
+      case e: IdentitySetParseException =>
+        LOGGER.info("Failure to parse Identity/set create", e)
+        e.setError
+      case e: ForbiddenSendFromException =>
+        LOGGER.warn(s"Attempt to send an identity whose From field not allowed for connected user: ${e.mailAddress}")
+        SetError.forbiddenFrom(SetErrorDescription(e.getMessage))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal argument in Identity/set create", e)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage))
+      case _ =>
+        LOGGER.error("Failed to create identity", e)
+        SetError.serverFail(SetErrorDescription(e.getMessage))
     }
   }
 }
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/IdentitySetDeletePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/IdentitySetDeletePerformer.scala
index c26171bf7a..dcf5d831b5 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/IdentitySetDeletePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/IdentitySetDeletePerformer.scala
@@ -27,16 +27,24 @@ import org.apache.james.jmap.core.SetError.SetErrorDescription
 import org.apache.james.jmap.mail.{IdentitySetRequest, UnparsedIdentityId}
 import org.apache.james.jmap.method.IdentitySetDeletePerformer.{IdentityDeletionFailure, IdentityDeletionResult, IdentityDeletionResults, IdentityDeletionSuccess}
 import org.apache.james.mailbox.MailboxSession
+import org.slf4j.LoggerFactory
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 object IdentitySetDeletePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[IdentitySetDeletePerformer])
   sealed trait IdentityDeletionResult
   case class IdentityDeletionSuccess(identityId: IdentityId) extends IdentityDeletionResult
   case class IdentityDeletionFailure(identityId: UnparsedIdentityId, exception: Throwable) extends IdentityDeletionResult {
     def asIdentitySetError: SetError = exception match {
-      case e: IdentityForbiddenDeleteException => SetError.forbidden(SetErrorDescription(e.getMessage))
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(s"${identityId.id} is not a IdentityId: ${e.getMessage}"))
-      case _ => SetError.serverFail(SetErrorDescription(exception.getMessage))
+      case e: IdentityForbiddenDeleteException =>
+        LOGGER.info("Forbidden to delete server set identity")
+        SetError.forbidden(SetErrorDescription(e.getMessage))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal argument in Identity/set delete", e)
+        SetError.invalidArguments(SetErrorDescription(s"${identityId.id} is not a IdentityId: ${e.getMessage}"))
+      case e =>
+        LOGGER.error("Failed to delete identity", e)
+        SetError.serverFail(SetErrorDescription(exception.getMessage))
     }
   }
   case class IdentityDeletionResults(results: Seq[IdentityDeletionResult]) {
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/IdentitySetUpdatePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/IdentitySetUpdatePerformer.scala
index 3a5fb53b0b..575d00e8f7 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/IdentitySetUpdatePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/IdentitySetUpdatePerformer.scala
@@ -29,21 +29,33 @@ import org.apache.james.jmap.mail.{IdentitySet, IdentitySetParseException, Ident
 import org.apache.james.jmap.method.IdentitySetUpdatePerformer.IdentityUpdate.{knownProperties, serverSetProperty}
 import org.apache.james.jmap.method.IdentitySetUpdatePerformer.{IdentitySetUpdateResults, UpdateFailure, UpdateResult, UpdateSuccess}
 import org.apache.james.mailbox.MailboxSession
+import org.slf4j.LoggerFactory
 import play.api.libs.json.{JsObject, JsValue}
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 object IdentitySetUpdatePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[IdentitySetUpdatePerformer])
   sealed trait UpdateResult
 
   case class UpdateSuccess(id: IdentityId) extends UpdateResult
 
   case class UpdateFailure(id: UnparsedIdentityId, exception: Throwable) extends UpdateResult {
     def asSetError: SetError = exception match {
-      case e: IdentitySetParseException => e.setError
-      case e: IdentityNotFoundException => SetError.notFound(SetErrorDescription(e.getMessage))
-      case e: InvalidPropertyException => SetError.invalidPatch(SetErrorDescription(e.getCause.getMessage))
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(e.getMessage), None)
-      case _ => SetError.serverFail(SetErrorDescription(exception.getMessage))
+      case e: IdentitySetParseException =>
+        LOGGER.info("Error parsing Identity/set update", e)
+        e.setError
+      case e: IdentityNotFoundException =>
+        LOGGER.info("Identity not found in Identity/set update {}", e.getMessage)
+        SetError.notFound(SetErrorDescription(e.getMessage))
+      case e: InvalidPropertyException =>
+        LOGGER.info("Invalid property in Identity/set update {}", e.getCause.getMessage)
+        SetError.invalidPatch(SetErrorDescription(e.getCause.getMessage))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal argument in Identity/set update", e)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage), None)
+      case e =>
+        LOGGER.error("Failed to delete identity", e)
+        SetError.serverFail(SetErrorDescription(exception.getMessage))
     }
   }
 
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetCreatePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetCreatePerformer.scala
index 8e2f9c4b4b..5aae0b99d4 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetCreatePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetCreatePerformer.scala
@@ -33,24 +33,38 @@ import org.apache.james.mailbox.model.{MailboxId, MailboxPath}
 import org.apache.james.mailbox.{MailboxManager, MailboxSession, SubscriptionManager}
 import org.apache.james.metrics.api.MetricFactory
 import org.apache.james.util.ReactorUtils
+import org.slf4j.LoggerFactory
 import play.api.libs.json.{JsError, JsObject, JsPath, JsSuccess, Json, JsonValidationError}
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 import scala.util.Try
 
 object MailboxSetCreatePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[EmailSetCreatePerformer])
   sealed trait MailboxCreationResult {
     def mailboxCreationId: MailboxCreationId
   }
   case class MailboxCreationSuccess(mailboxCreationId: MailboxCreationId, mailboxCreationResponse: MailboxCreationResponse) extends MailboxCreationResult
   case class MailboxCreationFailure(mailboxCreationId: MailboxCreationId, exception: Exception) extends MailboxCreationResult {
     def asMailboxSetError: SetError = exception match {
-      case e: MailboxNotFoundException => SetError.invalidArguments(SetErrorDescription(e.getMessage), Some(Properties("parentId")))
-      case e: MailboxExistsException => SetError.invalidArguments(SetErrorDescription(e.getMessage), Some(Properties("name")))
-      case e: MailboxNameException => SetError.invalidArguments(SetErrorDescription(e.getMessage), Some(Properties("name")))
-      case e: MailboxCreationParseException => e.setError
-      case _: InsufficientRightsException => SetError.forbidden(SetErrorDescription("Insufficient rights"), Some(Properties("parentId")))
-      case _ => SetError.serverFail(SetErrorDescription(exception.getMessage))
+      case e: MailboxNotFoundException =>
+        LOGGER.info("Can't create mailbox: Mailbox not found: {}", e.getMessage)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage), Some(Properties("parentId")))
+      case e: MailboxExistsException =>
+        LOGGER.info("Mailbox already exists: {}", e.getMailboxName)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage), Some(Properties("name")))
+      case e: MailboxNameException =>
+        LOGGER.info("Invalid mailbox name: {}", e.getMessage)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage), Some(Properties("name")))
+      case e: MailboxCreationParseException =>
+        LOGGER.info("Failed to parse mailbox creation request", e)
+        e.setError
+      case e: InsufficientRightsException =>
+        LOGGER.info("Insufficient rights to create a mailbox", e)
+        SetError.forbidden(SetErrorDescription("Insufficient rights"), Some(Properties("parentId")))
+      case e =>
+        LOGGER.error("Failed to create mailbox", e)
+        SetError.serverFail(SetErrorDescription(exception.getMessage))
     }
   }
   case class MailboxCreationResults(created: Seq[MailboxCreationResult]) {
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetDeletePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetDeletePerformer.scala
index af997b1926..c6b26d68f1 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetDeletePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetDeletePerformer.scala
@@ -27,20 +27,34 @@ import org.apache.james.jmap.method.MailboxSetDeletePerformer.{MailboxDeletionFa
 import org.apache.james.mailbox.exception.MailboxNotFoundException
 import org.apache.james.mailbox.model.{FetchGroup, MailboxId, MessageRange}
 import org.apache.james.mailbox.{MailboxManager, MailboxSession, MessageManager, Role, SubscriptionManager}
+import org.slf4j.LoggerFactory
 import reactor.core.publisher.SynchronousSink
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 object MailboxSetDeletePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[MailboxSetDeletePerformer])
   sealed trait MailboxDeletionResult
   case class MailboxDeletionSuccess(mailboxId: MailboxId) extends MailboxDeletionResult
   case class MailboxDeletionFailure(mailboxId: UnparsedMailboxId, exception: Throwable) extends MailboxDeletionResult {
     def asMailboxSetError: SetError = exception match {
-      case e: MailboxNotFoundException => SetError.notFound(SetErrorDescription(e.getMessage))
-      case e: MailboxHasMailException => MailboxSetError.mailboxHasEmail(SetErrorDescription(s"${e.mailboxId.serialize} is not empty"))
-      case e: MailboxHasChildException => MailboxSetError.mailboxHasChild(SetErrorDescription(s"${e.mailboxId.serialize} has child mailboxes"))
-      case e: SystemMailboxChangeException => SetError.invalidArguments(SetErrorDescription("System mailboxes cannot be destroyed"))
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(s"${mailboxId.id} is not a mailboxId: ${e.getMessage}"))
-      case _ => SetError.serverFail(SetErrorDescription(exception.getMessage))
+      case e: MailboxNotFoundException =>
+        LOGGER.info("Attempt to delete a non existing mailbox: {}", e.getMessage)
+        SetError.notFound(SetErrorDescription(e.getMessage))
+      case e: MailboxHasMailException =>
+        LOGGER.info("Attempt to delete a mailbox with mails")
+        MailboxSetError.mailboxHasEmail(SetErrorDescription(s"${e.mailboxId.serialize} is not empty"))
+      case e: MailboxHasChildException =>
+        LOGGER.info("Attempt to delete a mailbox with children")
+        MailboxSetError.mailboxHasChild(SetErrorDescription(s"${e.mailboxId.serialize} has child mailboxes"))
+      case e: SystemMailboxChangeException =>
+        LOGGER.info("Attempt to delete a system folder")
+        SetError.invalidArguments(SetErrorDescription("System mailboxes cannot be destroyed"))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal argument in Mailbox/set delete", e)
+        SetError.invalidArguments(SetErrorDescription(s"${mailboxId.id} is not a mailboxId: ${e.getMessage}"))
+      case e =>
+        LOGGER.error("Failed to delete mailbox", e)
+        SetError.serverFail(SetErrorDescription(exception.getMessage))
     }
   }
   case class MailboxDeletionResults(results: Seq[MailboxDeletionResult]) {
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala
index 4af54ec8af..9077a5da10 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/MailboxSetUpdatePerformer.scala
@@ -34,12 +34,14 @@ import org.apache.james.mailbox.model.search.{MailboxQuery, PrefixedWildcard}
 import org.apache.james.mailbox.model.{MailboxId, MailboxPath}
 import org.apache.james.mailbox.{MailboxManager, MailboxSession, MessageManager, Role, SubscriptionManager}
 import org.apache.james.util.{AuditTrail, ReactorUtils}
+import org.slf4j.LoggerFactory
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 import scala.jdk.CollectionConverters._
 import scala.jdk.OptionConverters._
 
 object MailboxSetUpdatePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[MailboxSetUpdatePerformer])
 
   sealed trait MailboxUpdateResult
   case class MailboxUpdateSuccess(mailboxId: MailboxId) extends MailboxUpdateResult
@@ -49,19 +51,45 @@ object MailboxSetUpdatePerformer {
       .getOrElse(acceptableProperties))
 
     def asMailboxSetError: SetError = exception match {
-      case e: MailboxNotFoundException => SetError.notFound(SetErrorDescription(e.getMessage))
-      case e: MailboxNameException => SetError.invalidArguments(SetErrorDescription(e.getMessage), filter(Properties("name", "parentId")))
-      case e: MailboxExistsException => SetError.invalidArguments(SetErrorDescription(e.getMessage), filter(Properties("name", "parentId")))
-      case e: UnsupportedPropertyUpdatedException => SetError.invalidArguments(SetErrorDescription(s"${e.property} property do not exist thus cannot be updated"), Some(Properties(e.property)))
-      case e: InvalidUpdateException => SetError.invalidArguments(SetErrorDescription(s"${e.cause}"), Some(Properties(e.property)))
-      case e: ServerSetPropertyException => SetError.invalidArguments(SetErrorDescription("Can not modify server-set properties"), Some(Properties(e.property)))
-      case e: InvalidPropertyException => SetError.invalidPatch(SetErrorDescription(s"${e.cause}"))
-      case e: InvalidPatchException => SetError.invalidPatch(SetErrorDescription(s"${e.cause}"))
-      case e: SystemMailboxChangeException => SetError.invalidArguments(SetErrorDescription("Invalid change to a system mailbox"), filter(Properties("name", "parentId")))
-      case e: LoopInMailboxGraphException => SetError.invalidArguments(SetErrorDescription("A mailbox parentId property can not be set to itself or one of its child"), Some(Properties("parentId")))
-      case e: InsufficientRightsException => SetError.invalidArguments(SetErrorDescription("Invalid change to a delegated mailbox"))
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(e.getMessage), None)
-      case _ => SetError.serverFail(SetErrorDescription(exception.getMessage))
+      case e: MailboxNotFoundException =>
+        LOGGER.info("Can't update mailbox: Mailbox not found: {}", e.getMessage)
+        SetError.notFound(SetErrorDescription(e.getMessage))
+      case e: MailboxNameException =>
+        LOGGER.info("Invalid mailbox name: {}", e.getMessage)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage), filter(Properties("name", "parentId")))
+      case e: MailboxExistsException =>
+        LOGGER.info("Mailbox already exists: {}", e.getMessage)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage), filter(Properties("name", "parentId")))
+      case e: UnsupportedPropertyUpdatedException =>
+        LOGGER.info("Unsupported properties in Mailbox/set update: {}", e.getMessage)
+        SetError.invalidArguments(SetErrorDescription(s"${e.property} property do not exist thus cannot be updated"), Some(Properties(e.property)))
+      case e: InvalidUpdateException =>
+        LOGGER.info("Invalid update in Mailbox/set update: {}", e.getMessage)
+        SetError.invalidArguments(SetErrorDescription(s"${e.cause}"), Some(Properties(e.property)))
+      case e: ServerSetPropertyException =>
+        LOGGER.info("Unsupported server-set properties in Mailbox/set update: {}", e.getMessage)
+        SetError.invalidArguments(SetErrorDescription("Can not modify server-set properties"), Some(Properties(e.property)))
+      case e: InvalidPropertyException =>
+        LOGGER.info("Invalid properties in Mailbox/set update: {}", e.getMessage)
+        SetError.invalidPatch(SetErrorDescription(s"${e.cause}"))
+      case e: InvalidPatchException =>
+        LOGGER.info("Unsupported patch in Mailbox/set update: {}", e.getMessage)
+        SetError.invalidPatch(SetErrorDescription(s"${e.cause}"))
+      case e: SystemMailboxChangeException =>
+        LOGGER.info("Attempt to update a system mailbox was rejected: {}", e.getMessage)
+        SetError.invalidArguments(SetErrorDescription("Invalid change to a system mailbox"), filter(Properties("name", "parentId")))
+      case e: LoopInMailboxGraphException =>
+        LOGGER.info("Attempt to create a loop in mailbox graph was rejected: {}", e.getMessage)
+        SetError.invalidArguments(SetErrorDescription("A mailbox parentId property can not be set to itself or one of its child"), Some(Properties("parentId")))
+      case e: InsufficientRightsException =>
+        LOGGER.info("Attempt to create a mailbox while having insufficient rights was rejected: {}", e.getMessage)
+        SetError.invalidArguments(SetErrorDescription("Invalid change to a delegated mailbox"))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal argument in Mailbox/set update", e)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage), None)
+      case e =>
+        LOGGER.error("Failed to update mailbox", e)
+        SetError.serverFail(SetErrorDescription(e.getMessage))
     }
   }
   case class MailboxUpdateResults(results: Seq[MailboxUpdateResult]) {
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/PushSubscriptionSetCreatePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/PushSubscriptionSetCreatePerformer.scala
index 4365fc21bc..944ba62ac4 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/PushSubscriptionSetCreatePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/PushSubscriptionSetCreatePerformer.scala
@@ -12,21 +12,33 @@ import org.apache.james.jmap.json.{PushSerializer, PushSubscriptionSerializer}
 import org.apache.james.jmap.method.PushSubscriptionSetCreatePerformer.{CreationFailure, CreationResult, CreationResults, CreationSuccess}
 import org.apache.james.jmap.pushsubscription.{PushRequest, PushTTL, WebPushClient}
 import org.apache.james.mailbox.MailboxSession
+import org.slf4j.LoggerFactory
 import play.api.libs.json.{JsObject, JsPath, Json, JsonValidationError}
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 object PushSubscriptionSetCreatePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[PushSubscriptionSetCreatePerformer])
   trait CreationResult
 
   case class CreationSuccess(clientId: PushSubscriptionCreationId, response: PushSubscriptionCreationResponse) extends CreationResult
 
   case class CreationFailure(clientId: PushSubscriptionCreationId, e: Throwable) extends CreationResult {
     def asMessageSetError: SetError = e match {
-      case e: PushSubscriptionCreationParseException => e.setError
-      case e: ExpireTimeInvalidException => SetError.invalidArguments(SetErrorDescription(e.getMessage), Some(Properties("expires")))
-      case e: DeviceClientIdInvalidException => SetError.invalidArguments(SetErrorDescription(e.getMessage))
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(e.getMessage))
-      case _ => SetError.serverFail(SetErrorDescription(e.getMessage))
+      case e: PushSubscriptionCreationParseException =>
+        LOGGER.info("Failure to parse PushSubscription/set create", e)
+        e.setError
+      case e: ExpireTimeInvalidException =>
+        LOGGER.info("Invalid time expiracy for push subscription: {}", e.getMessage)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage), Some(Properties("expires")))
+      case e: DeviceClientIdInvalidException =>
+        LOGGER.info("Invalid deviceId for push subscription: {}", e.getMessage)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal argument in PushSubscription/set create", e)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage))
+      case e =>
+        LOGGER.error("Failed to create push subscription", e)
+        SetError.serverFail(SetErrorDescription(e.getMessage))
     }
   }
 
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/PushSubscriptionSetDeletePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/PushSubscriptionSetDeletePerformer.scala
index cdd95b209c..3c878f0d58 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/PushSubscriptionSetDeletePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/PushSubscriptionSetDeletePerformer.scala
@@ -26,15 +26,21 @@ import org.apache.james.jmap.core.SetError.SetErrorDescription
 import org.apache.james.jmap.core.{PushSubscriptionSetRequest, SetError, UnparsedPushSubscriptionId}
 import org.apache.james.jmap.method.PushSubscriptionSetDeletePerformer.{PushSubscriptionDeletionFailure, PushSubscriptionDeletionResult, PushSubscriptionDeletionResults, PushSubscriptionDeletionSuccess}
 import org.apache.james.mailbox.MailboxSession
+import org.slf4j.LoggerFactory
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 object PushSubscriptionSetDeletePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[PushSubscriptionSetDeletePerformer])
   sealed trait PushSubscriptionDeletionResult
   case class PushSubscriptionDeletionSuccess(PushSubscriptionId: PushSubscriptionId) extends PushSubscriptionDeletionResult
   case class PushSubscriptionDeletionFailure(PushSubscriptionId: UnparsedPushSubscriptionId, exception: Throwable) extends PushSubscriptionDeletionResult {
     def asPushSubscriptionSetError: SetError = exception match {
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(s"${PushSubscriptionId.id} is not a PushSubscriptionId: ${e.getMessage}"))
-      case _ => SetError.serverFail(SetErrorDescription(exception.getMessage))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal argument in PushSubscription/set delete", e)
+        SetError.invalidArguments(SetErrorDescription(s"${PushSubscriptionId.id} is not a PushSubscriptionId: ${e.getMessage}"))
+      case e =>
+        LOGGER.error("Failed to delete Push subscription", e)
+        SetError.serverFail(SetErrorDescription(exception.getMessage))
     }
   }
   case class PushSubscriptionDeletionResults(results: Seq[PushSubscriptionDeletionResult]) {
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/PushSubscriptionUpdatePerformer.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/PushSubscriptionUpdatePerformer.scala
index 49fd7e6ff3..5185ac9ff9 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/PushSubscriptionUpdatePerformer.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/PushSubscriptionUpdatePerformer.scala
@@ -30,24 +30,42 @@ import org.apache.james.jmap.core.{Properties, PushSubscriptionPatchObject, Push
 import org.apache.james.jmap.mail.{InvalidPropertyException, InvalidUpdateException, UnsupportedPropertyUpdatedException}
 import org.apache.james.jmap.method.PushSubscriptionSetUpdatePerformer.{PushSubscriptionUpdateFailure, PushSubscriptionUpdateResult, PushSubscriptionUpdateResults, PushSubscriptionUpdateSuccess, WrongVerificationCodeException}
 import org.apache.james.mailbox.MailboxSession
+import org.slf4j.LoggerFactory
 import reactor.core.scala.publisher.{SFlux, SMono}
 
 import scala.jdk.CollectionConverters._
 
 object PushSubscriptionSetUpdatePerformer {
+  private val LOGGER = LoggerFactory.getLogger(classOf[PushSubscriptionUpdatePerformer])
   case class WrongVerificationCodeException() extends RuntimeException()
   sealed trait PushSubscriptionUpdateResult
   case class PushSubscriptionUpdateSuccess(id: PushSubscriptionId, serverExpires: Option[UTCDate] = None) extends PushSubscriptionUpdateResult
   case class PushSubscriptionUpdateFailure(id: UnparsedPushSubscriptionId, exception: Throwable) extends PushSubscriptionUpdateResult {
     def asSetError: SetError = exception match {
-      case _: WrongVerificationCodeException => SetError.invalidProperties(SetErrorDescription("Wrong verification code"), Some(Properties("verificationCode")))
-      case e: UnsupportedPropertyUpdatedException => SetError.invalidArguments(SetErrorDescription(s"${e.property} property do not exist thus cannot be updated"), Some(Properties(e.property)))
-      case e: InvalidPropertyException => SetError.invalidPatch(SetErrorDescription(s"${e.cause}"))
-      case e: InvalidUpdateException => SetError.invalidArguments(SetErrorDescription(s"${e.cause}"), Some(Properties(e.property)))
-      case e: IllegalArgumentException => SetError.invalidArguments(SetErrorDescription(e.getMessage), None)
-      case e: PushSubscriptionNotFoundException => SetError.notFound(SetErrorDescription(e.getMessage))
-      case e: ExpireTimeInvalidException => SetError.invalidArguments(SetErrorDescription(e.getMessage), Some(Properties("expires")))
-      case _ => SetError.serverFail(SetErrorDescription(exception.getMessage))
+      case _: WrongVerificationCodeException =>
+        LOGGER.info("Invalid verification code")
+        SetError.invalidProperties(SetErrorDescription("Wrong verification code"), Some(Properties("verificationCode")))
+      case e: UnsupportedPropertyUpdatedException =>
+        LOGGER.info("Invalid property in PushSubscription/set update", e)
+        SetError.invalidArguments(SetErrorDescription(s"${e.property} property do not exist thus cannot be updated"), Some(Properties(e.property)))
+      case e: InvalidPropertyException =>
+        LOGGER.info("Invalid property in PushSubscription/set update", e)
+        SetError.invalidPatch(SetErrorDescription(s"${e.cause}"))
+      case e: InvalidUpdateException =>
+        LOGGER.info("Invalid update in PushSubscription/set update", e)
+        SetError.invalidArguments(SetErrorDescription(s"${e.cause}"), Some(Properties(e.property)))
+      case e: IllegalArgumentException =>
+        LOGGER.info("Illegal argument in PushSubscription/set update", e)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage), None)
+      case e: PushSubscriptionNotFoundException =>
+        LOGGER.info("Attempt to update a non existing push subscription", e)
+        SetError.notFound(SetErrorDescription(e.getMessage))
+      case e: ExpireTimeInvalidException =>
+        LOGGER.info("Invalid time expiracy for push subscription: {}", e.getMessage)
+        SetError.invalidArguments(SetErrorDescription(e.getMessage), Some(Properties("expires")))
+      case _ =>
+        LOGGER.error("Failed to delete push subscription", exception)
+        SetError.serverFail(SetErrorDescription(exception.getMessage))
     }
   }
   case class PushSubscriptionUpdateResults(results: Seq[PushSubscriptionUpdateResult]) {
diff --git a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/VacationResponseSetMethod.scala b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/VacationResponseSetMethod.scala
index 30550aa642..0158b60f1b 100644
--- a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/VacationResponseSetMethod.scala
+++ b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/method/VacationResponseSetMethod.scala
@@ -38,6 +38,7 @@ import org.apache.james.jmap.vacation.{VacationResponseSetError, VacationRespons
 import org.apache.james.mailbox.MailboxSession
 import org.apache.james.metrics.api.MetricFactory
 import org.apache.james.vacation.api.{VacationPatch, VacationService, AccountId => VacationAccountId}
+import org.slf4j.LoggerFactory
 import play.api.libs.json.JsObject
 import reactor.core.scala.publisher.{SFlux, SMono}
 
@@ -66,13 +67,18 @@ case class VacationResponseUpdateFailure(id: String, exception: Throwable) exten
   override def notUpdated: Map[String, VacationResponseSetError] = Map(id -> asSetError(exception))
 
   def asSetError(exception: Throwable): VacationResponseSetError = exception match {
-      case e: IllegalArgumentException => VacationResponseSetError.invalidArgument(Some(SetErrorDescription(e.getMessage)))
-      case e: Throwable => VacationResponseSetError.serverFail(Some(SetErrorDescription(e.getMessage)))
+      case e: IllegalArgumentException =>
+        VacationResponseSetMethod.LOGGER.info("Illegal argument in vacation update", e)
+        VacationResponseSetError.invalidArgument(Some(SetErrorDescription(e.getMessage)))
+      case e: Throwable =>
+        VacationResponseSetMethod.LOGGER.error("Failed to update vacation", e)
+        VacationResponseSetError.serverFail(Some(SetErrorDescription(e.getMessage)))
     }
 }
 
 object VacationResponseSetMethod {
   val VACATION_RESPONSE_PATCH_OBJECT_KEY = "singleton"
+  val LOGGER = LoggerFactory.getLogger(classOf[VacationResponseSetMethod])
 }
 
 class VacationResponseSetMethod @Inject()(@Named(InjectionKeys.JMAP) eventBus: EventBus,


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