When receiving event logs with a consumer, there doesn't seem to be any message text/body. Does the message topic contain all of the available information, or am I missing something?
Are you using the "events over the message bus" capability to see the broker logs (rather than via Syslog export)..? I.e. subscribing to topic #LOG/> ?
Nope, there is definitely a message body on these messages. Here's a screenshot from the PubSub+ Manager TryMe! subscriber client:
So yes, I think you're missing something? 😅
Yes, that's exactly what I'm doing. Thanks for letting me know ... I'll have to look into what I'm doing wrong.
If you're using PubSub+ Manager TryMe to view them, there was a bug in the little subscriber client app not too long ago that was throwing an exception with TextMessages. My output above is from v9.9. Make sure your broker is at least on that version.
Alternatively, you should be able to see the payload using the SdkPerf test tool. Something like:
./sdkperf_java.sh -cip=localhost -cu=default@default -stl="#LOG/>" -md
Is it possible that some messages don't have any body, like CLIENT_CLIENT_CONNECT? I'm receiving a BytesXMLMessage with the JCSMP client, but getBytes() returns an empty array.
I figured it out. The content is in the attachment, not the message body.
Yup... unfortunately, getBytes() gets you the wrong part of the payload... it's for an XML document portion, for legacy reasons. Not great naming conventions to be stuck with. Which is why we're making a BRAND NEW JAVA API!! 🙌
For anyone else who finds this thread in the future: in your JCSMP consumer, check the message type with "instanceof", then cast the message to a BytesMessage and then call getData().
Or cast it to a TextMessage and then call getText().
BTW, I'd still recommend using either the Syslog logging forwarder in the broker, or (if using Docker container broker) wiring up the logging that way.
Thanks. Are there logs available in syslog that are not sent out as events on the message bus?
Sorry @petegehrman , missed this! Yes, the logs you get over-the-message-bus are only VPN- and CLIENT-level logs for that one particular Message VPN. So really only useful for apps in there. The broker's SYSTEM-level logging, and logging for all of the other VPNs on the same broker will be emitted via Syslog or configured Docker logging. So for management/monitoring of the broker, you'll need to watch the SYSTEM-level logs.