Many times you need to get log details on external files which Talend is not able to redirect or catch using standard Log management, but you know many times error displays on Talend run console but is not caught in error connector. so here is sample code which you can use in your job to redirect error or run console messages to file.
just at the beginning of you job place tJava, and inside a tjava, redirect globally the standard output… insert this code (add buffering if you need):
java.io.File file = new java.io.File(“/temp/mylogfile_test.txt”);
java.io.PrintStream ps = new java.io.PrintStream(new java.io.FileOutputStream(file));