Configuring pax-logging in a native container with pax-exam

1.3k views Asked by At

I know this is a bit specific, but I've tried everything I could think of. I am running some integration tests using pax-exam, and logging is supposed to use pax-logging.

This works fine when directly running the felix container, but if I start it through pax-exam, pax-logging never gets configured (it doesn't have the bundles.configuration.location vm proeperty, so it cannot find the services/org.ops4j.pax.logging.properties).

The way I'm trying to set this, but which doesn't seem to work, is by using:

@Configuration
public Option[] configuration() throws IOException {
    Option[] options = new Option[]{
        vmOption("-Dbundles.configuration.location=mypath)
    }
    return options;
}

I'd appreciate any advice you may have. Thanks a lot!

1

There are 1 answers

1
Harald Wellmann On BEST ANSWER

Some remarks that might help:

  1. Pax Logging is the default logging solution provisioned by Pax Exam, but you can override it by using off-the-shelf SLF4J and any backend like logback, see this article for more details. I find this much easier to use.

  2. I'm not sure which bundle or service is supposed to be targeted by this bundles.configuration.location property. This looks like Pax ConfMan, which is not automatically provisioned by Pax Exam, so unless you take care of it yourself, it's no surprise that the property has no effect.

  3. The preferred (but functionally equivalent) way of setting system properties by Pax Exam options is systemProperty("foo").value("bar").