Fix logger

This PR fixes a few issues with the logger.
It also initializes the logger in the mian function.