[master 2/2] logging: be smarter logging UI module import errors.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Use the logging module and log the traceback.
---
 pyanaconda/gui.py  |    5 ++++-
 pyanaconda/text.py |    3 +++
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/pyanaconda/gui.py b/pyanaconda/gui.py
index 0e9809b..464712e 100755
--- a/pyanaconda/gui.py
+++ b/pyanaconda/gui.py
@@ -31,6 +31,7 @@ if flags.cmdline.has_key("dogtail"):
 
 import string
 import time
+import traceback
 import isys
 import iutil
 import sys
@@ -52,6 +53,7 @@ _ = lambda x: gettext.ldgettext("anaconda", x)
 
 import logging
 log = logging.getLogger("anaconda")
+stdout_log = logging.getLogger("anaconda.stdout")
 
 isys.bind_textdomain_codeset("redhat-dist", "UTF-8")
 iutil.setup_translations(gtk.glade)
@@ -1236,7 +1238,8 @@ class InstallControlWindow:
                 newScreenClass = loaded.__dict__[className]
                 break
             except ImportError, e:
-                print(e)
+                stdout_log.error("loading interface component %s" % className)
+                stdout_log.error(traceback.format_exc())
                 win = MessageWindow(_("Error!"),
                                     _("An error occurred when attempting "
                                       "to load an installer interface "
diff --git a/pyanaconda/text.py b/pyanaconda/text.py
index 5a8fdab..ce1a1c7 100644
--- a/pyanaconda/text.py
+++ b/pyanaconda/text.py
@@ -27,6 +27,7 @@ import os
 import isys
 import iutil
 import time
+import traceback
 import signal
 import parted
 import product
@@ -494,6 +495,8 @@ class InstallInterface(InstallInterfaceBase):
                     nextWindow = loaded.__dict__[className]
                     break
                 except ImportError as e:
+                    log.error("loading interface component %s" % className)
+                    log.error(traceback.format_exc())
                     rc = ButtonChoiceWindow(self.screen, _("Error!"),
                                       _("An error occurred when attempting "
                                         "to load an installer interface "
-- 
1.7.1.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux