Add logging framework and start using it in a few places.