Enable Trace/Debug logs for JMS client of Websphere MQ - ibm-mq

How do I enable Trace or DEBUG level logging in the JMS client of Websphere IBM MQ.
I have no control over server and it doesn't even run in our infrastructure.
Thanks,
Anuj

If you want instructions for tracing the MQ classes for JMS, try using your favourite search engine. You'll probably come across this Technote:
http://www-01.ibm.com/support/docview.wss?uid=swg21174924#Java
that has details for different product versions and environments.
Alternatively, why not look in thte "Toubleshooting and support" section of the production documentation in the IBM Knowledge Center:
https://www.ibm.com/support/knowledgecenter/SSFKSJ_9.0.0/com.ibm.mq.tro.doc/q031860_.htm

You can enable the trace log easily using the command line argument below.
-Dcom.ibm.msg.client.commonservices.trace.status=ON
Refer to the below link for more information on using this argument:
https://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.tro.doc/q131840_.htm#q131840_
For other options of enabling the trace:
https://www.ibm.com/support/knowledgecenter/SSFKSJ_7.5.0/com.ibm.mq.tro.doc/q031860_.htm
Also, just bear in mind that the trace logs grow too large over time and affect performance. Try to use them in lower environments (not production) first and investigate your issues. You may also refer to the below link for more options on controlling the generated trace output.
https://www-01.ibm.com/support/docview.wss?uid=swg27018159&aid=1

Related

IBM MQ: How to get CCSID of a remote queue manager using IBMMQDotnetClient

We are trying to read the CCSID of a remote queue manager using IBMMQDotnetClient 9.2.5. We are on Windows and the queue manager can be on Windows, Linux, or z/OS.
We tried using MQQueueManager.CharacterSet/CodedCharsetId properties and MQQueueManager.Inquire. These return the local/system character set. This is not what we want.
We also tried using PCF commands. That works for a Linux and Windows queue manager (not z/OS one) but requires more authorizations from the application user, which is our MQ administration (rightly so) reluctant to provide.
In the old version of our product, we do this using the C API MQINQ - but that requires deploying related C libraries which we would now like to avoid.
At the moment, we are using a workaround that is equivalent to specifying the MQCCSID environment variable to override the CCSID. (In other words, we are aware of that environment variable and do not see it as a very good solution).
Does someone know of a better way to do what we want to do?
NB: for any IBM staff seeing this: I opened support cases, the last one is TS009748884 https://www.ibm.com/mysupport/s/case/5003p00002gNy21AAC/mq-c-and-net-libraries-give-different-results-when-inquiring-for-the-queue-manager-ccsid?language=en_US. In there, IBM support person recommended to ask in the MQ support community. They provided this link: https://developer.ibm.com/articles/mq-downloads/. From what I see on that page, the only place to ask questions is SO - hence I am here.

Microsoft.Extensions.Logging.Console unable to understand

I am confused why we have to us this package.
Microsoft.Extensions.Logging.Console
I have 3 questions.
1. what is logging, whats the advantages of logging, and if i don't use it then whats pitfalls.?
2.what is logging.console, why we have to use it?
3.what is loggerfactory?
You should always have a logging facility in your application, without log entries it will be hard to find runtime bugs as there will be no information on what is happening in your application. Its not required to use it, but in a production environment it is a must have thing.
Logging.Console configures the logging facility to print out the log entries in the console, there are others provider options and you can write a custom one as well.
The LoggerFactory is an abstraction that "behind the hood" redirects your log messages to all installed providers, so you can have as many log outputs as you want by only changing the application startup.
I recommend to read the asp net core logging fundamentals documentation

WAS server logs vs trace logs

At this link http://en.wikipedia.org/wiki/Tracing_(software) they point out differences between server logs and trace logs. As a developer, I have always been sufficed by server logs and never needed trace logs. What situations require looking into trace logs?
As #bkail mentions, WebSphere Application Server's built-in server tracing is typically for IBM support. It is generally too fine-grained and tightly coupled with IBM's closed source code to be of use to customers.
However, there are also uses of the trace logs for application support as well. If your application utilizes java.util.logging, these log events will be written to WAS's log files (e.g. SystemOut.log, trace.log). The log messages written to SystemOut.log (Level.CONFIG and higher) are typically intended for system administrators. Log messages written to trace.log (Level.FINE and lower), on the other hand, are messages that are typically intended for developers or troubleshooting and debugging purposes; these messages may be tightly coupled with the code or contain extensive diagnostic information useful in troubleshooting situations. Generally, you only want to enable tracing during troubleshooting or development, as this type of extensive logging can be expensive and potentially impact the performance of your applications.
As a developer, you should make a first-class distinction between logging intended for your system administrators and logging (tracing) intended for developers or troubleshooting. Logging is a great method for communicating with system administrators and can be an invaluable for troubleshooting, but each of these use cases should be handled differently. This is one of the primary reasons that logging APIs (including java.util.logging) provide multiple logging levels. The article you referenced seems to do a great job distinguishing between logging and tracing (which translates to SystemOut.log and trace.log in WAS). IBM's documentation also provides a good overview of the differences.
Trace is primarily used by WebSphere Application Server support at IBM. Customers of that product would very rarely enable trace themselves.

How can I teach myself websphere?

I have a chance to learn how to administer and develop for WebSphere. But after trying to find a book for it I am at a loss where to begin. I was hoping for some advice. I may have access to the IBM RAD IDE (I think that's what it is), but I am not sure.
I have a project I'd like to put on it but I am lost. Thanks.
edit: I do not care which language I end up using.
Ok. There are two parts to your question (and I'm sticking to the base application server here):
a) writing applications: WebSphere Application Server is a J2EE application server. So any web resource or forum or blog describing how to write servlets or JSPs or applications that use EJBs will work. There are lots of those. If you want to stick with IBM resources, you could look for redbooks or developerworks articles. For more general information (patterns, practices, etc) you could try http://theserverside.com.
b) administering the application server: Redbooks like this can give a pretty good overview (as the other poster mentioned).
There is also a WebSphere education channel on youtube which addresses both questions.
Download a trial MQ server from IBM (to some hosts or VMs? that won't matter if you break them...), and (optionally) add a WMB in front of it to transform some messages and fire some messages at it from a GUI client via another broker?
so you 'could':
ia92 java gui to fire messages->microbroker(or rsmb or mosquitto)->WMB(optional)->MQ
have a look at the messages arriving on MQ via Websphere explorer (or its command line client, try googling for 'websphere MQ quick reference card') have a fiddle about with its subscriptions etc
and then start consuming those messages from its queues on the 'other' side of the chain via a WAS and then a java client
MQ->MQ(bridge maybe)->WAS->some Java EE client you've written
don't forget the red books, keep it simple and then keep on adding complexity e.g. encryption etc.

Tool for posting test messages onto a JMS queue? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 9 years ago.
Improve this question
Can anyone recommend a tool for quickly posting test messages onto a JMS queue?
Description:
The tool should allow the user to enter some data, perhaps an XML
payload, and then submit it to a queue.
I should be able to test consumer without producer.
This answer doesn't apply to all JMS brokers, but if you happen to be using Apache ActiveMQ, the web-based admin console (by default at http://localhost:8161/admin) allows you to manually send text messages to topics or queues. It's handy for debugging.
HermesJMS seems to be a rather powerful client for interacting with JMS providers. In my opinion, it is pretty unintuitive and hard to set up, though. (At least I'm mostly failing at it...)
Other, more user-friendly clients are often vendor-specific. Sonic Message Manager is a very nice and simple-to-use open-source JMS client for SonicMQ. It would be great to have a client like that working with different providers.
The ActiveMQ's web-based admin console has a big deficiency - one cannot specify any headers / custom properties when posting a message.
I came across a neat FOSS tool that can post a message and also specify headers/properties:
http://sourceforge.net/projects/activemqbrowser/
HTH
Apache JMeter is a tool (written for the Java platform) which allows:
sending messages to a queue ( point to point)
publishing/subscribing to a topic
sending both persistent and non persistent messages
sending text , map and object messages
Apache ActiveMQ includes a ProducerTool and a ConsumerTool example sources (Java) with many command-line configuration options. As it is based on the JMS API, using it with other message brokers should be easy with minor modifications.
IBM provide a free, powerful command line tool called perfharness.
Although aimed at benchmarking JMS providers, it's really good at generating (and consuming) test messages. You can use data either generated randomly or taken from a file.
The power features include sending and consuming messages at a fixed rate, using a specific number of threads, using either JMS or native MQ, etc. It generates statistics telling you exactly how fast your queue is performing (hence the name).
The only down side is that it's not super intuitive, given the number of operations it supports.
I recommend the approach of #Will and using the Web Console of ActiveMQ which lets you post messages and browse queues or delete messages easily.
Another approach I often use is to use a directory of files as sample data and use a Camel route to move the messages from the directory to a JMS queue - or to take them from a queue and save them to disk etc
e.g.
from("file://someDirectory").
to("activemq:MyQueue");
This would move all the files from someDirectory and send them to an ActiveMQ queue called MyQueue. If you'd rather leave the files in place you can use the URI "file://someDirectory?noop=true".
For more details see
the file endpoint in Camel
a sample Camel example routing from files to JMS
the various enterprise integration patterns Camel supports
Also if the JMS broker supports JMX like ActiveMQ does you can use JConsole to post message and do a lot more.
ActiveMQ has a web console for sending test messages (like mentioned above), but if your provider doesn't have this, it might be easiest to just write a console app/web page to post test messages. Sending a message in JMS isn't too hard, you might get the most benefit just writing your own test client.
If you can use Spring in Java, it has some really powerful utilities, check out the JmsTemplate.
I'm not aware of a simple client. I remember looking for one a long time ago when I researched different queue systems and trying JMS I couldn't find one then, and I couldn't find one now. One thing though - there are a ton of tutorials that get you started and you could do a simple form to achieve that.
Sorry to be not more helpful.
I have built a GUI tool for administering Open Source JMS Servers (Currently Activemq and Hornetq). It can send and receive messages and most of the usual stuff, as well as aggregate queues and topics into logical "groups".
Its a commercial product but the BETA is free and is fully functional.
try it out at http://www.rockeyesoftware.com/
For ActiveMQ the examples directory holds scripts. For Rubyists, look at example/ruby/stompcat.rb and catstomp.rb for subscribing and publishing.
I'm a brazilian developer and I made a Java program for Post HTTP and JMS Messages his available for download at: https://sites.google.com/site/felipeglino/softwares/posttool
In thath page you can found english instructions.

Resources