Suppress MQJE001 in System.err log output when an MQException occurs

When you use WebSphere MQ API for Java, exceptions in MQ layer result in a short message logged to System.err, looking like this:

MQJE001: Completion Code 2, Reason 2033

It may be quite annoying because this happens before you have a chance to catch MQException. This is especially unfortunate if the exception does not represent a true error condition in your program. This particular reason code 2033, stands for MQRC_NO_MSG_AVAILABLE and is returned when a get call with options does not find a suitable message. This may be a perfectly normal situation, e.g. for a message poller program. Is it possible to suppress this output?

Yes, it is possible, but it can only be done for one reason code at a time using static method logExclude on MQException class:

MQException.logExclude(MQException.MQRC_NO_MSG_AVAILABLE);

Advertisements

Comments are closed.

%d bloggers like this: