Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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

Hi All
Can I save output in run-window to txt file ?
Try to do it through Stats&logs settings
but only statistics gathered (may be also log)
2012-10-05 18:10:28;TCd7dK;TCd7dK;TCd7dK;6132;THINKBI_DEV;j_java01;_b-_1UA4iEeKoMfxGjj3v1A;0.1;Default;;begin;;
and I need full output
including logrow and print in java

Labels (2)
37 Replies
Anonymous
Not applicable
Author

Hi shong,
Please check attached image. You need to execute tRedirectOutput as first component or use a PreJob like I did.
Best,
Thiago Benvenuto
0683p000009MAFN.jpg
Anonymous
Not applicable
Author

Hi Thiago
Thanks for your demo job, I test and it works fine. Well, I have the following suggestion about this component, it may make the component more useful in real case.
1. Add the append option to this component.
2. Add the job execution time before the log message, and the job end time after the log message
Shong
Anonymous
Not applicable
Author

Hi Shong,
Thanks for your feedback.
I'll add the "append" option as well as an option to output the start time of the job.
I don't know how to write my component in a way I can bind to some kind of event or action in the end of the job to display the execution time. Also don't think this is a problem because the component tChronometerStop can do this trick well. It will output to the console the execution time and other things, which will be redirect properly to the file.
Anonymous
Not applicable
Author

I updated the component with the options suggested by Shong. Thank you man.
Feel free to suggest other additions if you think it may help others.
You can download it here:
http://www.talendforge.org/exchange/index.php?eid=837&product=tos&action=view
Check attached image for the new options.
0683p000009MAFS.jpg
Anonymous
Not applicable
Author

Hi Thiago
I tested your new component and find the following problem:
If I check both 'Append system.out output' and 'Append system.error output' option, the job start time appears two times. For example:
the job starts at: 2013-05-04 17:02:43
the job starts at: 2013-05-04 17:02:43
1|shong
Exception in component tFileInputDelimited_1
java.lang.NumberFormatException: For input string: "a"
at java.lang.NumberFormatException.forInputString(NumberFormatException.java:48)
at java.lang.Integer.parseInt(Integer.java:449)
at java.lang.Integer.parseInt(Integer.java:499)
at routines.system.ParserUtils.parseTo_int(ParserUtils.java:87)
at routines.system.ParserUtils.parseTo_Integer(ParserUtils.java:94)
at community.tredirectoutputdemo_0_1.tredirectOutputDemo$1RowHelper_tFileInputDelimited_1.valueToConn(tredirectOutputDemo.java:539)
at community.tredirectoutputdemo_0_1.tredirectOutputDemo.tFileInputDelimited_1Process(tredirectOutputDemo.java:588)
at community.tredirectoutputdemo_0_1.tredirectOutputDemo.runJobInTOS(tredirectOutputDemo.java:1102)
at community.tredirectoutputdemo_0_1.tredirectOutputDemo.main(tredirectOutputDemo.java:954)
disconnected

To me, I would like to have only one 'append' option both for system.out and system.err output. If I check the 'append' option, all the log message, including system.out and system.err output will be redirected and appended to an existing file.
In addition, you can add the 'create directory if not exists' option to tRedirectOutput component, refer to tFileOutputDelimited component.

Shong
0683p000009MAFE.jpg
Anonymous
Not applicable
Author

Hi Everybody
I was a topic starter (really surpirised that I can't ctach output in txtx file - for test purposes
If complex job failed - imho it is really must have information - to find quickily where error happened
)
in New project seems we are going to use Talend
?1) Does this component included Now in Talend
?2) Does somebody use it now ?

ps Check - on 5.2 - seems OK
see in description : 5.0.2, 5.1.0, 5.1.1, 5.1.2, 5.1.3, 5.2.0, 5.2.1, 5.2.2, 5.3.0
Latest version is 5.3.1 - does it mean it will not work with it (or just it is Not tested yet) ?
pps
@brazabr - RESPECT - GOOD JOB !! 0683p000009MACn.png
I m DB programmer - so Java is my weakest point
seems it is good to have this skill when working with Talend
@Shong - desicion is up yo you - but this functionality is good candidate to include in standart components
Anonymous
Not applicable
Author

Hi Fedor
Glad to see you come back to your topic near one year later. 0683p000009MA9p.png
This component is not included in Talend now, but I agree with you that this component is very useful, we will consider to add it to Talend components family in future.
I am sure this component do also works in v5.3.1, brazabr don't update the extension on Talend Exchange yet.
Shong
Anonymous
Not applicable
Author

Here's an email from brazabr; I asked him about redirect to a variable:
To achieve your needs we would require a new component, It may be possible
but it would work a little bit different than what you want. The redirection of outputs
can only be done to Streams, not to Variables. In this case we would need to open a
memory stream and expose some fake Talend variables in the component for you to
get the content logged so far.
To achieve what you need I strongly suggest to write a "top" job and put the main
logic inside a subjob. This subjob would use the component to redirect the output to a
file. Then you read the file in the top job, after returning from subjob, and email the
result. This way you avoid access problems trying to read the stream while the program
could be trying to write to it. This is the way I use this component to notify my team of
errors in ETL jobs with this component.
Hope this can help you.
Anonymous
Not applicable
Author

Thank you brazabr, i was very helped by your Components.
For those who needs them i was helped with tPreJob and how to add a Component (becouse i wasn't able to use the Exchange feature) here:
http://deepinopensource.blogspot.it/2013/03/adding-mongo-components-to-talend-open.html
http://www.talendforge.org/forum/postgallery.php?pid=108119&filename=1.png
https://help.talend.com/display/TalendComponentsReferenceGuide53EN/tPrejob
Anonymous
Not applicable
Author

Hi Fedor
Glad to see you come back to your topic near one year later.0683p000009MA9p.png
This component is not included in Talend now, but I agree with you that this component is very useful, we will consider to add it to Talend components family in future.
I am sure this component do also works in v5.3.1, brazabr don't update the extension on Talend Exchange yet.
Shong

Hello all, hi Shong.
Is the component availble now?
I'm new in Talent and I will defiantly be happy to use it.
Thanks.