Fix logging on py3