Fixed so that no logs are written unless a valid user is logged in. Solves issue #224 & #211