Added debug trace to the rest client
Fixed logging bug