Author |
Message
|
EricL |
Posted: Mon Jul 09, 2018 6:47 am Post subject: Printout/Logging from IIB ESQL Script |
|
|
Centurion
Joined: 10 Oct 2014 Posts: 102
|
Hi,
I'm working on some workflows which involves a lot ESQL coding, to help debug/trouble shooting, I'd like to know is there any way to log/pringout some varibale values from within ESQL, like "print(...)" from within Java?
Thanks |
|
Back to top |
|
 |
Vitor |
Posted: Mon Jul 09, 2018 7:42 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Well the user trace print out shows values being assigned, and the Toolkit debugger allows values to be inspected while the ESQL is running.
Note that (as often discussed here) the user trace is the better vehicle for diagnosing parsing problems, as if the message model can't properly parse the data then the debugger's going to have no more luck. But it sounds like you're talking about user variables rather than parsed input, for which the debugger is fine.
I personally prefer user trace and find it more useful for debugging ESQL but I'm a  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Mon Jul 09, 2018 7:44 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
And for the record ESQL has no equivalent of the print(...) function, having no equivalent of stdout or stderr in the runtime environment. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
EricL |
Posted: Wed Jul 11, 2018 3:23 am Post subject: |
|
|
Centurion
Joined: 10 Oct 2014 Posts: 102
|
Thanks....
I noticed there is "Log" statement can be used to generate events, with user trace enabled, can "Log" play the same role like "system.out.print" role in java? |
|
Back to top |
|
 |
EricL |
Posted: Wed Jul 11, 2018 3:35 am Post subject: |
|
|
Centurion
Joined: 10 Oct 2014 Posts: 102
|
fyi, I created a simple workflow: MQInput -> TraceNode1-> ComputeNode ->TraceNode2, I also have a code line like:
LOG EVENT SEVERITY 1 CATALOG 'BIPmsgs' MESSAGE 2951 VALUES(1,2,3,4);
within ESQL script of ComputeNode, I was trying to trace above LOG message 'BIPmsgs' MESSAGE 2951, but didn't see it from Event Viewer(I'm doing test on Windows), any idea why?
Thanks for the help... |
|
Back to top |
|
 |
abhi_thri |
Posted: Wed Jul 11, 2018 4:34 am Post subject: |
|
|
 Knight
Joined: 17 Jul 2017 Posts: 516 Location: UK
|
EricL wrote: |
LOG EVENT SEVERITY 1 CATALOG 'BIPmsgs' MESSAGE 2951 VALUES(1,2,3,4); |
hi...not sure why this didn't work for you, i just tried the same statement using a simple flow (MQInput->Compute) in Windows and can see Information level events appearing at EventViewer->Application logs
(<iib node>.<integration server> ) Event generated by user code. Additional information : '1' '2' '3' '4' 'TestLOGStmt.Compute'
On linux these should go the syslog.
You could try enabling user tracing/debugger to ensure that the flow logic is indeed executing the Log statement instead of taking some alternative path (eg:- if the LOG statement is within an IF/ELSE statement)
PS: In case you were using Java within IIB the stdout/stderr messages will go to stdout/stderr files at the Integration server runtime path - /<WorkPath>/components/<NodeName>/<IntegrationServer UUID>. Having said that you need to be bit careful with using these stdout/stderr for regular logging as these files are not archived/rolled over by default.
Last edited by abhi_thri on Wed Jul 11, 2018 5:26 am; edited 1 time in total |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 11, 2018 4:54 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
EricL wrote: |
I noticed there is "Log" statement can be used to generate events, with user trace enabled, can "Log" play the same role like "system.out.print" role in java? |
That throws messages to the system log; the event viewer in Windows or the logger daemon in Unix. Not equivalent to the system.out.print IMHO and will rapidly annoy other users / admins on any shared system  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 11, 2018 5:05 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
EricL wrote: |
I was trying to trace above LOG message 'BIPmsgs' MESSAGE 2951, but didn't see it from Event Viewer(I'm doing test on Windows), any idea why? |
I suspect this, from the InfoCenter on the THROW ESQL statement:
Quote: |
On Windows you must set SEVERITY to 3, so that the Windows event log reports the error correctly. |
Ah, the joy of Windoze  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 11, 2018 5:07 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
abhi_thri wrote: |
PS: In case you were using Java within IIB the stdout/stderr messages will go to stdout/stderr files at the Integration server runtime path - /<WorkPath>/components/<NodeName>/<IntegrationServer UUID> |
The OP is talking about ESQL not Java.
Also future readers should take note that the Integration Server UUID is not the Integration Server name, and changes every time the Integration Server is restarted. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
EricL |
Posted: Wed Jul 11, 2018 12:10 pm Post subject: |
|
|
Centurion
Joined: 10 Oct 2014 Posts: 102
|
Thanks Guys for the interesting....
I created a super simple workflow too, MQInput Node -> ComputeNode, and the ESQL script for ComputeNode is as:
CREATE COMPUTE MODULE Transformation_Compute
CREATE FUNCTION Main() RETURNS BOOLEAN
BEGIN
-- CALL CopyMessageHeaders();
-- CALL CopyEntireMessage();
CALL GenEvent();
RETURN TRUE;
END;
CREATE PROCEDURE CopyMessageHeaders() BEGIN
DECLARE I INTEGER 1;
DECLARE J INTEGER;
SET J = CARDINALITY(InputRoot.*[]);
WHILE I < J DO
SET OutputRoot.*[I] = InputRoot.*[I];
SET I = I + 1;
END WHILE;
END;
CREATE PROCEDURE CopyEntireMessage() BEGIN
SET OutputRoot = InputRoot;
END;
CREATE PROCEDURE GenEvent() BEGIN
SET OutputRoot = InputRoot;
LOG EVENT SEVERITY 1 CATALOG 'BIPmsgs' MESSAGE 2951 VALUES(1,2,3,4);
END;
END MODULE;
Strangely, after starting workflow, when I putin a message into the queue, I see the message is stucked in Queue, which suppose to be processed by MqInput Node, any idea why?
1. For the simplicity, I don't use any message format, so I use Message Domain: "BLOB : For messages with an unspecified format" for Input Message Parsing
2. All the rest settings are default settings
So basically, 2 questions here, how to enable MqInput Node to get message sent in queue? How to enable above script to generate event?
Thanks... |
|
Back to top |
|
 |
Vitor |
Posted: Wed Jul 11, 2018 12:55 pm Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
EricL wrote: |
Strangely, after starting workflow, when I putin a message into the queue, I see the message is stucked in Queue, which suppose to be processed by MqInput Node, any idea why? |
Message not committed?
MQInput node looking at the wrong queue name (or the right name in the wrong case)?
Or any other reason an application is unable to pick a message from a queue. Check UNCOMM on the queue and the spelling (and case) of the queue name.
EricL wrote: |
how to enable MqInput Node to get message sent in queue? |
Set the queue name in the MQInput node properties to match the queue with the message in it, and make sure the message is available to be read off
EricL wrote: |
How to enable above script to generate event? |
Get a message through the MQInput node.
My previous comments about severity on Windows platforms still hold.
Thanks...[/quote] _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
|