From 49dbd4c5c99b3df99cdd9ae54403265180f80d56 Mon Sep 17 00:00:00 2001
From: Chris Hines <chris.hines@monash.edu>
Date: Tue, 2 Feb 2021 13:01:22 +1100
Subject: [PATCH] more logging on tws to try to find the 502 errors, less on
 tes

---
 tes/tes_wsgi.py      | 2 +-
 twsproxy/__init__.py | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/tes/tes_wsgi.py b/tes/tes_wsgi.py
index dd21e8f..2c1ae62 100644
--- a/tes/tes_wsgi.py
+++ b/tes/tes_wsgi.py
@@ -2,7 +2,7 @@ import logging
 FORMAT = "[%(asctime)s %(thread)d %(levelname)s:%(process)s %(filename)s:%(lineno)s - %(funcName)20s() ] %(message)s"
 logging.basicConfig(filename="/var/log/strudel2/tes.log",format=FORMAT)
 logger=logging.getLogger()
-logger.setLevel(logging.DEBUG)
+logger.setLevel(logging.WARNING)
 import argparse
 parser = argparse.ArgumentParser()
 parser.add_argument('--configdir')
diff --git a/twsproxy/__init__.py b/twsproxy/__init__.py
index 7ab7ffc..e71ef8d 100644
--- a/twsproxy/__init__.py
+++ b/twsproxy/__init__.py
@@ -50,6 +50,7 @@ class TWSProxy(threading.Thread):
                 keepreading = False
 
         if port is not None:
+            logger.debug('Found the correct SSH Port')
             self.ssock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
             self.ssock.setblocking(True)
             try:
@@ -58,11 +59,13 @@ class TWSProxy(threading.Thread):
                     return (header,bytessofar)
                     #TWSProxy.reliablesend(self.ssock,header[0:bytessofar],bytessofar)
             except ConnectionRefusedError as e:
+                logger.error('Couldn\'t open connection to the SSH Tunnel')
                 self.ssock.close()
                 self.csock.close()
                 closed.set()
                 return (None,None)
         else:
+            logger.error('Failed to authenticate to the SSH Tunnel')
             self.csock.close()
             closed.set()
             return (None,None)
-- 
GitLab