<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to redirect standard output to a file in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201471#M3553</link>
    <description>Avoid if possible stuff like "&amp;gt;&amp;gt;"... these are shell specifics concept and absolutely not portable...&lt;BR /&gt;I see that under the hood tlogrow uses plain System.out object.&lt;BR /&gt;So you could, at the beginning of you job, inside a tjava, redirect globally the standard output... insert this code (add buffering if you need):&lt;BR /&gt;-------------------------&lt;BR /&gt;java.io.File file = new java.io.File("/temp/mylogfile_test.txt");&lt;BR /&gt;java.io.PrintStream ps = new java.io.PrintStream(new java.io.FileOutputStream(file));&lt;BR /&gt;System.setOut(ps);&lt;BR /&gt;-------------------------&lt;BR /&gt;this will redirect at the job level to the file specified.&lt;BR /&gt;hope it helps</description>
    <pubDate>Thu, 12 May 2011 10:59:11 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2011-05-12T10:59:11Z</dc:date>
    <item>
      <title>How to redirect standard output to a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201467#M3549</link>
      <description>Hi, 
&lt;BR /&gt;I need to know if there is a way to redirect the standard output from a Talend job to a file. I know it can be done by modifying the scripts using the &amp;gt;&amp;gt; operator, but I need to know if there is a way to do it via Talend. 
&lt;BR /&gt;We would need this to redirect the output of a tLogRow, for example, to a file. At the moment we are doing this by using a customised version of tLogRow, which adds a file as a parameter, and appends the tLogRow output to this file, but surely there is a better way of doing this ? 
&lt;BR /&gt;If it cannot be done, is there a way to dynamically adjust the ".bat" and ".sh" files generated by talend, to add the "&amp;gt;&amp;gt;" operator automatically each time the job is exported ? 
&lt;BR /&gt;Thank you, 
&lt;BR /&gt;Louis</description>
      <pubDate>Sat, 16 Nov 2024 12:55:39 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201467#M3549</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2024-11-16T12:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect standard output to a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201468#M3550</link>
      <description>Hi Louis,&lt;BR /&gt;You can simply use a tFileOutputDelimited, that you put after your tLogRow, it will put in a file the same data that goes in the tLogRow.&lt;BR /&gt;Just create a row from your tLogRow to the tFileOutputDelimited.</description>
      <pubDate>Thu, 12 May 2011 10:30:22 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201468#M3550</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-05-12T10:30:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect standard output to a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201469#M3551</link>
      <description>&lt;BLOCKQUOTE&gt;
 &lt;TABLE border="1"&gt;
  &lt;TBODY&gt;
   &lt;TR&gt;
    &lt;TD&gt;Hi Louis,&lt;BR /&gt;You can simply use a tFileOutputDelimited, that you put after your tLogRow, it will put in a file the same data that goes in the tLogRow.&lt;BR /&gt;Just create a row from your tLogRow to the tFileOutputDelimited.&lt;/TD&gt;
   &lt;/TR&gt;
  &lt;/TBODY&gt;
 &lt;/TABLE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;BR /&gt;Thank you vgalopin, however this solution doesn't work for me for several reasons :
&lt;BR /&gt;I'd like to be able to reproduce the behaviour of the tLogRow component (the pretty table), without having to recode it each time I want to log data.
&lt;BR /&gt;I'd also like to log the full stack trace of a java exception ie the full
&lt;BR /&gt;
&lt;PRE&gt;Exception in component tFileInputProperties_1&lt;BR /&gt;java.io.FileNotFoundException: P:\export 2Talend\assistance_equipe_0.1\assistance_equipe_0.1\assistance_equipe\louisdevdivers\assistance_equipe_0_1\contexts\Default.properties (Le chemin d'accès spécifié est introuvable)&lt;BR /&gt;	at java.io.FileInputStream.open(Native Method)&lt;BR /&gt;	at java.io.FileInputStream.&amp;lt;init&amp;gt;(Unknown Source)&lt;BR /&gt;	at louisdevdivers.assistance_equipe_0_1.assistance_equipe.tFileInputProperties_1Process(assistance_equipe.java:443)&lt;BR /&gt;	at louisdevdivers.assistance_equipe_0_1.assistance_equipe.runJobInTOS(assistance_equipe.java:1977)&lt;BR /&gt;	at louisdevdivers.assistance_equipe_0_1.assistance_equipe.main(assistance_equipe.java:1848)&lt;/PRE&gt;
&lt;BR /&gt;Instead of the "message only" output I get from using a tLogCatcher.
&lt;BR /&gt;Louis</description>
      <pubDate>Thu, 12 May 2011 10:37:24 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201469#M3551</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2011-05-12T10:37:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect standard output to a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201470#M3552</link>
      <description>Louis, 
&lt;BR /&gt;If you want to reproduce the behaviour of the tLogRow, you can try to take the java code that it produces, paste it in a tJavaRow, and modify it to have a single column out of your tJavaRow that will contain the data parsed the same way than the tLogRow did. 
&lt;BR /&gt;To see the code produced by the tLogRow, click on the component, then click on the Code Viewer tab on the bottom left. You will be able to see the start, main and end parts of the component. 
&lt;BR /&gt;Here is what I got in the start part (it creates the table name and columns): 
&lt;BR /&gt; 
&lt;PRE&gt; class Util_tLogRow_1 {&lt;BR /&gt;        String[] des_top = { ".", ".", "-", "+" };&lt;BR /&gt;        String[] des_head = { "|=", "=|", "-", "+" };&lt;BR /&gt;        String[] des_bottom = { "'", "'", "-", "+" };&lt;BR /&gt;        String name="";&lt;BR /&gt;        java.util.List&amp;lt;String[]&amp;gt; list = new java.util.ArrayList&amp;lt;String[]&amp;gt;();&lt;BR /&gt;        int[] colLengths = new int;&lt;BR /&gt;        public void addRow(String[] row) {&lt;BR /&gt;            for (int i = 0; i &amp;lt; 0; i++) {&lt;BR /&gt;                if (row&lt;I&gt;!=null) {&lt;BR /&gt;                  colLengths&lt;I&gt; = Math.max(colLengths&lt;I&gt;, row&lt;I&gt;.length());&lt;BR /&gt;                }&lt;BR /&gt;            }&lt;BR /&gt;            list.add(row);&lt;BR /&gt;        }&lt;BR /&gt;        public void setTableName(String name) {&lt;BR /&gt;            this.name = name;&lt;BR /&gt;        }&lt;BR /&gt;            public StringBuilder format() {&lt;BR /&gt;            &lt;BR /&gt;                StringBuilder sb = new StringBuilder();&lt;BR /&gt;                &lt;BR /&gt;                return sb;&lt;BR /&gt;            }&lt;BR /&gt;        }&lt;BR /&gt;        Util_tLogRow_1 util_tLogRow_1 = new Util_tLogRow_1();&lt;BR /&gt;        util_tLogRow_1.setTableName("tLogRow_1");&lt;BR /&gt;        util_tLogRow_1.addRow(new String[]{});        &lt;BR /&gt;		int nb_line_tLogRow_1 = 0;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/I&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 12 May 2011 10:56:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201470#M3552</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-05-12T10:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect standard output to a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201471#M3553</link>
      <description>Avoid if possible stuff like "&amp;gt;&amp;gt;"... these are shell specifics concept and absolutely not portable...&lt;BR /&gt;I see that under the hood tlogrow uses plain System.out object.&lt;BR /&gt;So you could, at the beginning of you job, inside a tjava, redirect globally the standard output... insert this code (add buffering if you need):&lt;BR /&gt;-------------------------&lt;BR /&gt;java.io.File file = new java.io.File("/temp/mylogfile_test.txt");&lt;BR /&gt;java.io.PrintStream ps = new java.io.PrintStream(new java.io.FileOutputStream(file));&lt;BR /&gt;System.setOut(ps);&lt;BR /&gt;-------------------------&lt;BR /&gt;this will redirect at the job level to the file specified.&lt;BR /&gt;hope it helps</description>
      <pubDate>Thu, 12 May 2011 10:59:11 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201471#M3553</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-05-12T10:59:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect standard output to a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201472#M3554</link>
      <description>&lt;BLOCKQUOTE&gt; 
 &lt;TABLE border="1"&gt; 
  &lt;TBODY&gt; 
   &lt;TR&gt; 
    &lt;TD&gt;Avoid if possible stuff like "&amp;gt;&amp;gt;"... these are shell specifics concept and absolutely not portable...&lt;BR /&gt;I see that under the hood tlogrow uses plain System.out object.&lt;BR /&gt;So you could, at the beginning of you job, inside a tjava, redirect globally the standard output... insert this code (add buffering if you need):&lt;BR /&gt;-------------------------&lt;BR /&gt;java.io.File file = new java.io.File("/temp/mylogfile_test.txt");&lt;BR /&gt;java.io.PrintStream ps = new java.io.PrintStream(new java.io.FileOutputStream(file));&lt;BR /&gt;System.setOut(ps);&lt;BR /&gt;-------------------------&lt;BR /&gt;this will redirect at the job level to the file specified.&lt;BR /&gt;hope it helps&lt;/TD&gt; 
   &lt;/TR&gt; 
  &lt;/TBODY&gt; 
 &lt;/TABLE&gt; 
&lt;/BLOCKQUOTE&gt; 
&lt;BR /&gt;This is extremely helpfull, and exactly what I was looking for, thank you ! 
&lt;BR /&gt;vgalopin, I understand the concept of reproducing the code behind the tLogRow, (I created a custom component that does just that), I was looking for a more permanent solution, and redirecting the output via a tJava seems like it will do the trick. 
&lt;BR /&gt;Thank you.</description>
      <pubDate>Thu, 12 May 2011 11:10:30 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201472#M3554</guid>
      <dc:creator>_AnonymousUser</dc:creator>
      <dc:date>2011-05-12T11:10:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect standard output to a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201473#M3555</link>
      <description>emaxt6,
&lt;BR /&gt;That is exactly what I was looking for as well!!! Thanks a lot for the idea! so simple and elegant.
&lt;BR /&gt;Peter.</description>
      <pubDate>Thu, 12 May 2011 18:31:49 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201473#M3555</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2011-05-12T18:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect standard output to a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201474#M3556</link>
      <description>Don't forget that if you want to capture exception stack traces, you'll also have to do the same with System.err with System.setErr(...);</description>
      <pubDate>Thu, 12 May 2011 19:21:44 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201474#M3556</guid>
      <dc:creator>rbaldwin</dc:creator>
      <dc:date>2011-05-12T19:21:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect standard output to a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201475#M3557</link>
      <description>Interesting. Is it also possible to capture ALL output (Standard AND Error) into a string variable and email it at the end of the Talend Job?</description>
      <pubDate>Wed, 28 Aug 2013 07:05:52 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201475#M3557</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-08-28T07:05:52Z</dc:date>
    </item>
    <item>
      <title>Re: How to redirect standard output to a file</title>
      <link>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201476#M3558</link>
      <description>There's a tRedirectOutput component on Exchange (see &lt;A href="http://community.talend.com:80/t5/Deployment/resolved-save-output-in-run-window-to-txt-file/m-p/8414#M219"&gt;http://community.talend.com:80/t5/Deployment/resolved-save-output-in-run-window-to-txt-file/m-p/8414#M219&lt;/A&gt;) that will capture the output to a text file.  You could then use that as an attachment for tSendMail.</description>
      <pubDate>Thu, 29 Aug 2013 14:51:26 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/How-to-redirect-standard-output-to-a-file/m-p/2201476#M3558</guid>
      <dc:creator>alevy</dc:creator>
      <dc:date>2013-08-29T14:51:26Z</dc:date>
    </item>
  </channel>
</rss>

