Introduced logging

- Added some extra logging
- Forgot some places where the configured encoding should be used.