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/07/01 07:00:19 UTC

[james-project] 06/06: JAMES-2709 Debug logs for LinShare containers

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 25334607f362adc3a9edc934e036792891baccb5
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Mon Jun 24 14:50:24 2019 +0700

    JAMES-2709 Debug logs for LinShare containers
---
 .../src/test/resources/logback-test.xml                           | 2 ++
 .../src/test/java/org/apache/james/linshare/Linshare.java         | 8 ++++++++
 third-party/linshare/src/test/resources/logback-test.xml          | 2 ++
 3 files changed, 12 insertions(+)

diff --git a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/resources/logback-test.xml b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/resources/logback-test.xml
index 6f13ac9..44b1054 100644
--- a/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/resources/logback-test.xml
+++ b/server/protocols/jmap-integration-testing/memory-jmap-integration-testing/src/test/resources/logback-test.xml
@@ -12,4 +12,6 @@
 
     <logger name="com.datastax.driver.core.QueryLogger.SLOW" level="DEBUG" />
 
+    <logger name="org.apache.james.linshare" level="DEBUG" />
+
 </configuration>
\ No newline at end of file
diff --git a/third-party/linshare/src/test/java/org/apache/james/linshare/Linshare.java b/third-party/linshare/src/test/java/org/apache/james/linshare/Linshare.java
index ad30a50..5a7cf0a 100644
--- a/third-party/linshare/src/test/java/org/apache/james/linshare/Linshare.java
+++ b/third-party/linshare/src/test/java/org/apache/james/linshare/Linshare.java
@@ -26,6 +26,8 @@ import java.nio.charset.StandardCharsets;
 import java.time.Duration;
 
 import org.apache.james.util.docker.Images;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 import org.testcontainers.containers.GenericContainer;
 import org.testcontainers.containers.Network;
 import org.testcontainers.containers.wait.strategy.Wait;
@@ -39,6 +41,7 @@ public class Linshare {
     private static final String WAIT_FOR_BACKEND_INIT_LOG = ".*Server startup.*";
     private static final String WAIT_FOR_LDAP_INIT_LOG = ".*The following user provider for domain '.*' was successfully created.*";
     private static final int LINSHARE_BACKEND_PORT = 8080;
+    private static final Logger LOGGER = LoggerFactory.getLogger(Linshare.class);
 
     private final GenericContainer<?> linshareBackend;
     private final GenericContainer<?> linshareDatabase;
@@ -92,6 +95,7 @@ public class Linshare {
     @SuppressWarnings("resource")
     private GenericContainer<?> createDockerDatabase() {
         return new GenericContainer<>("linagora/linshare-database:2.2")
+            .withLogConsumer(frame -> LOGGER.debug("<linshare-database> " + frame.getUtf8String()))
             .withNetworkAliases("database", "linshare_database")
             .withEnv("PGDATA", "/var/lib/postgresql/data/pgdata")
             .withEnv("POSTGRES_USER", "linshare")
@@ -102,6 +106,7 @@ public class Linshare {
     @SuppressWarnings("resource")
     private GenericContainer<?> createDockerMongodb() {
         return new GenericContainer<>("mongo:3.2")
+            .withLogConsumer(frame -> LOGGER.debug("<mongo> " + frame.getUtf8String()))
             .withNetworkAliases("mongodb", "linshare_mongodb")
             .withCommand("mongod --smallfiles")
             .withNetwork(network);
@@ -110,6 +115,7 @@ public class Linshare {
     @SuppressWarnings("resource")
     private GenericContainer<?> createDockerLdap() {
         return new GenericContainer<>("linagora/linshare-ldap-for-tests:1.0")
+            .withLogConsumer(frame -> LOGGER.debug("<linshare-ldap-for-tests> " + frame.getUtf8String()))
             .withNetworkAliases("ldap")
             .withNetwork(network);
     }
@@ -130,6 +136,7 @@ public class Linshare {
                 .withFileFromClasspath("conf/id_rsa", "backend/conf/id_rsa.pri")
                 .withFileFromClasspath("conf/id_rsa.pub", "backend/conf/id_rsa.pub")
                 .withFileFromClasspath("Dockerfile", "backend/Dockerfile"))
+            .withLogConsumer(frame -> LOGGER.debug("<linshare-backend> " + frame.getUtf8String()))
             .withNetworkAliases("backend")
             .withEnv("SMTP_HOST", "linshare_smtp")
             .withEnv("SMTP_PORT", "25")
@@ -150,6 +157,7 @@ public class Linshare {
     private GenericContainer<?> createLinshareBackendInit() {
         return new GenericContainer<>("linagora/linshare-init:2.2")
             .withNetworkAliases("init")
+            .withLogConsumer(frame -> LOGGER.debug("<linshare-init> " + frame.getUtf8String()))
             .withEnv("LS_HOST", "backend")
             .withEnv("LS_PORT", "8080")
             .withEnv("LS_LDAP_NAME", "ldap-local")
diff --git a/third-party/linshare/src/test/resources/logback-test.xml b/third-party/linshare/src/test/resources/logback-test.xml
index 1fc9998..a3506ed 100644
--- a/third-party/linshare/src/test/resources/logback-test.xml
+++ b/third-party/linshare/src/test/resources/logback-test.xml
@@ -28,4 +28,6 @@
         <appender-ref ref="STDOUT" />
     </root>
 
+    <logger name="org.apache.james.linshare" level="DEBUG" />
+
 </configuration>
\ No newline at end of file


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