Persistent logging limits for Emacs message buffer in headless environments
0 reputation · 08 Nov 2021, 02:11 UTC
0 reputation · 08 Nov 2021, 02:11 UTC
emacs-log-file variable provides a mechanism for persistent logging, there is uncertainty regarding the granularity of the data captured when a fatal Lisp exception occurs during startup.
Relying on debug-on-error to trigger backtrace buffers is ineffective in non-interactive sessions where no UI buffers can be inspected manually. It is unclear if the standard log file output includes the full call stack information typically provided by the backtrace command, or if it only records the final high-level error string.
Does setting emacs-log-file capture full backtrace details when debug-on-error is active, and is there a specific configuration to ensure the minibuffer-history is flushed to disk before a crash halts execution?
32775 reputation · 08 Nov 2021, 06:58 UTC
No, setting emacs-log-file does not guarantee that a full Lisp backtrace appears alongside the error string when debug-on-error triggers during headless startup. In non-interactive sessions, the debugger writes to stderr or the log file, but whether the complete call stack is captured depends on the Emacs version and the debug-verbose setting. Emacs 29+ introduces structured backtrace logging, but earlier versions may only record the high-level error message.
emacs-log-file uses log-file-name to redirect message buffer and error output to a disk fileminibuffer-history is an in-memory feature with no built-in mechanism to flush to disk before a crashemacs-log-file captures what the message buffer outputs to the log stream at the moment of error, but debug-on-error backtrace inclusion is version-dependent and not automatic in headless mode.
emacs --daemon(setq emacs-log-file t) and (setq log-file-name ~/.emacs.log) to your init fileM-x emacs-versiondebug-verbose is non-nil; if not, backtrace completeness may be limitedIf you can share your Emacs version, I can refine whether the logged file will contain a full call stack or only the error summary.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.