This is based on the logging part of QtWebApp from Stefan Frings
Some changes have been made to support the option of having a console logging plus optional file logging