Use logger instead of printing. Update error message.