GNU screen has an amazing config option that I used almost all the time:
The problem is that tmux doesnt have the same option :( the closest thing I have seen is the "pipe-pane" option, but I couldnt find any way to automate that upon startup of tmux. I figured, well since tmux doesnt let me do it, maybe I can hack something together myself. And thats exactly what i did. I give to you...tmux output logging via the script command:
The above code basically checks if the $TERM variable is set to "screen" (tmux does this by default) and then check if the parent PID's name is "tmux". then it sets up a logging environment and output everything to the logfile it specifies.
That code works for OSX, for your basic GNU linux setup try this instead:
All you have to do is put that code into your .profile or .bashrc/.bash_profile and you are good to go.