SLING-8294 - Simplify debug logging for ITs
- update to a more recent Orbit ( Oxygen baseline )
- pull in slf4j-simple and slf4j-log4j where needed
- update ExternalSlingLaunchpad to use slf4j apis
diff --git a/eclipse/eclipse-m2e-test/pom.xml b/eclipse/eclipse-m2e-test/pom.xml
index cd57f75..8b91d1a 100644
--- a/eclipse/eclipse-m2e-test/pom.xml
+++ b/eclipse/eclipse-m2e-test/pom.xml
@@ -53,6 +53,26 @@
<manifestFile>META-INF/MANIFEST.MF</manifestFile>
</archive>
</configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>target-platform-configuration</artifactId>
+ <configuration>
+ <dependency-resolution>
+ <extraRequirements>
+ <requirement>
+ <type>eclipse-plugin</type>
+ <id>org.slf4j.binding.simple</id>
+ <versionRange>0.0.0</versionRange>
+ </requirement>
+ <requirement>
+ <type>eclipse-plugin</type>
+ <id>org.slf4j.apis.log4j</id>
+ <versionRange>0.0.0</versionRange>
+ </requirement>
+ </extraRequirements>
+ </dependency-resolution>
+ </configuration>
</plugin>
</plugins>
</build>
diff --git a/eclipse/eclipse-test/META-INF/MANIFEST.MF b/eclipse/eclipse-test/META-INF/MANIFEST.MF
index 2913950..15aa3ff 100644
--- a/eclipse/eclipse-test/META-INF/MANIFEST.MF
+++ b/eclipse/eclipse-test/META-INF/MANIFEST.MF
@@ -35,7 +35,8 @@
org.apache.jackrabbit.util,
org.apache.sling.ide.jcr,
org.eclipse.wst.validation,
- org.osgi.service.event;version="1.3.0"
+ org.osgi.service.event;version="1.3.0",
+ org.slf4j
Bundle-Activator: org.apache.sling.ide.test.impl.Activator
Bundle-ActivationPolicy: lazy
Export-Package: org.apache.sling.ide.test.impl.helpers;x-friends:="org.apache.sling.ide.eclipse-m2e-test"
diff --git a/eclipse/eclipse-test/pom.xml b/eclipse/eclipse-test/pom.xml
index 5c00da3..dce6376 100644
--- a/eclipse/eclipse-test/pom.xml
+++ b/eclipse/eclipse-test/pom.xml
@@ -62,6 +62,16 @@
<id>org.apache.sling.ide.sightly-feature</id>
<versionRange>0.0.0</versionRange>
</requirement>
+ <requirement>
+ <type>eclipse-plugin</type>
+ <id>org.slf4j.binding.simple</id>
+ <versionRange>0.0.0</versionRange>
+ </requirement>
+ <requirement>
+ <type>eclipse-plugin</type>
+ <id>org.slf4j.apis.log4j</id>
+ <versionRange>0.0.0</versionRange>
+ </requirement>
</extraRequirements>
</dependency-resolution>
</configuration>
@@ -76,6 +86,9 @@
<argLine>-XX:MaxPermSize=512m ${ui.test.args}</argLine>
<systemProperties>
<launchpad.http.port>${http.port}</launchpad.http.port>
+ <org.slf4j.simpleLogger.showDateTime>true</org.slf4j.simpleLogger.showDateTime>
+ <org.slf4j.simpleLogger.dateTimeFormat>yyyy-MM-dd HH:mm:ss:SSS Z</org.slf4j.simpleLogger.dateTimeFormat>
+ <org.slf4j.simpleLogger.defaultLogLevel>${defaultLogLevel}</org.slf4j.simpleLogger.defaultLogLevel>
</systemProperties>
<environmentVariables>
<SWT_GTK3>0</SWT_GTK3>
@@ -138,6 +151,7 @@
<properties>
<ui.test.args></ui.test.args>
+ <defaultLogLevel>INFO</defaultLogLevel>
</properties>
<profiles>
@@ -153,5 +167,27 @@
<ui.test.args>-XstartOnFirstThread</ui.test.args>
</properties>
</profile>
+ <profile>
+ <id>debug</id>
+ <activation>
+ <property>
+ <name>debug</name>
+ </property>
+ </activation>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>tycho-surefire-plugin</artifactId>
+ <version>${tycho.version}</version>
+ <configuration>
+ <systemProperties>
+ <org.slf4j.simpleLogger.log.org.apache.sling>debug</org.slf4j.simpleLogger.log.org.apache.sling>
+ </systemProperties>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
</profiles>
</project>
diff --git a/eclipse/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ExternalSlingLaunchpad.java b/eclipse/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ExternalSlingLaunchpad.java
index 11967b9..7f49eee 100644
--- a/eclipse/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ExternalSlingLaunchpad.java
+++ b/eclipse/eclipse-test/src/org/apache/sling/ide/test/impl/helpers/ExternalSlingLaunchpad.java
@@ -18,7 +18,6 @@
import java.io.InputStreamReader;
import java.util.ArrayList;
-import java.util.Date;
import java.util.List;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
@@ -31,6 +30,8 @@
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.io.IOUtils;
import org.junit.rules.ExternalResource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import com.google.gson.stream.JsonReader;
@@ -41,6 +42,7 @@
private static final Pattern STARTLEVEL_JSON_SNIPPET = Pattern.compile("\"systemStartLevel\":(\\d+)");
private static final int EXPECTED_START_LEVEL = 30;
private static final long MAX_WAIT_TIME_MS = TimeUnit.MINUTES.toMillis(1);
+ private final Logger logger = LoggerFactory.getLogger(getClass());
private final LaunchpadConfig config;
@@ -63,31 +65,31 @@
rules.add(new StartLevelSlingReadyRule(client));
rules.add(new ActiveBundlesSlingReadyRule(client));
rules.add(new RepositoryAvailableReadyRule(client));
+
+ logger.debug("Starting check");
for (SlingReadyRule rule : rules) {
+ logger.debug("Checking {}", rule);
while (true) {
if (rule.evaluate()) {
+ logger.debug("Rule {} succeeded.", rule);
break;
}
assertTimeout(cutoff);
-
Thread.sleep(100);
}
}
+
+ logger.debug("Checks complete");
}
private void assertTimeout(long cutoff) throws AssertionFailedError {
+ logger.debug("Checking for timeout, current {}, cutoff {}", System.currentTimeMillis(), cutoff);
if (System.currentTimeMillis() > cutoff) {
throw new AssertionFailedError("Sling launchpad did not start within " + MAX_WAIT_TIME_MS + " milliseconds");
}
}
- private void debug(String string) {
- if (System.getProperty("sling.ide.it.debug") != null) {
- System.out.println("[" + new Date() + "] " + string);
- }
- }
-
private interface SlingReadyRule {
boolean evaluate() throws Exception;
@@ -107,7 +109,7 @@
public boolean evaluate() throws Exception {
int status = client.executeMethod(httpMethod);
- debug("vmstat http call got return code " + status);
+ logger.debug("vmstat http call got return code {}", status);
if (status == 200) {
@@ -117,10 +119,9 @@
Matcher m = STARTLEVEL_JSON_SNIPPET.matcher(responseBody);
if (m.find()) {
int startLevel = Integer.parseInt(m.group(1));
- debug("vmstat http call got startLevel " + startLevel);
+ logger.debug("vmstat http call got startLevel {}", startLevel);
if (startLevel >= EXPECTED_START_LEVEL) {
- debug("current startLevel " + startLevel + " >= " + EXPECTED_START_LEVEL
- + ", we are done here");
+ logger.debug("current startLevel {} >= {}, we are done here", startLevel, EXPECTED_START_LEVEL);
return true;
}
}
@@ -142,7 +143,7 @@
@Override
public boolean evaluate() throws Exception {
int status = client.executeMethod(httpMethod);
- debug("bundles http call got return code " + status);
+ logger.debug("bundles http call got return code {}", status);
if ( status != 200) {
return false;
@@ -158,10 +159,10 @@
int total = jsonReader.nextInt();
int active = jsonReader.nextInt();
int fragment = jsonReader.nextInt();
- debug("bundle http call status: total = " + total + ", active = " + active + ", fragment = " + fragment);
+ logger.debug("bundle http call status: total = {}, active = {}, fragment = {}", total, active, fragment);
if (total == active + fragment) {
- debug("All bundles are started, we are done here");
+ logger.debug("All bundles are started, we are done here");
return true;
} else {
return false;
@@ -189,7 +190,7 @@
GetMethod get = new GetMethod(config.getUrl() + prefix + "/default/jcr:root/content");
int status = client.executeMethod(get);
- debug("repository check call at entry point " + prefix + " got status " + status);
+ logger.debug("repository check call at entry point {} got status {}", prefix, status);
if ( status == 200 )
return true;
}
diff --git a/eclipse/target-definition/org.apache.sling.ide.target-definition-dev.target b/eclipse/target-definition/org.apache.sling.ide.target-definition-dev.target
index 881be7b..04c6e24 100644
--- a/eclipse/target-definition/org.apache.sling.ide.target-definition-dev.target
+++ b/eclipse/target-definition/org.apache.sling.ide.target-definition-dev.target
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!--
+<?xml version="1.0" encoding="UTF-8" standalone="no"?><!--
Licensed to the Apache Software Foundation (ASF) under one or
more contributor license agreements. See the NOTICE file
distributed with this work for additional information regarding
@@ -14,8 +13,7 @@
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions
and limitations under the License.
--->
-<?pde version="3.8"?><target name="Sling IDE Tools" sequenceNumber="52">
+--><?pde version="3.8"?><target name="Sling IDE Tools" sequenceNumber="53">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.m2e.feature.feature.group" version="1.6.0.20150526-2032"/>
@@ -23,14 +21,16 @@
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="com.google.gson" version="2.2.4.v201311231704"/>
-<unit id="org.apache.commons.collections" version="3.2.0.v2013030210310"/>
+<unit id="org.apache.commons.collections" version="3.2.2.v201511171945"/>
<unit id="org.apache.commons.httpclient" version="3.1.0.v201012070820"/>
<unit id="org.apache.commons.io" version="2.2.0.v201405211200"/>
<unit id="org.apache.commons.lang" version="2.6.0.v201404270220"/>
<unit id="org.hamcrest.core" version="1.3.0.v201303031735"/>
-<unit id="org.junit" version="4.11.0.v201303080030"/>
-<unit id="org.slf4j.api" version="1.7.2.v20121108-1250"/>
-<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/"/>
+<unit id="org.junit" version="4.12.0.v201504281640"/>
+<unit id="org.slf4j.api" version="1.7.10.v20170428-1633"/>
+<unit id="org.slf4j.binding.simple" version="1.7.10.v20160301-1109"/>
+<unit id="org.slf4j.apis.log4j" version="1.7.10.v20160208-0839"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20170516192513/repository/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.swtbot.eclipse.feature.group" version="2.4.0.201604200752"/>
@@ -50,4 +50,4 @@
<repository location="http://download.eclipse.org/releases/oxygen/"/>
</location>
</locations>
-</target>
+</target>
\ No newline at end of file
diff --git a/eclipse/target-definition/org.apache.sling.ide.target-definition.target b/eclipse/target-definition/org.apache.sling.ide.target-definition.target
index 89139de..b13f99f 100644
--- a/eclipse/target-definition/org.apache.sling.ide.target-definition.target
+++ b/eclipse/target-definition/org.apache.sling.ide.target-definition.target
@@ -15,7 +15,7 @@
See the License for the specific language governing permissions
and limitations under the License.
-->
-<?pde version="3.8"?><target name="Sling IDE Tools" sequenceNumber="51">
+<?pde version="3.8"?><target name="Sling IDE Tools" sequenceNumber="52">
<locations>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.m2e.feature.feature.group" version="1.6.0.20150526-2032"/>
@@ -23,14 +23,16 @@
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="com.google.gson" version="2.2.4.v201311231704"/>
-<unit id="org.apache.commons.collections" version="3.2.0.v2013030210310"/>
+<unit id="org.apache.commons.collections" version="3.2.2.v201511171945"/>
<unit id="org.apache.commons.httpclient" version="3.1.0.v201012070820"/>
<unit id="org.apache.commons.io" version="2.2.0.v201405211200"/>
<unit id="org.apache.commons.lang" version="2.6.0.v201404270220"/>
<unit id="org.hamcrest.core" version="1.3.0.v201303031735"/>
-<unit id="org.junit" version="4.11.0.v201303080030"/>
-<unit id="org.slf4j.api" version="1.7.2.v20121108-1250"/>
-<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20140525021250/repository/"/>
+<unit id="org.junit" version="4.12.0.v201504281640"/>
+<unit id="org.slf4j.api" version="1.7.10.v20170428-1633"/>
+<unit id="org.slf4j.binding.simple" version="1.7.10.v20160301-1109"/>
+<unit id="org.slf4j.apis.log4j" version="1.7.10.v20160208-0839"/>
+<repository location="http://download.eclipse.org/tools/orbit/downloads/drops/R20170516192513/repository/"/>
</location>
<location includeAllPlatforms="false" includeConfigurePhase="false" includeMode="planner" includeSource="true" type="InstallableUnit">
<unit id="org.eclipse.jst.enterprise_ui.feature.feature.group" version="3.9.2.v201802121827"/>
diff --git a/shared/modules/impl-vlt/pom.xml b/shared/modules/impl-vlt/pom.xml
index 4debcad..9187131 100644
--- a/shared/modules/impl-vlt/pom.xml
+++ b/shared/modules/impl-vlt/pom.xml
@@ -46,6 +46,17 @@
</excludes>
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <systemProperties>
+ <org.slf4j.simpleLogger.showDateTime>true</org.slf4j.simpleLogger.showDateTime>
+ <org.slf4j.simpleLogger.dateTimeFormat>yyyy-MM-dd HH:mm:ss:SSS Z</org.slf4j.simpleLogger.dateTimeFormat>
+ <org.slf4j.simpleLogger.defaultLogLevel>${defaultLogLevel}</org.slf4j.simpleLogger.defaultLogLevel>
+ </systemProperties>
+ </configuration>
+ </plugin>
</plugins>
</build>
@@ -139,8 +150,15 @@
<version>2.16.0</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-simple</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<properties>
<sling.java.version>8</sling.java.version>
+ <!-- Jackrabbit is quite verbose on INFO level -->
+ <defaultLogLevel>warn</defaultLogLevel>
</properties>
</project>