How to print a message in broker log

5k views Asked by At

I've been searching on internet and ESQL/WebSphere MessageBroker documentations, to find a way of printing a variable's value so that i can trace it in Broker Logs. Like System.out.println() in java.

I can't debug the messageflow because of some technical issues, so could you please suggest me how to do it or any workarounds.

3

There are 3 answers

1
Steve Parsons On

Probably the easiest way is:

1) Set a temporary location in the Environment to the value of the variable: SET Environment.temp = yourVar ;

2) Subsequently, in a Trace node, set the Pattern on the Basic tab of the Trace node to that temporary location: ${Environment.temp}

3) Configure the Trace node to print to a File, User Trace, or the Local Error Log.

4) Deploy and run your flow. Then look in the output of the Trace node.

0
Dave On

UserTrace is supposed to fulfil this role for ESQL but if UserTrace isn't helping then I see a lot of people use static calls out from ESQL to java whcih are then logged.

The java code could be as simple as writing to stdout (which will go in /var/mqsi/components//stdout) but more commonly I see this pattern used with existing java logging frameworks like log4J.

The advantage of this approach is that you unify logging between your JCN's and ESQL compute nodes.

0
Praveen Gundu On

User Trace should suffice your need, Put a trace node at the point where you want to log, select the file trace and give a file path, pattern give as:

${CURRENT_TIMESTAMP}
${Root}
${Environment}
${LocalEnvironment}
${ExceptionList}

so it logs everything.

If it's in higher environments, then you have to use the mqsichangetrace command to enable the trace on flow.