Redirect all shell output to a single file
Shell commands send two kinds of text to terminals: standard output and standard error stdout/stderr).
stdout are captured as 1,
stderr as 2,
If you want to send all output to a log file then use the following:
./shellscript >> /path/to/logfile 2>&1
2>&1 redirects standard error messages to standard out, which allows you to capture both to a single file.
Note that >> opens a file and writes to the end of it, > zeroes the file if it exists and then redirects to it.