How can I redirect both stderr and stdin at once

command > file.log 2>&1 : Redirect stderr to "where stdout is currently going". In this case, that is a file opened in append mode. In other words, the &1 reuses the file descriptor which stdout currently uses.
command 2>&1 | tee -a file.txt