Adding logging to various places.