log4j2 - Need help setting up a JMS Appender to work with IBM MQ Series

Viewed 568

I'm having a hard time trying to find useful information and examples for using a log4j2 JMS appender to log XML message to an IBM MQ Series queue. It's been a while since I've used log4j and that was back before version 2.x came out.

In my log4j2.xml file, I have the following definition for the JMS appender:

<JMS name="jmsQueue"
     destinationBindingName="BLTCAuditDest"
     factoryName="com.sun.jndi.fscontext.RefFSContextFactory"
     providerURL="file:///C:\\JNDI-Directory"
     factoryBindingName="com.ibm.msg.client.jms.JmsQueueConnectionFactory">
  <PatternLayout pattern="%m"/>
</JMS>

I created a .bindings file, that's in my C:\JNDI-Directory folder, using IBM MQ Explorer to create an Initial Context under the JMS Administered Objects folder. The "BLTCAuditDest" is the name of the Destination I created that's in the C:\JNDI-Directory.bindings file. And I'm guessing the IBM JmsQueueConnectionFactory is the proper class to use for the factoryBindingName. However, with these settings I get the following error:

ERROR An exception occurred processing Appender jmsQueue org.apache.logging.log4j.core.appender.AppenderLoggingException: Error sending to JMS Manager 'jmsQueue': JMS message producer not available

So I'm not sure if my destinationBindingName and factoryBindingName are correct, but I'm not sure what values I should be using here.

Does anyone have a simple sample or have a link to a simple sample that would show how to use a JMS Appender with IBM MQ?

Thank you!

0 Answers
Related