Fix race condition in logger, and add error object into Error log