Scrollback is fine until the thing you need scrolled off the top an hour ago. When I want a record of what a pane printed, I’d rather have tmux write it to a file as it happens.
That is what pipe-pane does. It sends the output of a pane to a shell command of your choice, and cat appending to a file is the simplest one:
tmux pipe-pane -o 'cat >>~/output.#I-#P'
The #I and #P are replaced by the window and pane index, so every pane gets its own file. The -o flag only opens a pipe when none is open yet, which makes the command a toggle. Run tmux pipe-pane with no command at all and the current pipe is closed.
The tmux man page shows the toggle as a key binding, and that is how I’d use it. Put this in ~/.tmux.conf:
bind-key C-p pipe-pane -o 'cat >>~/output.#I-#P'
Now prefix plus Ctrl-p starts logging the current pane, and the same keys stop it. I find that useful for a long upgrade or a build I want to read back later without keeping the pane alive.
By default the pane’s output goes to the command (that is -O). There is also -I, which works the other way: whatever the command prints is typed into the pane. I’d leave that one alone unless you know why you want it.
Caveat: a pane can only have one pipe at a time, and starting a new one closes the old one. The file also gets the raw output, so colours and cursor movements end up in it as escape codes. less -R shows those files a lot better than a plain editor does.
Further reading: tmux manual: pipe-pane, On this site: tmux new -d runs a command that survives logout