Add logging to replacedb