Author |
Message
|
bjr149 |
Posted: Thu Mar 04, 2010 6:32 am Post subject: Log4j Properties Load In Message Flow |
|
|
Novice
Joined: 03 Mar 2010 Posts: 22
|
Currently in my JavaNode I have
Code: |
private static Logger log = Logger.getLogger(JavaNodeTest1_JavaCompute.class);
PropertyConfigurator.configure("C:/MBData/JavaNodeTest1/config/log4j.properties");
|
Problem Is I don't want to load this everytime this JavaNode runs. Can you somehow load it just 1 time as like a startup class for the Message Flow?
Thanks!  |
|
Back to top |
|
 |
smdavies99 |
Posted: Thu Mar 04, 2010 7:26 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
Ah the wonderful world of Java properties files.
I wish more of the people posting here and using Java understood the issue you have just pointed out.
I'm sure some java experts will be along shortly to give you some ideas. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Mar 04, 2010 7:34 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
There have been a number of discussions on the forum about using this within WMB, the search tool is your friend.
There have also been a number of discussions started by Java people who are trying to shoehorn a properties file into WMB. You might likewise find these useful.
You were also told here about the dangers of not using WMB properly. I think the key point is that having paid a lot of money for a WMB license you should use the facilities provided (which are there because IBM & existing customers find them useful) rather than bending the software.
FWIW many of us work for some very big compaines. While many of these do impose software solutions for non-technical reasons, almost all then expect the maximum bang for their buck. This typically includes reducing TCO by simplifying the solution implemented.
It's also a common misconception that WMB and WAS are mostly the same product and work the same way. I've had to explain the difference to a number of people, some quite senior. Repeatedly and quite hard. Especially when told that Java Compute Nodes are like MDBs, log4j is a great way of trapping system errors, WMB needs to read an ini file or they need to call a custom XML parser to read a WMQ message. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Mar 04, 2010 7:40 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
This doesn't really take a Java expert.
Just a basic understanding of how to use static variables and determine if they have been set or not.
But I repeat previous comments that all you are doing is digging your own grave if you spend a significant amount of time trying to instrument your own functions for things that Broker supplies natively, like the log methods on MbService. |
|
Back to top |
|
 |
bjr149 |
Posted: Thu Mar 04, 2010 7:59 am Post subject: |
|
|
Novice
Joined: 03 Mar 2010 Posts: 22
|
MbService is a good way for logging but not really. Sure it works but from what I see you can't break out the logs. Imagine you have 50 message flows writing to the same log file. That would be insane. For what I see you can't split the file. Can you?
Nice thing about log4j is you can break out the log files and turn debugging on and off as you see issues. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Mar 04, 2010 8:07 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Yes. Logs are formatted by flow.
bjr149 wrote: |
Nice thing about log4j is you can break out the log files and turn debugging on and off as you see issues. |
Yes. Oddly enough, that's a nice feature about the WMB logging as well.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Gaya3 |
Posted: Thu Mar 04, 2010 9:08 am Post subject: Re: Log4j Properties Load In Message Flow |
|
|
 Jedi
Joined: 12 Sep 2006 Posts: 2493 Location: Boston, US
|
bjr149 wrote: |
Currently in my JavaNode I have
Code: |
private static Logger log = Logger.getLogger(JavaNodeTest1_JavaCompute.class);
PropertyConfigurator.configure("C:/MBData/JavaNodeTest1/config/log4j.properties");
|
Problem Is I don't want to load this everytime this JavaNode runs. Can you somehow load it just 1 time as like a startup class for the Message Flow?
|
what will happen if the property file is not there in the C:\, how you are handling that issue in your MB _________________ Regards
Gayathri
-----------------------------------------------
Do Something Before you Die |
|
Back to top |
|
 |
elvis_gn |
Posted: Thu Mar 04, 2010 11:01 am Post subject: Re: Log4j Properties Load In Message Flow |
|
|
 Padawan
Joined: 08 Oct 2004 Posts: 1905 Location: Dubai
|
Hi all,
Gaya3 wrote: |
bjr149 wrote: |
Currently in my JavaNode I have
Code: |
private static Logger log = Logger.getLogger(JavaNodeTest1_JavaCompute.class);
PropertyConfigurator.configure("C:/MBData/JavaNodeTest1/config/log4j.properties");
|
Problem Is I don't want to load this everytime this JavaNode runs. Can you somehow load it just 1 time as like a startup class for the Message Flow?
|
what will happen if the property file is not there in the C:\, how you are handling that issue in your MB |
Promote it as a property to the main flow.
mqjeff wrote: |
Just a basic understanding of how to use static variables and determine if they have been set or not. |
Jeff, are you referring to storing a java object into broker memory ? Is that possible ?
Regards. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Mar 04, 2010 11:17 am Post subject: Re: Log4j Properties Load In Message Flow |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
elvis_gn wrote: |
mqjeff wrote: |
Just a basic understanding of how to use static variables and determine if they have been set or not. |
Jeff, are you referring to storing a java object into broker memory ? Is that possible ? |
No, I'm referring to the Singleton pattern. |
|
Back to top |
|
 |
|