Implement error logging
PHPAPI-18: fixed initial logging implementation