From Joomla! Documentation
Revision as of 09:33, 18 October 2010 by Niloy
Calling this function will get you the current message on the stack but will also remove them from the stack.
If you want to just check the messages without removing them, this is the code:
$messages = JFactory::getSession()->get('application.queue'); print_r($messages);