Added logging
Added logging
Merged logging from upstream