[virt-tools-list] [RFC PATCH 01/10] virt-manager.py: Fix setup_logging to be a bit more general
Cole Robinson
crobinso at redhat.com
Mon Apr 18 18:06:43 UTC 2011
Signed-off-by: Cole Robinson <crobinso at redhat.com>
---
src/virt-manager.py.in | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/virt-manager.py.in b/src/virt-manager.py.in
index 91e0f82..67b151f 100755
--- a/src/virt-manager.py.in
+++ b/src/virt-manager.py.in
@@ -133,14 +133,14 @@ def drop_stdio():
os.dup2(0, 1)
os.dup2(0, 2)
-def setup_logging(debug_stdout):
+def setup_logging(appname, debug_stdout):
# Configure python logging to capture all logs we generate
- # to $HOME/.virt-manager/virt-manager.log This file has
+ # to $HOME/.virt-manager/${app}.log This file has
# proved invaluable for debugging
MAX_LOGSIZE = 1024 * 1024 # 1MB
ROTATE_NUM = 5
DIR_NAME = ".virt-manager"
- FILE_NAME = "virt-manager.log"
+ FILE_NAME = "%s.log" % appname
FILE_MODE = 'ae'
FILE_FORMAT = ("[%(asctime)s virt-manager %(process)d] "
"%(levelname)s (%(module)s:%(lineno)d) %(message)s")
@@ -173,9 +173,7 @@ def setup_logging(debug_stdout):
"%(asctime)s (%(module)s:%(lineno)d): %(message)s"))
rootLogger.addHandler(streamHandler)
- global logging_setup
- logging_setup = True
- logging.info("Application startup")
+ logging.info("%s startup" % appname)
# Register libvirt handler
def libvirt_callback(ctx_ignore, err):
@@ -363,7 +361,10 @@ def main():
raise RuntimeError(_("Unable to initialize GTK: %s") % gtk_error)
raise gtk_error
- setup_logging(options.debug)
+ setup_logging(appname, options.debug)
+ global logging_setup
+ logging_setup = True
+
logging.debug("Launched as: %s" % origargs)
logging.debug("GTK version: %s" % str(gtk.gtk_version))
--
1.7.4
More information about the virt-tools-list
mailing list