Log errors to logger if available