log before redirect