Logging the reason for 500 response