logging and config dir related fixes

replaced stdout redirection by propper logging
only create the config dir when it is actually needed
don't start logging before an existing mailnag instance has been shut down