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 » SupportPac IAM3 - Node for log4j

Post new topic  Reply to topic
 SupportPac IAM3 - Node for log4j « View previous topic :: View next topic » 
Author Message
markpurvis
PostPosted: Mon Sep 27, 2010 7:36 am    Post subject: SupportPac IAM3 - Node for log4j Reply with quote

Newbie

Joined: 27 Sep 2010
Posts: 3

I wonder if anyone else has experienced the same issues as I am having using this plugin to call log4j.

I am trying to log an input message, and can successfully do so by using the log4j node, but cannot get the same message to log through ESQL calls. I've tried calling the log4j_1_1 function in lots of different ways, but each time I just get a string in the log. The '$' s are not being interpreted as they are when going through the node.

Code :
Code:
      SET Environment.Variables.Log4j.LogText = 'Test $XESQL:InputRoot.XMLNSC$';
      SET MyMsg = Environment.Variables.Log4j.LogText;
      
      CALL log4j_1_1('computeNode', 'other', 'ERROR', Environment.Variables.Log4j.LogText) INTO rc;      
      CALL log4j_1_1('computeNode', 'other', 'ERROR', MyMsg) INTO rc;      
      CALL log4j_1_1('computeNode', 'other', 'ERROR', '$XESQL:InputRoot.XMLNSC$') INTO rc;            
      CALL log4j_1_1('computeNode', 'other', 'ERROR', '$MyMsg$') INTO rc;            
      CALL log4j_1_1('computeNode', 'other', 'ERROR', '$MyMsg') INTO rc;            
      CALL log4j_1_1('computeNode', 'other', 'ERROR', 'MyMsg$') INTO rc;                  
      RETURN TRUE;


The log4jnode follows this compute node and is configured to log Environment.Variables.Log4j.LogText , and it gives the nicely formatted contents of InputRoot.XMLNCS.

The output from the log4j_1_1 calls, however are just plain strings pretty much as you'd expect if just writing out a CHARACTER variable.

Any ideas, anyone?

Thanks.
Back to top
View user's profile Send private message
Amitha
PostPosted: Mon Sep 27, 2010 7:42 am    Post subject: Reply with quote

Voyager

Joined: 20 Nov 2009
Posts: 80
Location: Newyork

Quote:
$XESQL:InputRoot.XMLNSC$'


I doubt you can write message tree using that function.
As a workaround, You could convert the tree to BLOB using ASBITSTREAM function and then CAST it to CHARACTER and then pass it log4j function.
Back to top
View user's profile Send private message Send e-mail
markpurvis
PostPosted: Mon Sep 27, 2010 8:02 am    Post subject: Reply with quote

Newbie

Joined: 27 Sep 2010
Posts: 3

Thanks for the reply.

Actually the message tree DOES get written out.

The variable set here:

Code:

SET Environment.Variables.Log4j.LogText = 'Test XESQL:InputRoot.XMLNSC$';


is picked up by the log4j node and the tree is written out.

The issue is that the same tree does not get written by the subsequent ESQL calls.

Regards
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Mon Sep 27, 2010 9:01 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

This support pak has bugs. It kinda works, and as you experienced, it sometimes produces unexpected results.

We asked IBM for source code so we could support it locally. IBM chose not to release the source code and therefore, we chose not to use this support pak since it could not be supported in our production environment.

What we did instead is use log4j directly from JCNs. In fact, you can make a direct log4j function call from ESQL. This way, we own the source code and can fully support it in production.

My recommendation is for you to do the same. You will avoid the steep payment for support on this pak and you will have complete total control over how log4j gets used in your environment. Using log4j directly is easier than you think. You don't need the support pak.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
paranoid221
PostPosted: Mon Sep 27, 2010 10:20 pm    Post subject: Reply with quote

Centurion

Joined: 03 Apr 2006
Posts: 101
Location: USA

Second what Lance says
_________________
LIFE is a series of complex calculations, somewhere multiplied by ZERO.
Back to top
View user's profile Send private message
markpurvis
PostPosted: Mon Sep 27, 2010 11:30 pm    Post subject: Reply with quote

Newbie

Joined: 27 Sep 2010
Posts: 3

Thanks for the advice guys. JCN here I come...
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Tue Sep 28, 2010 5:29 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

mark,

It's a little tricky to get setup at first, so if you have difficulties, post your question and we'll be glad to help.

You may already know this information, but I'll throw some initial tips to you.

When creating your JCN source code class, don't use <default> package. Create a unique package name for each JCN source code file. For example, package com.xyz.abc

Then, in your log4j.properties file:

Code:

################ xyz class logging ###############
log4j.logger.com.xyz.abc=INFO, cdf
log4j.appender.cdf = org.apache.log4j.DailyRollingFileAppender
log4j.appender.cdf.File = /your/directory/on/server/to/collect/logs/somelogname.log
log4j.appender.cdf.MaxFileSize=2048KB
log4j.appender.cdf.MaxBackupIndex=12
log4j.appender.cdf.layout = org.apache.log4j.PatternLayout
log4j.appender.cdf.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss}: %m%n



There are two ways to put log4j.jar in your classpath. You can do it at the execution group level by including it as a resource in your bar file (advanced topic for separate thread). Or, you can do it at the system level (same basic procedure as any other java program).
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Sep 28, 2010 5:42 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

lancelotlinc wrote:
There are two ways to put log4j.jar in your classpath. You can do it at the execution group level by including it as a resource in your bar file (advanced topic for separate thread). Or, you can do it at the system level (same basic procedure as any other java program).


In Broker v7, there are at least 4 ways of putting log4j.jar on the classpath available to a Message Flow JavaCompute node.

Putting it in the BAR file is messy in that it makes your bar files LARGE unnecessarily, and it also causes them to get loaded by the EGShared classloader, which gets reloaded far more frequently than you'd like.

Modifying the CLASSPATH environment variable of the shell that your broker runs in does avoid both of those two issues, but causes LOTS more. Do not do this. I've hinted at this in other places recently, but am informed that it's more serious than I'd hinted. Any jar file that you add to the CLASSPATH can potentially interfere with the internal classes that Broker itself needs and uses. I repeat... Do not do this

For Broker 6.1 and earlier, use the shared-classes folder of the Broker workspace.

For Broker v7 and later, create a JavaClassLoader configurable service with a shared-classes folder for your specific project - or if you are going to be using log4j from *all* of your flows, then go ahead and put it in shared-classes.
Back to top
View user's profile Send private message
lancelotlinc
PostPosted: Tue Sep 28, 2010 5:54 am    Post subject: Reply with quote

Jedi Knight

Joined: 22 Mar 2010
Posts: 4941
Location: Bloomington, IL USA

Thanks mqjeff!

I had a feeling we wouldn't be able to escape the classloading discussion, although I tried my best to suggest a separate thread! LOL!

Here is the reference to classloading:

https://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ac37125_.htm

Yes, its alot of information. Once you pop your cherry on doing it the first time, it all becomes clear and you'll be able to do it in your sleep. No pun intended.
_________________
http://leanpub.com/IIB_Tips_and_Tricks
Save $20: Coupon Code: MQSERIES_READER
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Tue Sep 28, 2010 5:57 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

lancelotlinc wrote:
I had a feeling we wouldn't be able to escape the classloading discussion, although I tried my best to suggest a separate thread! LOL!


Well... if you'd included any of the *good* options, I'd have let it slide.

And, yes, I've seen that page before.
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 » SupportPac IAM3 - Node for log4j
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.