While debugging a minor mode (separate issue), I wanted to generate a stack trace of the message function so I thought I would just enter
M-x debug-on-entry RET message
I was quite surprised to see that this method did not work. No stack trace was generated instead I started to get the error
Lisp nesting exceeds `max-lisp-eval-depth'
Which probably means that the message function was being called from the debugger, and debugger was calling message again making an infinite loop. Is there a more fool-proof way of generating full traces of who called the message function ?