Author |
Message
|
Harsha_AS |
Posted: Mon Apr 15, 2013 10:21 pm Post subject: Log4j JMS Appender in JavaCompute Node |
|
|
Apprentice
Joined: 04 Dec 2011 Posts: 26
|
All,
We are trying to use log4j JMS appender in our JavaCompute Node. We are trying to publish it to a topic.But when we run our flow we dont see messages written to a subscribed qeueu. Below are setup that we have done. Could anyone please help if are doing anything wrong here
1. Creating the .binding file and have it in the JMDI-Directory (created from the Topic Defination File)
2. Created the log4j.properties file.
3. Then ran the flow which is having the JavaCompute Node.
Below are the log4j.properties details.
log4j.rootLogger=INFO, stdout, jms
log4j.logger.org.apache.webspheremq=INFO, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d %-5p %c - %m%n
log4j.appender.jms=org.apache.log4j.net.JMSAppender
log4j.appender.jms.InitialContextFactoryName=com.sun.jndi.fscontext.RefFSContextFactory
log4j.appender.jms.ProviderURL=file:/C:\JNDI-Directory
log4j.appender.jms.TopicBindingName=testtop
log4j.appender.jms.TopicConnectionFactoryBindingName=testTCF |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Apr 16, 2013 4:32 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Well you may have the connection factory right, but you have no Destination defined. You need to Define a destination for your appender... like a queue or a (default) topic....
Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Apr 16, 2013 5:31 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Or maybe you don't have the TCF defined to correctly point to the right queue manager.
Or maybe you didn't correctly configure the broker's classpath.
Or maybe you didn't put the right jar files in the right place.
Or maybe you didn't put the log4j properties file in the right place.
Or maybe you didn't provide the right security options to the jar files or to the TCF or to the Topic or to the queue manager or or or
Or maybe Or Maybe or maybe |
|
Back to top |
|
 |
mapa |
Posted: Tue Apr 16, 2013 9:20 am Post subject: |
|
|
 Master
Joined: 09 Aug 2001 Posts: 257 Location: Malmö, Sweden
|
Make sure you get it working from a JUnit test or similar stand-alone Java program before you try to incorporate it into the broker.
The ProviderURL is not properly formatted.
Try
Code: |
log4j.appender.jms.ProviderURL=file:/C:/JNDI-Directory
#Or
log4j.appender.jms.ProviderURL=file:/C:\\JNDI-Directory
|
You should get an error message in the EG standard out file which on Windows is located in
Code: |
%MQSI_WORKPATH%\components\<brokerName>\<egUID>\console.txt
|
I would recommend to not log to stdout on a production broker...
*Update*: You could also get some useful hints (nothing to do with JMS though) from reading the documentation about the IBM supportpac: "IAM3: WebSphere Message Broker - Node for log4j" |
|
Back to top |
|
 |
Harsha_AS |
Posted: Tue Apr 16, 2013 10:14 pm Post subject: |
|
|
Apprentice
Joined: 04 Dec 2011 Posts: 26
|
Thanks for the response!!!
I can see the error in the console.txt file. Please find the error below.
2013-04-17 06:06:45.336 Execution group started. UUID is: 'b62081c5-3901-0000-0080-ac1f4c4f6be9'. Broker is: MTI2_BROKER
Listening for transport dt_socket at address: 2134
log4j:WARN No appenders could be found for logger (com.omgeo.connect.jcn.mapcsvtoconnect.Initialize).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
From looking in to the error it looks like it is not able to find log4j.properties file. I have this file placed in "C:\Documents and Settings\All Users\Application Data\IBM\MQSI\shared-classes".
Please let me know if this is not the correct place to have it. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Apr 17, 2013 2:38 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
You should be using a configurable service to locate the log4j.properties file. '
Don't use log4j use java.util.logging!  _________________ MQ & Broker admin |
|
Back to top |
|
 |
Harsha_AS |
Posted: Tue Apr 23, 2013 1:10 am Post subject: |
|
|
Apprentice
Joined: 04 Dec 2011 Posts: 26
|
Hey,
Thanks for the response!! I have placed the log4j.properties file under "C:\Documents and Settings\All Users\Application Data\IBM\MQSI\common\wsrr" and it is working fine.
And also i am able to publish the message to a topic using JMS appender in Java compute node. But the problem i am facing now is, the published message is having some junk characters in the message body. Please find the below published message. Could anyone please let me know how will i get rid of this Junk characters from the published message. |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 23, 2013 3:19 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Harsha_AS wrote: |
Thanks for the response!! I have placed the log4j.properties file under "C:\Documents and Settings\All Users\Application Data\IBM\MQSI\common\wsrr" and it is working fine. |
Which is a really odd place to put it, unless log4j is part of wsrr. Why did you not accept the advice of my most worthy associate and use a configurable service?
Harsha_AS wrote: |
Could anyone please let me know how will i get rid of this Junk characters from the published message. |
Junk characters or JMS header data in binary form? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|