Adding debug logging for messages