Using java.util.logging

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Using java.util.logging

tomq42
Documentation indicates I can do this. Pax logging indicates I can do this.
Yet when I try, I can't.

I have some code that uses java.util.logging. If I log at level SEVERE, it comes out on the console, and only the console, and doesn't come out in the karaf.log file. Anything less than that and it doesn't come out anywhere. This is the default java.util.logging behaviour isn't it?
I'm starting using the karaf.bat file. As a double check I've printed out the value of the java.util.logging.config.file system property and it does indeed point to the etc\java.util.logging.properties.

So I'm somewhat confused. Is there any additional configuration I need to do to make jdk logging come out somewhere useful?

I'm using a 4.1.3 snapshot of karaf on Windows.
Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Using java.util.logging

tomq42
> Yet when I try, I can't.

OK, so that's frustrating.
If I try a simple "hello world" bundle that just logs a message, run in a clean karaf, it DOES come out in the karaf.log file.
Run it in our application though and it doesn't.
So some bundle is interfering with the logging configuration in some way.
That's going to be soooo easy to diagnose :-)

Why is it that logging is so complicated, and that there are about a hundred logging frameworks? About half the projects on github must be dedicated to logging.
Reply | Threaded
Open this post in threaded view
|

Re: Using java.util.logging

Vincent Zurczak

Hi,


Le 12/10/2017 à 15:41, [hidden email] a écrit :
Yet when I try, I can't.
OK, so that's frustrating.
If I try a simple "hello world" bundle that just logs a message, run in a clean karaf, it DOES come out in the karaf.log file.
Run it in our application though and it doesn't.
So some bundle is interfering with the logging configuration in some way.
That's going to be soooo easy to diagnose :-)

Why is it that logging is so complicated, and that there are about a hundred logging frameworks? About half the projects on github must be dedicated to logging.

I do not want to be rude, but I also use java.util.logging with Karaf and I never had a problem with it.
The few messages I read from you on this mailing-list looked more like complaints than demands for help.

Maybe giving up sarcasms and providing additional details about your configuration would help. :)

Regards,

                Vincent.

--
Vincent Zurczak
Linagora: www.linagora.com

Twitter Vincent Zurczak @ LinkedIn <a href="callto://vincent.zurczak">My Skype ID My English blog
Reply | Threaded
Open this post in threaded view
|

Re: Using java.util.logging

jbonofre
In reply to this post by tomq42
Hi Tom,

can you check if JUL packages really comes from Pax Logging ? That's the key
part of logging in Karaf: all log framework packages should come as import from
pax logging. You can check using bundle:headers command for instance.

Regards
JB

On 10/12/2017 03:41 PM, [hidden email] wrote:

>> Yet when I try, I can't.
>
> OK, so that's frustrating.
> If I try a simple "hello world" bundle that just logs a message, run in a clean karaf, it DOES come out in the karaf.log file.
> Run it in our application though and it doesn't.
> So some bundle is interfering with the logging configuration in some way.
> That's going to be soooo easy to diagnose :-)
>
> Why is it that logging is so complicated, and that there are about a hundred logging frameworks? About half the projects on github must be dedicated to logging.
>

--
Jean-Baptiste Onofré
[hidden email]
http://blog.nanthrax.net
Talend - http://www.talend.com
Reply | Threaded
Open this post in threaded view
|

Re: Using java.util.logging

tomq42
> can you check if JUL packages really comes from Pax Logging ?

Err, how can they? Perhaps I'm misunderstanding.
Surely the java.util.logging packages are provided by the JRE?

I DO have one log message that DOES come out. Very odd.
If I step through the code in the debugger, I appear to have two code paths.
In one, my calls to java.util.logging.Logger.info end up in org.ops4j.pax.logging.log4j2.internal.JdkHandler.

Later a call to java.util.logging.Logger.info ends up in org.ops4j.pax.logging.service.internal.JdkHandler

These log calls end up being passed through to log4j, rather than log4j2. log4j isn't set up at all, only log4j2 is set up, so these messages don't come out.

So for some reason, we have the "log4j" pax logging bundle ("OPS4J Pax Logging - Service", "org.ops4j.pax.logging.pax-logging-service") AS WELL as the log4j2 logging bundle ("OPS4J Pax Logging - Log4j v2", "org.ops4j.pax.logging.pax-logging-log4j2"). Not sure where that's come from, but that doesn't appear in the standard karaf distro. I don't believe we explicitly list that anywhere as a requirement so at the moment I'm not sure how I determine what has caused that to be included by the distribution build process.
Reply | Threaded
Open this post in threaded view
|

Re: Using java.util.logging

tomq42
> I don't believe we explicitly list that anywhere as a requirement

Correction. We DID include this as a bundle in one of our features:
    <bundle>mvn:org.ops4j.pax.logging/pax-logging-service/1.10.1</bundle>
but it doesn't seem to be required, removing it doesn't introduce any resolution issues.

Removing it makes all the logging work again.
Marvellous!


Thanks for the help :-)