I am developing a plugin, but during the activation phrase I am constantly facing bugs. However there is no easy way to display error messages, since echoing stuff would result in 'unexpacted output' error. I tried the admin_message hook but it doesn't work. How can I alert the user if some stage of the activation has failed with reason?
For testing purposes you can use the log system (php_error.log):
To output error to the user without the "Headers already sent" error, you can use the php function trigger_error:
With Wordpress must always be E_USER_ERROR or it won't display the message.
I know the error_log works perfectly since I'm using it, but the trigger_error displays to must information. Try it and see for your self :)