Hi,

Albretch Mueller wrote:
> But how do you strace a program saving the output (of the stracing)
> in a logfile while you also save that program's output without making
> it part of the stracing?

man strace says:

  -o filename Write the trace output to the file  filename  rather
              than  to  stderr.

So strace normally directs its output to stderr. That's file descriptor 2.
You can redirect it by the "2>file" gesture of the shell:

  $ strace echo hello 2>file
  hello
  $ cat file
  execve("/bin/echo", ["echo"], [/* 35 vars */]) = 0
  brk(0)                                  = 0x13ba000
  ...
  exit_group(0)                           = ?
  +++ exited with 0 +++

Or you may use the mentioned -o option which will keep the tracee's stderr
out of the file:

  $ strace -o file echo hello
  hello
  $ cat file
  ...


Have a nice day :)

Thomas

Reply via email to