One Star

[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

  • Data Integration
30 REPLIES
Community Manager

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

Hi
Logrow? The message printed by tLogRow component? If so, you can use tFileOutputDelimited instead of tLogRow to output the result into file.
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

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

Hi
Logrow? The message printed by tLogRow component? If so, you can use tFileOutputDelimited instead of tLogRow to output the result into file.

Hi Shong
Thanks for answer
All I need now - is to have same log as in Run window in txt file
Parent job calls many child job (in cycle) and I need common log of whole work
same as it in Run window
Now it runs manually from Talend (in future seems it will not be so)
Logrow needed but it is not as important as System.out.println() - the Most important now
Is it possible to direct output in Run window simultaneously in txt file ?
Community Manager

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

Hi
I understand you now. But it is impossible to log all the message printed on the console to a file. If the log message captured by tStatCatcher does not meet your need. Usually, we customize the log message with tFixedFlowInput and append them into an existing log file. such as "The job begin to run, the start time is:"+TalendDate.getCurrentDate()
----------------------------------------------------------
Talend | Data Agility for Modern Business

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

Hi
if your running the job on a linux machine you could edit the shellscripts that runs the job to write all messages on the console into a .txt file?
java -Xms256M -Xmx256M -cp classpath.jar: repo.jbname.jbname --context=Default "$@" > /consoleoutput/example.txt
Regards,
Brandon
One Star

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

Hi
if your running the job on a linux machine you could edit the shellscripts that runs the job to write all messages on the console into a .txt file?
java -Xms256M -Xmx256M -cp classpath.jar: repo.jbname.jbname --context=Default "$@" > /consoleoutput/example.txt
Regards,
Brandon

Thanks
I run it now from Talend on Windows PC
is there syntax for Window ?
ps Talend is installed on Linux
but I coonecr from W7 PC station
One Star

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

Hi
I understand you now. But it is impossible to log all the message printed on the console to a file. If the log message captured by tStatCatcher does not meet your need. Usually, we customize the log message with tFixedFlowInput and append them into an existing log file. such as "The job begin to run, the start time is:"+TalendDate.getCurrentDate()

Thanks for answering
tFixedFlowInput is workaround
but I can't change now ALL jobs - (some of them are not mine just called from main job)
One Star

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

Sorry for bring this topic up, but in fact I had same issue in the past and I wrote a component that does the trick.
It allows you to redirect all the output from System.out and/or System.err to files on disk.
Check it here:
tRedirectOutput
http://www.talendforge.org/exchange/index.php?eid=837&product=tos&action=view
One Star

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

Thanks
I now work with
TAkend NOW
- but some guyas DO it - so I will send them
Community Manager

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

Sorry for bring this topic up, but in fact I had same issue in the past and I wrote a component that does the trick.
It allows you to redirect all the output from System.out and/or System.err to files on disk.
Check it here:
tRedirectOutput
http://www.talendforge.org/exchange/index.php?eid=837&product=tos&action=view

Hi brazabr
I have trying to test your component tRedirectOutput and it does not redirect the log message to a text file, it seems the component don't generate any Java code in the job generated code, am I missing something? Can you share a demo job?
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

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

Hi shong,
Please check attached image. You need to execute tRedirectOutput as first component or use a PreJob like I did.
Best,
Thiago Benvenuto
Community Manager

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

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
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

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

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.
One Star

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

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.
Community Manager

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

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
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

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

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 !! Smiley Happy
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
Community Manager

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

Hi Fedor
Glad to see you come back to your topic near one year later.Smiley Wink
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
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

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

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.
One Star

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

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

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

Hi Fedor
Glad to see you come back to your topic near one year later.Smiley Wink
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.
Seventeen Stars

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

Hi shong
I do not agree with you in the matter of redirecting the standard output to file as component.
I would suggest to integrate a fully up-to-date Log4J in Talend.
This would be much more helpful because we are very flexible. Unlike no it is a mess to switch debugging output on without changing the job.
Cheers
Jan
One Star

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

Totally agree, full Log4J integration would be perfect and allows us to redirect to whatever we want, in whatever format we want.
One Star

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

I'm trying to use 'tRedirectOutput' and it is not working fine for me. I can't redirect the "System.setOut" or "System.setError" to another file that is not the default configuration file defined in the component:

Exception in component tRedirectOutput_1
java.io.FileNotFoundException: /talend/opt/talend-jobs/ESPThunderheadBatchInput/C:/Talend/components/out (No such file or directory)

That path is defined in the component as "__COMP_DEFAULT_FILE_DIR__" and I'm trying to use a context variable that is being ignored.
Any idea? Any comment?
Btw: I'm using version 0.2 of the component.
One Star

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

I'm trying to use 'tRedirectOutput' and it is not working fine for me. I can't redirect the "System.setOut" or "System.setError" to another file that is not the default configuration file defined in the component:

Exception in component tRedirectOutput_1
java.io.FileNotFoundException: /talend/opt/talend-jobs/ESPThunderheadBatchInput/C:/Talend/components/out (No such file or directory)

That path is defined in the component as "__COMP_DEFAULT_FILE_DIR__" and I'm trying to use a context variable that is being ignored.
Any idea? Any comment?
Btw: I'm using version 0.2 of the component.

You can ignore my previous comment. It was another process running at the same time, that was creating the chaos.
One Star

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

Hi,
I am trying to download tRedirectOutput component from the link provided above. Download generated one file tRedirectOuput without any extension. Is it a ZIP file? or Do I need to use any software to extract this? Can any one let me know how to open this please?
Sorry this might be basic query but this is the first time I am downloading a new component.
Thanks in advance for your help!
Please see the file that is downloaded.
One Star

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

Hi all,
Is there way from which I can write all the log files that come in the run console to a text file??
"tRedirectOutput" this component I am able to download,but it'snot coming in the form of a ZIP file rather a single file,So I am not able to use this component ,please check and suggest some ways to solve this issue?
Community Manager

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

Hi 
If the download file is not a zip file, rename it as filename.zip and then unzip the archive file, refer to this KB article to install a custom component into Talend Studio. 
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

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

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:

Check attached image for the new options.

Thanks for sharing this component. it is really useful!
One Star

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

Hi all,
I am new in the Forum. I downloaded tRedirectOutput and saw, that the Component works only in a Job with console-outputs. If I have a parent job without outputs and subjobs with outputs, than I couldn't use the Component from the parent job. Is it so? Have you experiences?
Community Manager

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

Hi all,
I am new in the Forum. I downloaded tRedirectOutput and saw, that the Component works only in a Job with console-outputs. If I have a parent job without outputs and subjobs with outputs, than I couldn't use the Component from the parent job. Is it so? Have you experiences?

Hi Eduard 
The component should be used in each job where you need to redirect its output to a file.
Regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business