<?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: Issue While Trying To Write File Using Console Log in Talend Studio</title>
    <link>https://community.qlik.com/t5/Talend-Studio/Issue-While-Trying-To-Write-File-Using-Console-Log/m-p/2290724#M63976</link>
    <description>&lt;P&gt;Hi Tarunjit,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what is the issue ? Asuming you get an empty file log file ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a)&lt;/P&gt;&lt;P&gt;May you forget to call a close on your BufferedOutPutStream ?&lt;/P&gt;&lt;P&gt;Consider to put a reference to you&amp;nbsp;&lt;SPAN&gt;BufferedOutPutStream&amp;nbsp;to the globalMap and call it with close()&amp;nbsp; at the end of the job.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;b)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Use your PrintStream with the fileObj instead of the BufferedOutputStream&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BR&amp;nbsp; Bp&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Feb 2018 11:04:48 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-02-26T11:04:48Z</dc:date>
    <item>
      <title>Issue While Trying To Write File Using Console Log</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Issue-While-Trying-To-Write-File-Using-Console-Log/m-p/2290722#M63974</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Please find attached job design.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are trying to print console log to the txt file. Here is the code which we have written in tJAva_1.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File fileobj = &lt;STRONG&gt;new&lt;/STRONG&gt; File("D:/Talend/" + jobName + TalendDate.getDate("DDMMYYYY-HHmmss") +".txt");&lt;/P&gt;&lt;P&gt;PrintStream obj = &lt;STRONG&gt;new&lt;/STRONG&gt; PrintStream(&lt;STRONG&gt;new&lt;/STRONG&gt; BufferedOutputStream(&lt;STRONG&gt;new&lt;/STRONG&gt; FileOutputStream(fileobj)));&lt;/P&gt;&lt;P&gt;System.setErr(obj);&lt;/P&gt;&lt;P&gt;System.setOut(obj);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This code is logging only error information to the text file, e.g. error thrown from stored procedure. No other information is getting logged in to the text file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are basically logging steps in our job using tJavaRow component. We are expecting information from &amp;nbsp;tJavaRow component to get written in to text file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code which we have written in our tJavaRow component&lt;/P&gt;&lt;P&gt;System.out.println("Going to Process AgentId " + input_row.AgentID);&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2018 10:02:33 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Issue-While-Trying-To-Write-File-Using-Console-Log/m-p/2290722#M63974</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-26T10:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Issue While Trying To Write File Using Console Log</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Issue-While-Trying-To-Write-File-Using-Console-Log/m-p/2290723#M63975</link>
      <description>&lt;P&gt;Are you sure the Job is running? Can you show us your errors? I suspect that they are compilation errors, in which case you will not see any data as the job will not actually run.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do something very similar to this, but I split the output to be written to two different files as well as keeping it in the console. I do this using a tLibraryLoad component to import the commons-io-2.4.jar and then use the code below...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;java.io.File outputFile = new java.io.File("c:/temp/output.txt");
java.io.FileOutputStream fosOut = new java.io.FileOutputStream(outputFile);

org.apache.commons.io.output.TeeOutputStream myOut = new org.apache.commons.io.output.TeeOutputStream(System.out, fosOut);
java.io.PrintStream psOut = new java.io.PrintStream(myOut, true); //true - auto-flush after println

java.io.File errorFile = new java.io.File("c:/temp/error.txt");
java.io.FileOutputStream fosErr = new java.io.FileOutputStream(errorFile);

org.apache.commons.io.output.TeeOutputStream myErr=new org.apache.commons.io.output.TeeOutputStream(System.err, fosErr);
java.io.PrintStream psErr = new java.io.PrintStream(myErr, true); //true - auto-flush after println

System.setOut(psOut);
System.setErr(psErr);&lt;/PRE&gt;</description>
      <pubDate>Mon, 26 Feb 2018 10:37:53 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Issue-While-Trying-To-Write-File-Using-Console-Log/m-p/2290723#M63975</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-26T10:37:53Z</dc:date>
    </item>
    <item>
      <title>Re: Issue While Trying To Write File Using Console Log</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Issue-While-Trying-To-Write-File-Using-Console-Log/m-p/2290724#M63976</link>
      <description>&lt;P&gt;Hi Tarunjit,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;what is the issue ? Asuming you get an empty file log file ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;a)&lt;/P&gt;&lt;P&gt;May you forget to call a close on your BufferedOutPutStream ?&lt;/P&gt;&lt;P&gt;Consider to put a reference to you&amp;nbsp;&lt;SPAN&gt;BufferedOutPutStream&amp;nbsp;to the globalMap and call it with close()&amp;nbsp; at the end of the job.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;b)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;Use your PrintStream with the fileObj instead of the BufferedOutputStream&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;BR&amp;nbsp; Bp&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2018 11:04:48 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Issue-While-Trying-To-Write-File-Using-Console-Log/m-p/2290724#M63976</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-26T11:04:48Z</dc:date>
    </item>
    <item>
      <title>Re: Issue While Trying To Write File Using Console Log</title>
      <link>https://community.qlik.com/t5/Talend-Studio/Issue-While-Trying-To-Write-File-Using-Console-Log/m-p/2290725#M63977</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Issue is resolved now. I forget to add tLogRow that's why one no error came no log was getting printed.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;</description>
      <pubDate>Mon, 26 Feb 2018 11:07:18 GMT</pubDate>
      <guid>https://community.qlik.com/t5/Talend-Studio/Issue-While-Trying-To-Write-File-Using-Console-Log/m-p/2290725#M63977</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-02-26T11:07:18Z</dc:date>
    </item>
  </channel>
</rss>

