This is an automated email from the ASF dual-hosted git repository. stbischof pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/felix-dev.git
commit da26bc3d64a3f034bbeeb04cf5993be2263037ef Author: Arnoud Glimmerveen <[email protected]> AuthorDate: Mon May 12 21:14:51 2025 +0200 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. --- scr/pom.xml | 19 ++----------- .../felix/scr/integration/ComponentTestBase.java | 14 +++++---- scr/src/test/resources/exam.properties | 19 +++++++++++++ scr/src/test/resources/logback-test.xml | 33 ++++++++++++++++++++++ 4 files changed, 64 insertions(+), 21 deletions(-) diff --git a/scr/pom.xml b/scr/pom.xml index 1883d19073..148a82b8ca 100644 --- a/scr/pom.xml +++ b/scr/pom.xml @@ -196,30 +196,17 @@ <version>2.6.2</version> <scope>test</scope> </dependency> - <dependency> - <groupId>org.ops4j.pax.logging</groupId> - <artifactId>pax-logging-api</artifactId> - <version>1.6.3</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.ops4j.pax.logging</groupId> - <artifactId>pax-logging-service</artifactId> - <version>1.6.3</version> - <scope>test</scope> - </dependency> - <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-core</artifactId> - <version>1.3.15</version> + <version>1.2.12</version> <scope>test</scope> </dependency> - + <dependency> <groupId>ch.qos.logback</groupId> <artifactId>logback-classic</artifactId> - <version>1.3.12</version> + <version>1.2.12</version> <scope>test</scope> </dependency> <dependency> diff --git a/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java b/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java index 39724c1b0f..7921e1b885 100644 --- a/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java +++ b/scr/src/test/java/org/apache/felix/scr/integration/ComponentTestBase.java @@ -186,16 +186,20 @@ public abstract class ComponentTestBase CoreOptions.bundle( bundleFile.toURI().toString() ), mavenBundle( "org.ops4j.pax.tinybundles", "tinybundles", "1.0.0" ), mavenBundle( "org.osgi", "org.osgi.service.log", "1.4.0"), + mavenBundle( "org.slf4j", "slf4j-api", "1.7.32" ), + mavenBundle( "ch.qos.logback", "logback-core", "1.2.12" ), + mavenBundle( "ch.qos.logback", "logback-classic", "1.2.12" ), mavenBundle( "org.osgi", "org.osgi.util.pushstream", "1.0.0"), mavenBundle( "org.apache.felix", "org.apache.felix.configadmin", felixCaVersion ) ), - mavenBundle( "org.osgi", "org.osgi.util.promise"), - mavenBundle( "org.osgi", "org.osgi.util.function"), - mavenBundle( "org.osgi", "org.osgi.service.component"), - mavenBundle( "org.ops4j.pax.url", "pax-url-aether"), + mavenBundle( "org.osgi", "org.osgi.util.promise", "1.3.0" ), + mavenBundle( "org.osgi", "org.osgi.util.function", "1.2.0" ), + mavenBundle( "org.osgi", "org.osgi.service.component", "1.5.1" ), + mavenBundle( "org.ops4j.pax.url", "pax-url-aether", "2.6.2"), junitBundles(), frameworkProperty( "org.osgi.framework.bsnversion" ).value( bsnVersionUniqueness ), systemProperty( "ds.factory.enabled" ).value( Boolean.toString( NONSTANDARD_COMPONENT_FACTORY_BEHAVIOR ) ), systemProperty( "ds.loglevel" ).value( DS_LOGLEVEL ), - systemProperty( "ds.cache.metadata" ).value( Boolean.toString(CACHE_META_DATA) ) + systemProperty( "ds.cache.metadata" ).value( Boolean.toString(CACHE_META_DATA) ), + systemProperty( "logback.configurationFile" ).value( "src/test/resources/logback-test.xml" ) ); final Option vmOption = ( paxRunnerVmOption != null )? CoreOptions.vmOption( paxRunnerVmOption ): null; diff --git a/scr/src/test/resources/exam.properties b/scr/src/test/resources/exam.properties new file mode 100644 index 0000000000..4814f3b9c9 --- /dev/null +++ b/scr/src/test/resources/exam.properties @@ -0,0 +1,19 @@ +# 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 copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +# Prevent PAX Logging to be activated +pax.exam.logging=none \ No newline at end of file diff --git a/scr/src/test/resources/logback-test.xml b/scr/src/test/resources/logback-test.xml new file mode 100644 index 0000000000..83171fa127 --- /dev/null +++ b/scr/src/test/resources/logback-test.xml @@ -0,0 +1,33 @@ +<!-- + 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 copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +--> +<configuration> + + <!-- defined a console append --> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%d{HH:mm:ss.SSS} [%15.15thread] %-5level %-36.36logger{36} - %msg%n</pattern> + </encoder> + </appender> + + <logger name="shaded.org.apache.http" level="WARN" /> + + <root level="DEBUG"> + <appender-ref ref="STDOUT" /> + </root> +</configuration> \ No newline at end of file
