Home | About | Sematext search-lucene.com search-hadoop.com
 Search Hadoop and all its subprojects:

Switch to Plain View
Pig >> mail # user >> How to redirect the Pig script summary to a file


+
shan s 2012-06-13, 16:05
+
Prashant Kommireddi 2012-06-13, 22:21
+
shan s 2012-06-14, 04:55
+
Jonathan Coveney 2012-06-14, 05:17
Copy link to this message
-
Re: How to redirect the Pig script summary to a file
1>a.txt will redirect anything written to System.out to the file. All diagnostic operators, dump statement write to System.out and hence it will be written to a.txt.

Some of the [INFO] messages which you see in the console are from log4j which is configured to print to System.err. Following is extracted from hadoop log4j properties file. So for redirecting both stdout and stderr as prashant pointed out &>a.txt is the way to go.

log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.target=System.err

Thanks
-- Prasanth J

On Jun 14, 2012, at 1:17 AM, Jonathan Coveney wrote:

> Shan, while Prashant's solution works, why not just have a STORE statement
> to the local filesystem? This is the much cleaner way to do it.
>
> 2012/6/13 shan s <[EMAIL PROTECTED]>
>
>> It works, thanks.
>> I looked up http://tldp.org/LDP/abs/html/io-redirection.html but still
>> could not figure why your suggestion works.
>>
>> If & is inclusive of 1 & 2, either 1 or 2 should have worked... But 1>a.txt
>> ignores it.
>> Curious..Could you please explain.
>> Thanks!
>> On Thu, Jun 14, 2012 at 3:51 AM, Prashant Kommireddi <[EMAIL PROTECTED]
>>> wrote:
>>
>>> Try
>>>
>>> pig -x mapred -l logs -param $xyz=1000 pqr.pig &>a.txt
>>>
>>> On Wed, Jun 13, 2012 at 9:05 AM, shan s <[EMAIL PROTECTED]> wrote:
>>>
>>>> How do I store the pig console output  to a file.
>>>> pig -x mapred -l logs -param $xyz=1000 pqr.pig >> a.txt does not work
>> for
>>>> me. Are there any tricks to make this work?
>>>> Or is it available somewhere else.
>>>>
>>>> Thanks, Prashant.
>>>>
>>>
>>