Where is the log file by tmux?

I use tmux to run a process in the background.

However, I could not find a location of the log file spit out by a session on tmux.

The "log file" should include an error stack, caused by the Python script I run in the background.

Does such log file exist on tmux? I'm on Ubuntu (16.04) and macOS (High Sierra).


Solution 1:

As a variant, you can install tmux-plugin.

  1. Clone tmux-plugins/tmux-logging from github.
  2. Create conf file (~/.tmux.conf), add to bottom of the config file: run-shell ~/clone/path/logging.tmux
  3. Type this in a terminal: $ tmux source-file ~/.tmux.conf
  4. Run tmux and toggle (to start) logging in the current pane: ctrl+b and shift+p
  5. Check file tmux-#{session_name}-#{window_index}-#{pane_index}-%Y%m%dT%H%M%S.log in user home dir.

Solution 2:

If you detached from the tmux session where you started your python script, the (standard) output and error of the script is not going to a file, it is kept by tmux. You can see it by reattaching to your session. Try:

tmux attach

This should reattach to your session, so you can see the output.