Browse Source

HUE-561. Spawning creates incorrect log file names

A side-effect of this fix is that the log file name gets inherited by children
processes. E.g. runserver -> runspawningserver -> spawning child, and all 3 of
them will write to `runserver.log', which isn't a bad thing for management
simplicity.
bc Wong 14 năm trước cách đây
mục cha
commit
602cd98bb1
1 tập tin đã thay đổi với 7 bổ sung2 xóa
  1. 7 2
      desktop/core/src/desktop/settings.py

+ 7 - 2
desktop/core/src/desktop/settings.py

@@ -31,6 +31,8 @@ import pkg_resources
 HUE_DESKTOP_VERSION = pkg_resources.get_distribution("desktop").version or "Unknown"
 NICE_NAME = "Hue"
 
+ENV_HUE_PROCESS_NAME = "HUE_PROCESS_NAME"
+
 ############################################################
 # Part 1: Logging and imports.
 ############################################################
@@ -40,8 +42,11 @@ DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 
 # Start basic logging as soon as possible.
-_proc = os.path.basename(len(sys.argv) > 1 and sys.argv[1] or sys.argv[0])
-desktop.log.basic_logging(_proc)
+if ENV_HUE_PROCESS_NAME not in os.environ:
+  _proc = os.path.basename(len(sys.argv) > 1 and sys.argv[1] or sys.argv[0])
+  os.environ[ENV_HUE_PROCESS_NAME] = _proc
+
+desktop.log.basic_logging(os.environ[ENV_HUE_PROCESS_NAME])
 
 logging.info("Welcome to Hue " + HUE_DESKTOP_VERSION)