log error msgs to file