My Emacs configuration (Emacs 27, Doom-Emacs config with lots of user-specific tweaks, running on MacOS) sometimes hangs at seemingly random times, and the kill -SIGUSR2 <emacs PID> has no effect. Debugging this would be a lot easier if there was a way to continuously redirect *Messages* and other debugging information to a log file, so I could identify what Emacs was doing (or trying to do) when it crashed.
Is there a way to continuously redirect/copy everything posted to the *Messages* and similar buffers to a file? Alternatively, is there a way to launch Emacs in "verbose" mode from the command line? Most of what I've found suggests running Emacs through gdb, but that's tricky (though not impossible) to set up on MacOS.