change logging error handling for Linux and MacOS