1

I'm trying to set up my integration tests with pax exam 4.8.0 inside a native container using Felix 5.4.0. My first jUnit tests run OK, the issue is logging - I cannot change the logging configuration, which is very annoying. (please note I'm talking about the container logging - the driver configuration is OK. The issue only concerns what runs inside the OSGI container).

Official documentation implies everything should be set up out of the box for a log4j to catch all logs sent through the slf4j API (which is my case). But it says nothing about how to specify a log4j.properties file or equivalent.

Things I've tried to no avail:

  • putting the file in various places (class loading root, META-INF, ...)
  • Setting the configuration at runtime inside a @Before method through the ConfigurationAdmin API
  • Adding various org.ops4j.pax.logging artifacts to my configuration
  • specifying a felix.cm.dir property pointing to a directory containing org/ops4j/pax/logging.config (the org.apache.felix.configadmin bundle is used). The ConfigurationAdmin confirms the file is loaded with PID org.ops4j.pax.logging, but still no sugar.

In all cases, my configuration is ignored (which can be proved by providing bogus configuration - no error ever).

Would someone have a working jUnit + PAX + log4j.properties set up? Thanks.

Marcanpilami
  • 584
  • 3
  • 14
  • In the end, I gave up and went the logback route. Leaving this open in case someone has a miraculous idea. – Marcanpilami Jun 01 '16 at 12:28
  • I have the same issue with pax-exam running in karaf. nothing works and I dont see my logs from the test classes, only the karaf logs are shown. frustrating. – Gadi Aug 22 '16 at 20:11
  • HI @Marcanpilami can you share how you ran OSGi with pax exam with Felix(). I am trying hard but each time i get error: `org.ops4j.pax.exam.TestContainerException: No TestContainer implementation in Classpath ` – Amrit Raj Jun 04 '20 at 10:51

0 Answers0