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

Bug#922042: Acknowledgement (x2gobroker: traceback when run as WSGI process from apache)



Control: tags -1 patch

Hi Linnea,

On Fri, 15 Feb 2019 16:15:05 +0100 Linnea Skogtvedt <linnea@linuxavdelingen.no> wrote:
> This issue appears to have been caused by this commit:
>
> https://code.x2go.org/gitweb?p=x2gobroker.git;a=commit;h=f9dd59dd656019f593d37d234a2859cc17696061
>
> This is supported by the fact that I could work around the bug by adding
> in the deleted code in a wsgi wrapper script as follows:
>
> # cat /etc/x2go/wsgi/x2gobroker.wsgi
>
> #!/usr/bin/python3
> from x2gobroker.loggers import logger_broker, logger_access,
> logger_error, tornado_log_request, PROG_NAME
> exec(open("/usr/bin/x2gobroker").read())
>
>
>

can you verify that the attached patch makes your workaround unnecessary?

Thanks+Greets,
Mike
diff --git a/bin/x2gobroker b/bin/x2gobroker
index d5e8bdb..84adae7 100755
--- a/bin/x2gobroker
+++ b/bin/x2gobroker
@@ -112,7 +112,6 @@ if __name__ == "__main__":
     setproctitle.setproctitle(os.path.basename(sys.argv[0]))
 
     index = 0
-    argv = []
     argv.append(sys.argv[0])
     double_dash_pos = 0
     double_dash_argv = []
@@ -299,16 +298,18 @@ if __name__ == "__main__":
 urls = ()
 settings = {}
 
-# raise log level to DEBUG if requested...
-if x2gobroker.defaults.X2GOBROKER_DEBUG and not x2gobroker.defaults.X2GOBROKER_TESTSUITE:
-    logger_broker.setLevel(logging.DEBUG)
-    logger_access.setLevel(logging.DEBUG)
-    logger_error.setLevel(logging.DEBUG)
+
 
 
 # run the Python Tornado standalone daemon or handle interactive command line execution (via SSH)
 if __name__ == "__main__":
 
+    # raise log level to DEBUG if requested...
+    if x2gobroker.defaults.X2GOBROKER_DEBUG and not x2gobroker.defaults.X2GOBROKER_TESTSUITE:
+        logger_broker.setLevel(logging.DEBUG)
+        logger_access.setLevel(logging.DEBUG)
+        logger_error.setLevel(logging.DEBUG)
+
     logfile_prelude(mode=cmdline_args.mode.upper())
 
     if cmdline_args.mode.upper() == 'HTTP' or PROG_NAME == 'x2gobroker-daemon':
@@ -371,6 +372,16 @@ else:
 
     ### launch as WSGI application ###
 
+    logger_broker = x2gobroker.loggers.logger_broker
+    logger_access = x2gobroker.loggers.logger_broker
+    logger_error = x2gobroker.loggers.logger_error
+
+    # raise log level to DEBUG if requested...
+    if x2gobroker.defaults.X2GOBROKER_DEBUG and not x2gobroker.defaults.X2GOBROKER_TESTSUITE:
+        logger_broker.setLevel(logging.DEBUG)
+        logger_access.setLevel(logging.DEBUG)
+        logger_error.setLevel(logging.DEBUG)
+
     prep_http_mode()
 
     import tornado.wsgi

Reply to: