Reputation: 349
I am building code in C using make , how would I save build logs ?
Upvotes: 2
Views: 4472
Reputation: 21517
In addition to redirection proposed by another answers, consider the script utility which writes the complete log of your interaction with a shell and its children or with another program: both input and output.
Sometimes you have to intervene during make, fix something in place when it fails, restart again. When a thing like that is done in a hurry, it's beneficial to have a protocol of what you've done without having to think of logging or recording when you do it.
Upvotes: 0
Reputation: 6086
If you use standard make, I assume you do it through a terminal, so you would only have to do : make >> mylogfile.log
.
For more tricks about I/O redirection, take a look here.
Upvotes: 1
Reputation: 416
If you want to save the output of make then use:
make 1>std.out 2> err.out
The 1 means the standardoutput and 2 the erroroutput
Upvotes: 1
Reputation: 409442
If you both want to save the log and see it on the console, you could use the tee
command:
make 2>&1 | tee build.log
The 2>&1
part is telling the shell to redirect stderr
to stdout
.
Upvotes: 7
Reputation: 400069
Typically the most interesting output (compiler warnings and errors) goes to stderr. In bash:
$ make 2> out
Then inspect the file nameed out
. The 2>
is a Bash output redirection operator.
Upvotes: 2