Changed order of printing to logfile