Fix bug 2928: Log messages instead of using print