1093762-Move mongo connection after logging is initialized and print error to co...

To preserve the error log, logging must be initialized before the mongo connection is attempted. Additionally, this error message should be printed to the console rather than simply hanging.

Fixes [BZ-1093762](https://bugzilla.redhat.com/show_bug.cgi?id=1093763)
You can do this with much less code. Try this:

```
logger = MagicMock()
getLogger.return_value = logger
```