1. Create a Java properties file named wmjms.properties if it does not already exist and add it to your application class path.
2. Add the following lines in the file to set Log4j as your logging service and to specify the Log4j configuration file location:
com.webmethods.jms.log.destination=com.webmethods.jms.log.LogLog4J
com.webmethods.jms.log.Log4j.properties=<location of the wmjms.log4j.properties file>
For example, com.webmethods.jms.log.Log4j.properties= C:\\wmjmslog4j\wmjms.log4j.properties
Note: You can change the location where your wmjms.log4j.properties file is stored. You can also set your system environment variables. For example, if you are using Integration Server, instead of adding wmjms.properties in class path, the following can be added to extended properties as: watt.config.systemProperties=com.webmethods.jms.log.destination=com.webmethods.jms.log.LogLog4J,
com.webmethods.jms.log.Log4j.properties=<full path-wmjms.log4j.properties>,
com.webmethods.jms.log.JMS_API.level=all,
com.webmethods.jms.log.JMS_BROKER.level=all
3. Do one of the following to enable logging:
a) Enable logging for all levels. Add the following line:
com.webmethods.jms.log.level=all
or
b) Enable logging for specific categories: Add lines in the following format: com.webmethods.jms.log.<category>.level=all
For example:
com.webmethods.jms.log.JMS_API.level=all
com.webmethods.jms.log.JMS_BROKER.level=all
Categories
JMS
JMS_API
JMS_XA
JMS_EVENT_SEND
JMS_EVENT_RECEIVE
JMS_SELECTOR
JMS_BROKER
JMS_TRANSPORT
JMS_MARSHAL
JNDI_API
JNDI_STORAGE
JNDI_BROKER
JMS_RECONNECT
JMS_AUTO_ACK
4. Define JMS API logger by adding or editing lines to the wmjms.log4j.properties file. In our example, this file is located at C:\\wmjmslog4j\wmjms.log4j.properties.
Add the following line:
log4j.logger.com.webmethods.jms.log.LogLog4J=DEBUG, rfa
5.Define the file appender by adding or editing lines to the wmjms.log4j.properties file.
Add the following lines:
log4j.appender.rfa=org.apache.log4j.RollingFileAppender
log4j.appender.rfa.append=false
log4j.appender.rfa.maxFileSize=50MB
log4j.appender.rfa.maxBackupIndex=10
log4j.appender.rfa.File=C:\\log4jlog\log4jtest.log
Note: Edit parameters to specify values relevant to your environment.
6. Define the layout for file appender by adding or editing lines to the wmjms.log4j.properties file.
Add the following lines:
log4j.appender.rfa.layout=org.apache.log4j.PatternLayout
log4j.appender.rfa.layout.conversionPattern=%m%n
Note: Edit parameters to specify values relevant to your environment.