Re: How to change the karaf.log log level in a pax exam karaf test?

2023-11-21 Thread Steinar Bang
> Steinar Bang :
> Eric Lilja :

>> 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)

> Thanks! This worked to set the default karaf.log log level to TRACE:
>  
> https://github.com/steinarb/scratch/commit/67fcfff6665ab7ec674a1c6d50fe35f4b1d8b673

And, heh,... adding verbose log output, made the integration test stop
failing... Heisenbug!

(I'm guessing it's a timing issue, but finding it easy, because I
still don't have a way to debug the integration test running liquibase,
the liquibase feature load doesn't fail in regular karaf, and it doesn't
fail when running the code outside of OSGi in a unit test. Also, if I
had a way of debugging the integration test, I suspect the waiting for
the debugger would affect timing enough to make the test go green. Sigh!)



Re: How to change the karaf.log log level in a pax exam karaf test?

2023-11-21 Thread Steinar Bang
> Eric Lilja :

> 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)

Thanks! This worked to set the default karaf.log log level to TRACE:
 
https://github.com/steinarb/scratch/commit/67fcfff6665ab7ec674a1c6d50fe35f4b1d8b673



Re: How to change the karaf.log log level in a pax exam karaf test?

2023-11-20 Thread Eric Lilja
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  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!
>
>


How to change the karaf.log log level in a pax exam karaf test?

2023-11-20 Thread Steinar Bang
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!