Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Talend Studio Execution Log?

Hey sorry if that's super obvious but been looking around to find (or set up within a job) a way of putting what's printed in the console at runtime of a job?

 

Need this as planning to automatically run a job via Task Scheduler and want to have a way of finding out how it's run in case anything is wrong.

 

Thanks in advance!

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

If you are using the Enterprise Edition, the logs are kept for you and are viewable in the Talend Administration Center. If you are using the Open Source Edition, there is a little trick which will let you re-route the logs to a file of your choosing. Take a look here: https://www.rilhia.com/quicktips/quick-tip-redirect-output-console-file

View solution in original post

10 Replies
Anonymous
Not applicable
Author

If you are using the Enterprise Edition, the logs are kept for you and are viewable in the Talend Administration Center. If you are using the Open Source Edition, there is a little trick which will let you re-route the logs to a file of your choosing. Take a look here: https://www.rilhia.com/quicktips/quick-tip-redirect-output-console-file

cterenzi
Specialist
Specialist

In addition to the above, you can use your operating system's output redirection when calling the batch file or shell script that executes your job.

(e.g. C:\Path\YourJob.bat > Yourjob.log)
Anonymous
Not applicable
Author

Hey that's brilliant - thanks!

Just wondering if there's also a way to keep the log stream in app as well instead of re-routing it?

Anonymous
Not applicable
Author

I assume you are talking about my solution. I'm afraid I've not tried that (yet), but just Googled and found this....  https://stackoverflow.com/questions/16237546/writing-to-console-and-text-file

If it works, I'd be interested in hearing about it. Doesn't sound too difficult to test, but I am away from a machine with Talend on at the moment.

 

Anonymous
Not applicable
Author

Cheers, I'll play around with this tomorrow and share if I get it to work.
I'm also planning on creating a new log file with today's date so it's easier to document the executions.
Anonymous
Not applicable
Author

Hey Richard - just an update if you (or anyone else) is interested.

 

I managed to get this to work but there were some problems around loading the correct library for this.

First of all my final code is:

 

java.io.File outputFile = new java.io.File("/Users/george/Documents/testarchive/Log/output"+TalendDate.getDate("yyyyMMdd HHmmss")+".txt");
java.io.FileOutputStream fos = new java.io.FileOutputStream(outputFile);
    //we will want to print in standard "System.out" and in "file"
org.apache.commons.io.output.TeeOutputStream myOut=new org.apache.commons.io.output.TeeOutputStream(System.out, fos);
java.io.PrintStream ps = new java.io.PrintStream(myOut, true); //true - auto-flush after println
System.setOut(ps);

Since the TeeOutputStream function is in the org.apache.commons.io.output library I couldn't get it to work initially.

I couldn't install the library with a jar for some reason (even when selecting it it never appeared in my list of modules).

Instead I added a tLibraryLoad (pointing to the org.apache.commons.io.output) to run, triggering the tJava and et voila!

 

Feel free to update your tip article if you want to and thanks for all your help again!

 

 

Anonymous
Not applicable
Author

Awesome job! I shall remember this. I may add an update to my tutorial referencing your help, if you don't mind

Anonymous
Not applicable
Author

I just made one final change so I get the error messages logged in the file as well (last line):

java.io.File outputFile = new java.io.File("/Users/george/Documents/testarchive/Log/output"+TalendDate.getDate("yyyyMMdd HHmmss")+".txt");
java.io.FileOutputStream fos = new java.io.FileOutputStream(outputFile);
    //we will want to print in standard "System.out" and in "file"
org.apache.commons.io.output.TeeOutputStream myOut=new org.apache.commons.io.output.TeeOutputStream(System.out, fos);
java.io.PrintStream ps = new java.io.PrintStream(myOut, true); //true - auto-flush after println
System.setOut(ps);
System.setErr(ps);

Note this removes the automatic colourification of errors in the console - everything is printed in black instead.

Anonymous
Not applicable
Author

Nice work @gslokoski. I've added your code to my tutorial. I have credited you using your screen name here. Let me know if you would like me to credit you in some other way or if you want it removed.

https://www.rilhia.com/quicktips/quick-tip-redirect-output-console-file