dmenu doesn't have built in logging, but it is a very simple program and it is not difficult to have it log it's output to a file.
First, determine where pacman has placed the dmenu files with pacman -Ql dmenu. You should get:
dmenu /usr/
dmenu /usr/bin/
dmenu /usr/bin/dmenu
dmenu /usr/bin/dmenu_path
dmenu /usr/bin/dmenu_run
...
You can then open /usr/bin/dmenu_run, which is just a shell script, and add a temporary hack to write all output to a file, like so:
dmenu_path | dmenu "$@" | ${SHELL:-"/bin/sh"} &>/home/michael/dmenu_log
Selecting emacs from dmenu will now fail, but you will get the output in your log file:
]P0000000]P85e5e5e]P18a2f58]P9cf4f88]P2287373]PA53a6a6]P3914e89]PBbf85cc]P4395573]PC4779b3]P55e468c]PD7f62b3]P62b7694]PE47959e]P7899ca1]PFc0c0c0[H[JVim: Warning: Output is not to a terminal
Vim: Warning: Input is not from a terminal
...and a lot more
which makes the error pretty clear when you remove all the escapes. To have Emacs work, you'd have to assign a terminal as well from dmenu, something along the lines of: urxvt -e emacs yourfile.txt.
There is a long dmenu hacking thread on the Arch boards which has all manner of interesting hacks for dmenu, it is well worth checking out.
1. I don't have Emacs installed, but you'll get the same error...