I have a console application that needs to be run as part of the deployment of a new application version on my server.
This console application is designed to output to the console, and cannot be changed.
I'd like to run it as normal, but have stdout and stderr logged to a file at the same time they're output to the console.
How can I do that on Linux?
tee
, plenty of answers.script -a the_logfile
#and then run the apps from the 'script' environment, which will log also special characters, ctrl codes, etc, and could be used to "replay" the display if you manage to use it properly, ie watching the log from the same type of terminal and usnig the same lines/columns, and using a "more" or "less" that outputs control chars (ex:more -v the_logfile
)