Actions

JApplication/getMessageQueue

From Joomla! Documentation

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);