[X2Go-Commits] [x2gobroker] 01/01: Log to system broker.log file when run via x2gobroker-ssh. (Fixes: #1253).
git-admin at x2go.org
git-admin at x2go.org
Wed May 9 16:23:15 CEST 2018
This is an automated email from the git hooks/post-receive script.
x2go pushed a commit to branch master
in repository x2gobroker.
commit 59b3facb9b6c44e79f8c6ff372108a75da93497a
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date: Wed May 9 16:23:05 2018 +0200
Log to system broker.log file when run via x2gobroker-ssh. (Fixes: #1253).
---
x2gobroker/loggers.py | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/x2gobroker/loggers.py b/x2gobroker/loggers.py
index dd5d67e..2eb86e5 100644
--- a/x2gobroker/loggers.py
+++ b/x2gobroker/loggers.py
@@ -19,6 +19,7 @@
import os
import sys
+import pwd
import getpass
import logging
import logging.config
@@ -81,10 +82,14 @@ elif iniconfig_loaded and iniconfig.has_option('common', 'X2GOBROKER_LOGCONFIG')
else:
X2GOBROKER_LOGCONFIG="/etc/x2go/broker/x2gobroker-loggers.conf"
-# standalone daemon mode (x2gobroker-daemon) or interactive mode (called from the cmdline)?
-if getpass.getuser() in (X2GOBROKER_DAEMON_USER, 'root') and os.path.exists(X2GOBROKER_LOGCONFIG):
+# standalone daemon mode (x2gobroker-daemon)? or x2gobroker-ssh command invocation?
+if (
+ (getpass.getuser() in (X2GOBROKER_DAEMON_USER, 'root')) or
+ (pwd.getpwuid(os.geteuid()).pw_name in (X2GOBROKER_DAEMON_USER, 'root'))
+ ) and os.path.exists(X2GOBROKER_LOGCONFIG):
- # we run in standalone daemon mode, so let's use the system configuration for logging
+ # we run in standalone daemon mode or broker via SSH (with correct setup),
+ # so let's use the system configuration for logging
logging.config.fileConfig(X2GOBROKER_LOGCONFIG)
# create loggers
@@ -93,6 +98,7 @@ if getpass.getuser() in (X2GOBROKER_DAEMON_USER, 'root') and os.path.exists(X2GO
logger_error = logging.getLogger('error')
else:
+ # or interactive mode (called from the cmdline)?
logger_broker, logger_access, logger_error = init_console_loggers()
def tornado_log_request(handler):
--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/x2gobroker.git
More information about the x2go-commits
mailing list