You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by du...@apache.org on 2020/04/02 14:14:31 UTC
[sling-org-apache-sling-testing-rules] branch master updated:
Refactor logging in RemoteLogDumperRule
This is an automated email from the ASF dual-hosted git repository.
dulvac pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-testing-rules.git
The following commit(s) were added to refs/heads/master by this push:
new c53dd7a Refactor logging in RemoteLogDumperRule
new 06cbab1 Merge pull request #1 from volteanu/remotelog-debug
c53dd7a is described below
commit c53dd7a04710b9bff4c60d4686e87460c38c711b
Author: Valentin Olteanu <vo...@adobe.com>
AuthorDate: Wed Feb 19 15:24:40 2020 +0100
Refactor logging in RemoteLogDumperRule
---
.../testing/junit/rules/RemoteLogDumperRule.java | 19 ++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/main/java/org/apache/sling/testing/junit/rules/RemoteLogDumperRule.java b/src/main/java/org/apache/sling/testing/junit/rules/RemoteLogDumperRule.java
index 8c70329..787f9ca 100644
--- a/src/main/java/org/apache/sling/testing/junit/rules/RemoteLogDumperRule.java
+++ b/src/main/java/org/apache/sling/testing/junit/rules/RemoteLogDumperRule.java
@@ -30,6 +30,8 @@ import org.apache.sling.testing.junit.rules.instance.Instance;
import org.junit.rules.TestWatcher;
import org.junit.runner.Description;
import org.junit.runners.model.Statement;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import static org.apache.sling.testing.clients.interceptors.TestDescriptionInterceptor.TEST_CLASS_HEADER;
import static org.apache.sling.testing.clients.interceptors.TestDescriptionInterceptor.TEST_NAME_HEADER;
@@ -58,6 +60,9 @@ import static org.apache.sling.testing.clients.interceptors.TestDescriptionInter
* </pre>
*/
public class RemoteLogDumperRule extends TestWatcher {
+
+ private static final Logger LOG = LoggerFactory.getLogger(RemoteLogDumperRule.class);
+
/**
* Path for the org.apache.sling.junit.impl.servlet.TestLogServlet
*/
@@ -125,18 +130,14 @@ public class RemoteLogDumperRule extends TestWatcher {
pw.println(msg);
}
- pw.printf("=============== Logs from server [%s] for [%s]===================%n",
- slingClient.getUrl(), description.getMethodName());
- pw.print(response.getContent());
- pw.println("========================================================");
-
- System.err.print(sw.toString());
+ LOG.info("=============== Logs from server {} for {}===================\n{}",
+ slingClient.getUrl(), description.getMethodName(), response.getContent());
+ LOG.info("========================================================");
} catch (Throwable t) {
- System.err.printf("Error occurred while fetching test logs from server [%s] %n", slingClient.getUrl());
- t.printStackTrace(System.err);
+ LOG.debug("Error occurred while fetching test logs from server [{}]: {}", slingClient.getUrl(), t);
}
} else {
- System.err.println("No SlingClient configured with the rule");
+ LOG.debug("No SlingClient configured with the rule");
}
}
}