log before and after