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 23bcdec50ec583cc15d8313f14eb5b20d69cbc1a Author: Tran Tien Duc <dt...@linagora.com> AuthorDate: Wed May 22 16:49:55 2019 +0700 JAMES-2767 Better log messages for ElasticSearchMailboxModule --- .../org/apache/james/backends/es/ElasticSearchConfiguration.java | 2 +- .../apache/james/modules/mailbox/ElasticSearchMailboxModule.java | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchConfiguration.java b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchConfiguration.java index 2f5c6bb..a1dec4d 100644 --- a/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchConfiguration.java +++ b/backends-common/elasticsearch/src/main/java/org/apache/james/backends/es/ElasticSearchConfiguration.java @@ -124,7 +124,7 @@ public class ElasticSearchConfiguration { public static final int DEFAULT_NB_SHARDS = 5; public static final int DEFAULT_NB_REPLICA = 1; public static final int DEFAULT_PORT = 9200; - private static final String LOCALHOST = "127.0.0.1"; + public static final String LOCALHOST = "127.0.0.1"; public static final Optional<Integer> DEFAULT_PORT_AS_OPTIONAL = Optional.of(DEFAULT_PORT); public static final ElasticSearchConfiguration DEFAULT_CONFIGURATION = builder() diff --git a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java index 4780351..8bf293c 100644 --- a/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java +++ b/server/container/guice/cassandra-guice/src/main/java/org/apache/james/modules/mailbox/ElasticSearchMailboxModule.java @@ -31,6 +31,7 @@ import javax.inject.Singleton; import org.apache.commons.configuration.Configuration; import org.apache.commons.configuration.ConfigurationException; +import org.apache.commons.lang3.time.DurationFormatUtils; import org.apache.james.backends.es.ClientProviderImpl; import org.apache.james.backends.es.ElasticSearchConfiguration; import org.apache.james.backends.es.ElasticSearchIndexer; @@ -112,7 +113,8 @@ public class ElasticSearchMailboxModule extends AbstractModule { Configuration configuration = propertiesProvider.getConfiguration(ELASTICSEARCH_CONFIGURATION_NAME); return ElasticSearchConfiguration.fromProperties(configuration); } catch (FileNotFoundException e) { - LOGGER.warn("Could not find " + ELASTICSEARCH_CONFIGURATION_NAME + " configuration file. Using 127.0.0.1:9300 as contact point"); + LOGGER.warn("Could not find " + ELASTICSEARCH_CONFIGURATION_NAME + " configuration file. Using {}:{} as contact point", + ElasticSearchConfiguration.LOCALHOST, ElasticSearchConfiguration.DEFAULT_PORT); return ElasticSearchConfiguration.DEFAULT_CONFIGURATION; } } @@ -137,7 +139,9 @@ public class ElasticSearchMailboxModule extends AbstractModule { Duration waitDelay = Duration.ofMillis(configuration.getMinDelay()); return Mono.fromCallable(() -> connectToCluster(configuration, mailboxConfiguration, quotaConfiguration)) - .doOnError(e -> LOGGER.warn("Error establishing ElasticSearch connection. Next retry scheduled in {} ms", waitDelay, e)) + .doOnError(e -> LOGGER.warn("Error establishing ElasticSearch connection. Next retry scheduled in {}", + DurationFormatUtils.formatDurationWords(waitDelay.toMillis(), true, true), + e)) .retryBackoff(configuration.getMaxRetries(), waitDelay, waitDelay) .publishOn(Schedulers.elastic()) .block(); --------------------------------------------------------------------- To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org For additional commands, e-mail: server-dev-h...@james.apache.org