0

I want to get the Output of multiple strace calls in one file,
but i do not know how.

At the moment i am using:
strace -o tmpfile, but this just puts the output of one file in and then overrites the file with the new output.

Has anyone an idea, how to do this? I hope this is no dumb question.

Thanks in advance.

Naturjoghurt
  • 541
  • 6
  • 21

4 Answers4

2

Under the bash shell use the following command

strace -o >(cat >>outputfile) command [args] ...

This will pass to the -o flag an argument that will appear like a file, but will be instead a file descriptor to the standard input of the

cat >>outputfile

process. This process will append its input to the specified output file.

Diomidis Spinellis
  • 18,734
  • 5
  • 61
  • 83
  • I forgot to mention that I use this on my android phone, so i can not use cat this way. Maybe an other idea how to realize this? Thanks. – Naturjoghurt May 03 '13 at 15:04
0

Instead of strace -o somefile command, can you just do strace command >> somefile? Alternatively, assuming a similar version of strace, my manual for strace indicates this should work: strace -o "|tail -a somefile" command (the -o "|command" functionality is implemented by strace itself, not by the shell).

twalberg
  • 59,951
  • 11
  • 89
  • 84
  • The first soultion (with >>) does not work, because >> is not recognized. The Second soultion gives me a file with name: "|tail -a somefile" which contains only the last strace call. – Naturjoghurt May 05 '13 at 09:21
0

I could not manage to do this via the call itself (in the Android Shell).
I just read through all files and write them to one Log file.
This solution slows the whole process down, but was the only solution I found.

Naturjoghurt
  • 541
  • 6
  • 21
0

The strace output is on stderr, strace 2>> outfile did the trick for me. If you invoke strace as single command you have to call it like this: adb -e shell "strace -p pid 2>> file"

M. Reif
  • 866
  • 7
  • 20