Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error log of make command in Linux

I am compiling a kernel module and it has many compilation errors in it. After running "make", the errors thrown out are too many to fit in the screen. Scrolling up doesn't reach the first error. I tried capturing the errors by doing make &2 > log which didn't work (log file was empty and the error messages were still dumped on screen).

Can someone please tell me how to go about logging all the messages generated during compilation/make into a logfile?

like image 327
Vishal Sagar Avatar asked Apr 28 '10 13:04

Vishal Sagar


People also ask

How do I check error logs in Linux?

Linux logs will display with the command cd/var/log. Then, you can type ls to see the logs stored under this directory. One of the most important logs to view is the syslog, which logs everything but auth-related messages.

Where is error log file in Linux?

For searching files, the command syntax you use is grep [options] [pattern] [file] , where “pattern” is what you want to search for. For example, to search for the word “error” in the log file, you would enter grep 'error' junglediskserver. log , and all lines that contain”error” will output to the screen.


2 Answers

If you want to watch it scroll past, too:

 make 2>&1 | tee log

(/bin/sh, bash and related) This sends the standard error to the same place as the standard output, then pipes them through tee to capture the result and still get screen action.

like image 164
dmckee --- ex-moderator kitten Avatar answered Nov 10 '22 12:11

dmckee --- ex-moderator kitten


Try doing:

make >&log

the & after the > tells the shell to dump both stdout and stderr to the log. This can also be used with pipes.

like image 22
Nathan Fellman Avatar answered Nov 10 '22 13:11

Nathan Fellman