Author |
Message
|
JayBee |
Posted: Tue Feb 20, 2007 2:42 am Post subject: WMB 6 and Java Logging |
|
|
Newbie
Joined: 20 Feb 2007 Posts: 3
|
Hi,
I'm writing a pretty complex used defined node in Java and want to use Java Logging with a custom handler and formatter. With Broker 5 everything worked fine but now I'm migrating to Broker 6 and the new classloader hierarchy breaks it.
Basicly Java Logging and the predefined LogManager is using the System classloader to load handlers and formatters. Unfortunatly my user defined node is not in the scope of the system classloader. Is there a way to add something to the system classloader. Modifying the CLASSPATH doesn't help. Maybe it also helps to know how to set some system properties like -Djava.util.logging.manager=myOwnLogManager.
Btw. I'm running the Broker on Z/OS.
Thanks,
JayBee |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Feb 20, 2007 4:07 am Post subject: Re: WMB 6 and Java Logging |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
JayBee wrote: |
Hi,
I'm writing a pretty complex used defined node in Java and want to use Java Logging with a custom handler and formatter. With Broker 5 everything worked fine but now I'm migrating to Broker 6 and the new classloader hierarchy breaks it.
Basicly Java Logging and the predefined LogManager is using the System classloader to load handlers and formatters. Unfortunatly my user defined node is not in the scope of the system classloader. Is there a way to add something to the system classloader. Modifying the CLASSPATH doesn't help. Maybe it also helps to know how to set some system properties like -Djava.util.logging.manager=myOwnLogManager.
Btw. I'm running the Broker on Z/OS.
Thanks,
JayBee |
Depending on the java version you may have to add the "lumberjack" (source forge) support pack (java 1.3 x).
If you need to use it you may have to add -Djava.util.logging.configfile=/path/logging.properties for the default logging properties.
This being said Broker 6 would need at least java 1.4 which should have the java.util.logging API as part of it's jvm. Depending on your logging method I would make sure to have the commons.jar on the classpath.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Feb 20, 2007 4:48 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
|
Back to top |
|
 |
JayBee |
Posted: Tue Feb 20, 2007 8:02 am Post subject: Re: WMB 6 and Java Logging |
|
|
Newbie
Joined: 20 Feb 2007 Posts: 3
|
fjb_saper wrote: |
Depending on the java version you may have to add the "lumberjack" (source forge) support pack (java 1.3 x).
If you need to use it you may have to add -Djava.util.logging.configfile=/path/logging.properties for the default logging properties.
|
Ok, the -D or any other VM parameters might be a solution, but where exactly can I specify any of these when running Broker 6 on Z/OS. Btw. I'm using JDK 1.4.2 and the included Java Logging.
fjb_saper wrote: |
This being said Broker 6 would need at least java 1.4 which should have the java.util.logging API as part of it's jvm. Depending on your logging method I would make sure to have the commons.jar on the classpath.
Enjoy  |
Which commons.jar do you mean? Jakarta commons logging? Well I'm trying to use the Java Logging introduced with JDK 1.4 and actually it was working with Broker 5 but stopped working with Broker 6 because of the Classloader Hierarchy. The Java Logging implementation is somewhat stupid because it tries to load all handlers from the system classloader by calling ClassLoader.getSystemClassLoader().loadClass(xxx) instead of using the context classloader.
So the questions comes down to:
1. Is there a way to add a JAR to the system classpath of the broker
2. If there is no way to modify this, can I pass a system property to the JVM started by the broker to use a custom LogManager implementation and how do I set system properties from outside
Regards,
JayBee |
|
Back to top |
|
 |
JayBee |
Posted: Tue Feb 20, 2007 8:03 am Post subject: |
|
|
Newbie
Joined: 20 Feb 2007 Posts: 3
|
Thanks, but I tried this before. Java Logging doesn't use the context class loader for handlers. It always uses the system classloader.
Regards,
JayBee |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Feb 20, 2007 8:06 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You can use mqsichangeproperties to pass -D options to the EG runtime. Search for examples here, I don't remember the exact details but I know I've commented on it.
You should be careful with it.
You can try to add classes to the System classloader by putting files in <runtime>/classes. But this should be done with extreme care, and that might not put them on the System classloader, either.
You should review the bottom part of the link I posted, where it discusses the inverse problem using JNDI - where the System classloader needs to be used instead of the Context classloader.
You should probably use MBService functions instead of Java logging.
You should consider opening a PMR. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
|