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

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



Hi again,

please find a corrected patch attached.

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())

The patch I sent a little bit earlier contained a flawed line. Please test with this patch.

Thanks,
Mike
commit 8bc58d7ed8201b2fad5cfc0da83b2dd052cf1ed3
Author: Mike Gabriel <mike.gabriel@das-netzwerkteam.de>
Date:   Mon Mar 18 11:01:37 2019 +0100

    Correctly initialize the loggers when using x2gobroker via WSGI in Apache2.

diff --git a/bin/x2gobroker b/bin/x2gobroker
index d5e8bdb..092f937 100755
--- a/bin/x2gobroker
+++ b/bin/x2gobroker
@@ -299,16 +299,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 +373,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: