log errors in a file