proper logging in logfile