Skip to main content

configure Log info

6 replies [Last post]
hades82
Offline
Joined: 2008-11-20
Points: 0

Hi,
I've been working with JXTA few months and I see when running applications that there is a lot of log information (warnings, errors, ...). This is very useful to debug errors but I want to know if it's possible to configure what messages to show, I mean for example, "I want to show errors but I don't want to see any warning", Is this possible? how could I do that?
Thank you very much.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
ljsenger
Offline
Joined: 2007-08-24
Points: 0

Logger.getLogger("net.jxta").setLevel(Level.SEVERE);

hades82
Offline
Joined: 2008-11-20
Points: 0

Thank you very much, It works!!!
However, I've been viewing the source code of JXTA (e.g. NetworkManager.java) and I see that each class create it's own logger based in the class name. This Logger is private, so, is there any way to change the level of that log? I suppose that the standard output shows the info of all that loggers although they are independent, isn't it?
Thank you again!!

ljsenger
Offline
Joined: 2007-08-24
Points: 0

Hello,
No, they are not independent. Setting the log level to SEVERE will affect the "child" loggers, since any child logger (not configured yet) will inherit a level configuration from its parent.
In my project (p2pcomp), it works fine!
best regards,

hades82
Offline
Joined: 2008-11-20
Points: 0

Ok, then if I change the "top level parent" Logger, all child will change their level inmediatly or only those created after the level change?.
Is this top level Logger "net.jxta"? I understood that from your previous message.
Thank you very much.

ljsenger
Offline
Joined: 2007-08-24
Points: 0

hades82 wrote:

Ok, then if I change the "top level parent" Logger, all child will change their level inmediatly or only those created after the level change?.

All "child" logs will change since they are set initially to "null" ( not configured with setLevel() before).

hades82 wrote:

Is this top level Logger "net.jxta"? I understood that from your previous message.

Yes.

hades82
Offline
Joined: 2008-11-20
Points: 0

Thank you very much for your help, it solved my problem.
And thank you for your patience. Bye!!