james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From adup...@apache.org
Subject [04/34] james-project git commit: JAMES-2085 Increase logging level in ListeningMessageSearchIndex
Date Wed, 05 Jul 2017 13:59:11 GMT
JAMES-2085 Increase logging level in ListeningMessageSearchIndex


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/bbba86f5
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/bbba86f5
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/bbba86f5

Branch: refs/heads/master
Commit: bbba86f5f8bf03ace54f9a43f0b303bc0efe6000
Parents: cb181ca
Author: benwa <btellier@linagora.com>
Authored: Mon Jul 3 10:40:01 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Wed Jul 5 17:13:28 2017 +0700

----------------------------------------------------------------------
 ...lasticSearchListeningMessageSearchIndex.java | 22 ++++++++++++--------
 .../store/search/LazyMessageSearchIndex.java    |  3 +--
 .../search/ListeningMessageSearchIndex.java     |  9 ++++----
 .../mailbox/store/search/MessageSearches.java   |  2 +-
 4 files changed, 19 insertions(+), 17 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/bbba86f5/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java
b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java
index bfd8c1f..aca1dc7 100644
--- a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java
+++ b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMessageSearchIndex.java
@@ -117,18 +117,19 @@ public class ElasticSearchListeningMessageSearchIndex extends ListeningMessageSe
             indexer.indexMessage(indexIdFor(mailbox, message.getUid()), messageToElasticSearchJson.convertToJson(message,
ImmutableList.of(session.getUser())));
         } catch (Exception e) {
             try {
-                LOGGER.warn("Indexing mailbox {}-{} of user {} on message {} without attachments
",
+                LOGGER.warn(String.format("Indexing mailbox %s-%s of user %s on message %s
without attachments ",
                         mailbox.getName(),
-                        mailbox.getMailboxId(),
+                        mailbox.getMailboxId().serialize(),
                         session.getUser().getUserName(),
-                        message.getUid());
+                        message.getUid().toString()),
+                    e);
                 indexer.indexMessage(indexIdFor(mailbox, message.getUid()), messageToElasticSearchJson.convertToJsonWithoutAttachment(message,
ImmutableList.of(session.getUser())));
             } catch (JsonProcessingException e1) {
-                LOGGER.error("Error when indexing mailbox {}-{} of user {} on message {}
without its attachment",
+                LOGGER.error(String.format("Error when indexing mailbox %s-%s of user %s
on message %s without its attachment",
                         mailbox.getName(),
-                        mailbox.getMailboxId(),
+                        mailbox.getMailboxId().serialize(),
                         session.getUser().getUserName(),
-                        message.getUid(),
+                        message.getUid().toString()),
                         e1);
             }
         }
@@ -141,7 +142,10 @@ public class ElasticSearchListeningMessageSearchIndex extends ListeningMessageSe
                 .map(uid ->  indexIdFor(mailbox, uid))
                 .collect(Collectors.toList()));
         } catch (Exception e) {
-            LOGGER.error("Error when deleting messages {} in mailbox {} from index", mailbox.getMailboxId().serialize(),
expungedUids, e);
+            LOGGER.error(String.format("Error when deleting messages %s in mailbox %s from
index",
+                mailbox.getMailboxId().serialize(),
+                ImmutableList.copyOf(expungedUids).toString()),
+                e);
         }
     }
 
@@ -153,7 +157,7 @@ public class ElasticSearchListeningMessageSearchIndex extends ListeningMessageSe
                     JsonMessageConstants.MAILBOX_ID,
                     mailbox.getMailboxId().serialize()));
         } catch (Exception e) {
-            LOGGER.error("Error when deleting all messages in mailbox {}", mailbox.getMailboxId().serialize(),
e);
+            LOGGER.error(String.format("Error when deleting all messages in mailbox %s",
mailbox.getMailboxId().serialize()), e);
         }
     }
 
@@ -164,7 +168,7 @@ public class ElasticSearchListeningMessageSearchIndex extends ListeningMessageSe
                 .map(updatedFlags -> createUpdatedDocumentPartFromUpdatedFlags(mailbox,
updatedFlags))
                 .collect(Collectors.toList()));
         } catch (Exception e) {
-            LOGGER.error("Error when updating index on mailbox {}", mailbox.getMailboxId().serialize(),
e);
+            LOGGER.error(String.format("Error when updating index on mailbox %s", mailbox.getMailboxId().serialize()),
e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/bbba86f5/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/LazyMessageSearchIndex.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/LazyMessageSearchIndex.java
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/LazyMessageSearchIndex.java
index 07c6188..c3ec988 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/LazyMessageSearchIndex.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/LazyMessageSearchIndex.java
@@ -110,9 +110,8 @@ public class LazyMessageSearchIndex extends ListeningMessageSearchIndex
{
                     try {
                         add(session, mailbox, message);
                     } catch (MailboxException e) {
-                        session.getLog().debug("Unable to index message " + message.getUid()
+ " in mailbox " + mailbox.getName(), e);
+                        session.getLog().error("Unable to index message " + message.getUid()
+ " in mailbox " + mailbox.getName(), e);
                     }
-
                 }
             }
         }

http://git-wip-us.apache.org/repos/asf/james-project/blob/bbba86f5/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java
index 6cc40b9..11464d3 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/ListeningMessageSearchIndex.java
@@ -83,7 +83,7 @@ public abstract class ListeningMessageSearchIndex implements MessageSearchIndex,
                             try {
                                 add(session, mailbox, message);
                             } catch (MailboxException e) {
-                                session.getLog().debug("Unable to index message " + message.getUid()
+ " for mailbox " + mailbox, e);
+                                session.getLog().error("Unable to index message " + message.getUid()
+ " for mailbox " + mailbox, e);
                             }
                         }
 
@@ -93,7 +93,7 @@ public abstract class ListeningMessageSearchIndex implements MessageSearchIndex,
                     try {
                         delete(session, expunged.getMailbox(), expunged.getUids());
                     } catch (MailboxException e) {
-                        session.getLog().debug("Unable to deleted messages " + expunged.getUids()
+ " from index for mailbox " + expunged.getMailbox(), e);
+                        session.getLog().error("Unable to deleted messages " + expunged.getUids()
+ " from index for mailbox " + expunged.getMailbox(), e);
                     }
                 } else if (event instanceof EventFactory.FlagsUpdatedImpl) {
                     EventFactory.FlagsUpdatedImpl flagsUpdated = (EventFactory.FlagsUpdatedImpl)
event;
@@ -102,15 +102,14 @@ public abstract class ListeningMessageSearchIndex implements MessageSearchIndex,
                     try {
                         update(session, mailbox, flagsUpdated.getUpdatedFlags());
                     } catch (MailboxException e) {
-                        session.getLog().debug("Unable to update flags in index for mailbox
" + mailbox, e);
+                        session.getLog().error("Unable to update flags in index for mailbox
" + mailbox, e);
                     }
                 }
             } else if (event instanceof EventFactory.MailboxDeletionImpl) {
                 deleteAll(session, ((EventFactory.MailboxDeletionImpl) event).getMailbox());
             }
         } catch (MailboxException e) {
-            session.getLog().debug("Unable to update index", e);
-
+            session.getLog().error("Unable to update index", e);
         }
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/bbba86f5/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java
----------------------------------------------------------------------
diff --git a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java
b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java
index ae5690e..84dc5fc 100644
--- a/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java
+++ b/mailbox/store/src/main/java/org/apache/james/mailbox/store/search/MessageSearches.java
@@ -116,7 +116,7 @@ public class MessageSearches implements Iterable<SimpleMessageSearchIndex.Search
                 }
             } catch (MailboxException e) {
                 if (session != null && session.getLog() != null) {
-                    session.getLog().debug("Unable to search message " + m.getUid(), e);
+                    session.getLog().error("Unable to search message " + m.getUid(), e);
                 }
             }
         }


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


Mime
View raw message