From: John Dennis Date: Fri, 13 Nov 2015 20:10:31 +0000 (-0500) Subject: ipsilon-server-install sometimes fails to log & emit errors X-Git-Url: http://git.cascardo.info/?p=cascardo%2Fipsilon.git;a=commitdiff_plain;h=e174925404b5b60704dd2f19da8ae79171d4bd8b ipsilon-server-install sometimes fails to log & emit errors ipsilon-server-install may silently and immediately fail, nothing is emitted to the console nor captured in the log file, it's just a silent complete failure. An example that reproduces the problem is a hostname without any dots in it, e.g. "localhost". The log level is set after some code executes (e.g. arg parsing). If that code raises an error the exception handler will log it at the debug level, but because the log level has not been set yet to debug (it's still at the default error level) the message is not emitted. The log level should be set as soon as logging is initialized. An error message should be emitted to the console, therefore in additon to the exception handler logging the error to the debug log along with the stack trace it should also emit just the message to the console. Ticket: 202 Signed-off-by: John Dennis Reviewed-by: Patrick Uiterwijk --- diff --git a/ipsilon/install/ipsilon-server-install b/ipsilon/install/ipsilon-server-install index 7837527..74d995c 100755 --- a/ipsilon/install/ipsilon-server-install +++ b/ipsilon/install/ipsilon-server-install @@ -441,12 +441,12 @@ if __name__ == '__main__': opts = [] out = 0 openlogs() + logger.setLevel(logging.DEBUG) + try: fplugins = find_plugins() opts = parse_args(fplugins) - logger.setLevel(logging.DEBUG) - logger.debug('Installation arguments:') for k in sorted(opts.iterkeys()): logger.debug('%s: %s', k, opts[k]) @@ -459,7 +459,8 @@ if __name__ == '__main__': else: install(fplugins, opts) except Exception, e: # pylint: disable=broad-except - logger.debug(e, exc_info=1) + logger.info(str(e)) # emit message to console + logger.debug(e, exc_info=1) # add backtrace information to logfile if 'uninstall' in opts and opts['uninstall'] is True: logger.info('Uninstallation aborted.')