Added error logging enabled check before logging error