Search code examples
talend

talend - log level of tLogRow - log4j


I have a tLogRow component that logs the output of tSetGlobalVar and tContextDump. I have exported the job, and in the zip file I found a log4j which makes me think it is using this for the tLogRow component. Now, my question is how can I specify the log level for the tLogRow component? as I'll be only wanting to see its log on WARN or maybe DEBUG level.

And for my tLogRow component I have checked "Print content with log4j". enter image description here

Thank you in advance!


Solution

  • As @54l3d mentioned above, tLogRow component seems not be the ideal component for logging using log4j. I have achieved this via tJava instead:

    org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(this.getClass());
    logger.debug("MY_CONTEXT_NAME: " + context.MY_CONTEXT_NAME);
    logger.debug("GLOBAL MAP paramA: " + globalMap.get("paramA"));
    

    For the globalMap's values logging, please note that if the your tJava component that's performing the log is within the same subjob as the tSetGlobalVar, the value you have set will not be immediately reflected. I was only able to log the values set when it is on a different subjob than tSetGlobalVar.