ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Log4j Properties Load In Message Flow

Post new topic  Reply to topic
 Log4j Properties Load In Message Flow « View previous topic :: View next topic » 
Author Message
bjr149
PostPosted: Thu Mar 04, 2010 6:32 am    Post subject: Log4j Properties Load In Message Flow Reply with quote

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
View user's profile Send private message
smdavies99
PostPosted: Thu Mar 04, 2010 7:26 am    Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Thu Mar 04, 2010 7:34 am    Post subject: Reply with quote

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
View user's profile Send private message
mqjeff
PostPosted: Thu Mar 04, 2010 7:40 am    Post subject: Reply with quote

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
View user's profile Send private message
bjr149
PostPosted: Thu Mar 04, 2010 7:59 am    Post subject: Reply with quote

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
View user's profile Send private message
Vitor
PostPosted: Thu Mar 04, 2010 8:07 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

bjr149 wrote:
Can you?


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
View user's profile Send private message
Gaya3
PostPosted: Thu Mar 04, 2010 9:08 am    Post subject: Re: Log4j Properties Load In Message Flow Reply with quote

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
View user's profile Send private message
elvis_gn
PostPosted: Thu Mar 04, 2010 11:01 am    Post subject: Re: Log4j Properties Load In Message Flow Reply with quote

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
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Thu Mar 04, 2010 11:17 am    Post subject: Re: Log4j Properties Load In Message Flow Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Log4j Properties Load In Message Flow
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.