Fix logging to use correct logger

- fix import statement to prevent accidental usage
Update to_encoding to be forward compatible with python3
Make imports python3 compatible