Difference among various logging methods

Sabniveesu Shashank shashank at linux.com
Fri Jul 25 23:49:27 UTC 2014


Thank you very much for the explanation Neutrino!

 <http://about.me/shashank.computers>


S.V.R.S.N. Shashank
about.me/shashank.computers
    <http://about.me/shashank.computers>

We’ve created the greatest collection of shared knowledge in history. Help
protect Wikipedia. Donate now: https://donate.wikimedia.org


On Tue, Jul 22, 2014 at 7:13 PM, E-Neutrino <e-neutrino at web.de> wrote:

> Am 22.07.14 22:37, schrieb Sabniveesu Shashank:
> > [Avoiding application specific details for brevity; Please ask if needed]
> >
> > Hi!
> >
> > I could log data from an NS3 script into terminal. To save it, I did
> >
> > ./waf --run=first|tee first.txt   (I see output on terminal; just an
> > empty file is created)
> >
> > ./waf --run=first > first.txt     (I see output on terminal; just an
> > empty file is created)
> >
> > ./waf --run=first >& first.txt    (saved 327 MB)
> >
> > I found the last one in a blog. I don't understand why it alone is
> working.
> >
> > Can someone respond?
>
>  I don't know waf, but it looks like it outputs to stderr instead of
>  stdout.  So the correct method would be
>
>     ./waf --run=first 2> first.txt
>
>  or (if you want to use tee)
>
>     ./waf --run=first 2>&1 | tee first.txt
>
>  the second form captures both stderr and stdout in first.txt
>
>  An alternative way (without parallel terminal output) would be
>
>     ./waf --run=first > first.txt 2>&1
>
>  note the order of redirections: first you connect "first.txt" to the
>  stdout channel, then you connect the stdout channel into the stderr
>  channel.  The other order would not work.
>
>
>  Hope this helps
>
>     Neutrino
>
> --
> Computers help us to solve problems we don't have without computers.
>
> --
> ubuntu-users mailing list
> ubuntu-users at lists.ubuntu.com
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20140725/3feca075/attachment.html>


More information about the ubuntu-users mailing list