Search code examples
talend

Talend - Execution console not showing custom messages


I've created a testing purpose custom Talend component; following you have the begin, main and end javajet files:

begin:

<%
    imports...

<% 
    CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
    INode node = (INode)codeGenArgument.getArgument();
    String cid = node.getUniqueName();    
%>
System.out.println("I am the begin section");

for (int myvar_<%=cid%>=0; myvar_<%=cid%><10; myvar_<%=cid%>++) {

main:

<%
    imports...
%>
<% 
    CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
    INode node = (INode)codeGenArgument.getArgument();
    String cid = node.getUniqueName();  
%>
System.out.print("myvar is "+myvar_<%=cid%>);

end:

<%
    imports...
%>
<% 
    CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
    INode node = (INode)codeGenArgument.getArgument();
    String cid = node.getUniqueName();  
%>
}

System.out.println("I am the end section");

The problem is messages are not printed to console when using System.out.println().

This is an example of execution:

Starting job myjob at 07:16 15/06/2016.
[statistics] connecting to socket on port 4009
[statistics] connected
[statistics] disconnected
Job myjob ended at 07:16 15/06/2016. [exit code=0]

As much, I've found this link where another Talend user describes the same problem. Nevertheless, in my case I have the Compiler Compliance Level set to 1.8, and the same JRE installed.

Any ideas? Thanks!

EDIT 1

Adding the generated code, as suggested by @garpitmzn:

    /**
     * [tOrionTest_1 begin ] start
     */





        ok_Hash.put("tOrionTest_1", false);
        start_Hash.put("tOrionTest_1", System.currentTimeMillis());


    currentComponent="tOrionTest_1";


        int tos_count_tOrionTest_1 = 0;

System.out.println("I am the begin section");

for (int myvar_tOrionTest_1=0; myvar_tOrionTest_1<10; myvar_tOrionTest_1++) {   





/**
 * [tOrionTest_1 begin ] stop
 */

    /**
     * [tOrionTest_1 main ] start
     */





    currentComponent="tOrionTest_1";


System.out.print("myvar is "+myvar_tOrionTest_1);




    tos_count_tOrionTest_1++;

/**
 * [tOrionTest_1 main ] stop
 */

    /**
     * [tOrionTest_1 end ] start
     */





    currentComponent="tOrionTest_1";


}

System.out.println("I am the end section");


ok_Hash.put("tOrionTest_1", true);
end_Hash.put("tOrionTest_1", System.currentTimeMillis());




/**
 * [tOrionTest_1 end ] stop
 */

Solution

  • I changed the "startable" property to "true" and now it works. It seems the component was never running because it was the first in the job chain and not startable, which means (if I've understood well) it was expecting an input (from an startable component) that never came.