If you close all open instances of Visual Studio 2012 add the following undocumented registry key to your registry:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\11.0\General]
"EnableVSIPLogging"=dword:00000001
Visual Studio File.New VSDebug Message.
Visual Studio File.New VSDebug Message.

When you next start Visual Studio you can find the command ID for menu items by holding Ctrl+Shift and hovering over the menu item. After hovering you are presented with a modal dialog containing debug information as seen in the image to the right. This information can, for example, be useful in .vsct files when extending Visual Studio functionality.

This will work for most menu items although Ctrl+Shift hovering over dynamic menu items like those found on DEBUG menu will for some reason not pop up the dialog.

This information is shamelessly stolen from this MSDN blog post which also contains more in depth information about the topic.

Some useful .reg registry entries:

EnableVSIPLogging for Visual Studio 2005

EnableVSIPLogging for Visual Studio 2008

EnableVSIPLogging for Visual Studio 2010

EnableVSIPLogging for Visual Studio 2012

Left-click to preview them in your browser to check they’re not malicious then right-click and save them then double click to add to registry.