added logtofile routine