A Pax Exam test that is using a Karaf container (which is a forked
container), often has two log configurations. One for the test itself (for
me that would be a log4j2-test.xml), and one for the container. You can use
KarafDistributionOption.replaceConfigurationFile() to provision a
org.ops4j.pax.logging.cfg-file (so here I use a properties-style file, not
xml) with your desired settings. If you do, make sure to also call
doNotModifyLogConfiguration() on the same class (KarafDistributionOption)

- Eric L


On Mon, Nov 20, 2023 at 10:27 PM Steinar Bang <s...@dod.no> wrote:

> I wanted to switch the log leven from INFO to FINE in a pax exam karaf
> test.
>
> So I took the org.ops4j.pax.logging.cfg file from a karaf 4.4.4 etc
> directory and changed the rootlogger, i.e.
>
> log4j2.rootLogger.level = FINE
>
> And then I dumped the resulting file into src/test/resources/etc of the
> pax exam test project.
>
> But the karaf.log file was still filled with INFO messages so that
> wasn't the right way?
>
> Is there a way?
>
> Thanks!
>
>

Reply via email to