Skip to content

Commit da26bc3

Browse files
glimmerveenstbischof
authored andcommitted
Related to PR #420, on getting control on the logging. This changes disables Pax Exam's preference for Pax Logging, and changes it with Logback (in the latest SLF4j 1.7.x compatible version). With this change, SLF4j and Logback are now available for both the unit tests and the pax exam tests.
Configured explicit versions of all 'mavenBundle's declared in the ComponentTestBase, as otherwise Pax will depend on Maven's LATEST, which is not always compatible.
1 parent ae9ef06 commit da26bc3

File tree

4 files changed

+64
-21
lines changed

4 files changed

+64
-21
lines changed

scr/pom.xml

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -196,30 +196,17 @@
196196
<version>2.6.2</version>
197197
<scope>test</scope>
198198
</dependency>
199-
<dependency>
200-
<groupId>org.ops4j.pax.logging</groupId>
201-
<artifactId>pax-logging-api</artifactId>
202-
<version>1.6.3</version>
203-
<scope>test</scope>
204-
</dependency>
205-
<dependency>
206-
<groupId>org.ops4j.pax.logging</groupId>
207-
<artifactId>pax-logging-service</artifactId>
208-
<version>1.6.3</version>
209-
<scope>test</scope>
210-
</dependency>
211-
212199
<dependency>
213200
<groupId>ch.qos.logback</groupId>
214201
<artifactId>logback-core</artifactId>
215-
<version>1.3.15</version>
202+
<version>1.2.12</version>
216203
<scope>test</scope>
217204
</dependency>
218-
205+
219206
<dependency>
220207
<groupId>ch.qos.logback</groupId>
221208
<artifactId>logback-classic</artifactId>
222-
<version>1.3.12</version>
209+
<version>1.2.12</version>
223210
<scope>test</scope>
224211
</dependency>
225212
<dependency>

scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -186,16 +186,20 @@ public static Option[] configuration()
186186
CoreOptions.bundle( bundleFile.toURI().toString() ),
187187
mavenBundle( "org.ops4j.pax.tinybundles", "tinybundles", "1.0.0" ),
188188
mavenBundle( "org.osgi", "org.osgi.service.log", "1.4.0"),
189+
mavenBundle( "org.slf4j", "slf4j-api", "1.7.32" ),
190+
mavenBundle( "ch.qos.logback", "logback-core", "1.2.12" ),
191+
mavenBundle( "ch.qos.logback", "logback-classic", "1.2.12" ),
189192
mavenBundle( "org.osgi", "org.osgi.util.pushstream", "1.0.0"),
190193
mavenBundle( "org.apache.felix", "org.apache.felix.configadmin", felixCaVersion ) ),
191-
mavenBundle( "org.osgi", "org.osgi.util.promise"),
192-
mavenBundle( "org.osgi", "org.osgi.util.function"),
193-
mavenBundle( "org.osgi", "org.osgi.service.component"),
194-
mavenBundle( "org.ops4j.pax.url", "pax-url-aether"),
194+
mavenBundle( "org.osgi", "org.osgi.util.promise", "1.3.0" ),
195+
mavenBundle( "org.osgi", "org.osgi.util.function", "1.2.0" ),
196+
mavenBundle( "org.osgi", "org.osgi.service.component", "1.5.1" ),
197+
mavenBundle( "org.ops4j.pax.url", "pax-url-aether", "2.6.2"),
195198
junitBundles(), frameworkProperty( "org.osgi.framework.bsnversion" ).value( bsnVersionUniqueness ),
196199
systemProperty( "ds.factory.enabled" ).value( Boolean.toString( NONSTANDARD_COMPONENT_FACTORY_BEHAVIOR ) ),
197200
systemProperty( "ds.loglevel" ).value( DS_LOGLEVEL ),
198-
systemProperty( "ds.cache.metadata" ).value( Boolean.toString(CACHE_META_DATA) )
201+
systemProperty( "ds.cache.metadata" ).value( Boolean.toString(CACHE_META_DATA) ),
202+
systemProperty( "logback.configurationFile" ).value( "src/test/resources/logback-test.xml" )
199203

200204
);
201205
final Option vmOption = ( paxRunnerVmOption != null )? CoreOptions.vmOption( paxRunnerVmOption ): null;
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
#
18+
# Prevent PAX Logging to be activated
19+
pax.exam.logging=none
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
<!--
2+
Licensed to the Apache Software Foundation (ASF) under one
3+
or more contributor license agreements. See the NOTICE file
4+
distributed with this work for additional information
5+
regarding copyright ownership. The ASF licenses this file
6+
to you under the Apache License, Version 2.0 (the
7+
"License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at
9+
10+
http://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing,
13+
software distributed under the License is distributed on an
14+
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
KIND, either express or implied. See the License for the
16+
specific language governing permissions and limitations
17+
under the License.
18+
-->
19+
<configuration>
20+
21+
<!-- defined a console append -->
22+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
23+
<encoder>
24+
<pattern>%d{HH:mm:ss.SSS} [%15.15thread] %-5level %-36.36logger{36} - %msg%n</pattern>
25+
</encoder>
26+
</appender>
27+
28+
<logger name="shaded.org.apache.http" level="WARN" />
29+
30+
<root level="DEBUG">
31+
<appender-ref ref="STDOUT" />
32+
</root>
33+
</configuration>

0 commit comments

Comments
 (0)