[resolved] save output in run-window to txt file

One Star

Re: [resolved] save output in run-window to txt file

Thank you Shong
Five Stars

Re: [resolved] save output in run-window to txt file

Hi Shong,

 

Since it has been serveral years after this function has been asked for, has this implanted into generic Talend functions yet?

 

I have a project need to log every single error into a file, including some errors like ('unparsable date format' etc.) which tlogcatcher can not catch. I am sure I can use schema check to solve some of the cases. But if I can just write whatever shows in the console to a file will be easier way to do right?

 

Because it is a huge project that almost not realistic change every single subjob so I can only make change to the parent job, so the tRedirectOuput may be not the best choice for me.

 

Please let me know if there is any update. Thanks. 

Four Stars

Re: [resolved] save output in run-window to txt file

Hi,

I have used tRedirectOutput component on my Talend job which is scheduled on windows but i am unable to redirect the output to .txt file.I have selected System.out option with append option.Please help me.

Moderator

Re: [resolved] save output in run-window to txt file

Hello,

What's talend build version you are using? Is this custom component tRedirectOutput compatible with your current studio version?

Best regards

Sabrina

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: [resolved] save output in run-window to txt file

Hello Sabrina,

Thank you for your reply,
the build version is 6.4 and tRedirectOutput is custom component compatible
with this version.If i run the job on talend studion in local, it is
sending all System.out log into the file but on server(windows) i have
scheduled the job where it is not able to collect the System.out into the
file.Please help.

Regards,
Shivaraj
Moderator

Re: [resolved] save output in run-window to txt file

Hello Shivaraj,

Could you please stick to one topic:https://community.talend.com/t5/Design-and-Development/unable-to-log-output-from-tRedirectOutput-cus... so that we can pay individule attention to it.

Many thanks.

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: [resolved] save output in run-window to txt file

Hi,

 

I just came across this thread, I found this solution, which works perfectly for a single job.

 

Add the following code to a tJava at the beginning of your job. if you haven't created the log directory you can add tCreateTemporaryFile before the tJava and check the box "Remove file when execution is over". this will create the directory for you if you don't have it already.

 

java.io.File folder = new java.io.File("/var/");

java.io.File logFile = new java.io.File("/var/textLog.log");

java.io.PrintStream ps = new java.io.PrintStream(new java.io.FileOutputStream(logFile));
System.setOut(ps);
System.setErr(ps);

Moderator

Re: [resolved] save output in run-window to txt file

Hello fatemeh.behfar,

Thanks for sharing your solution with us.

Best regards

Sabrina

 

 

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download