1

The scenario is below:

  1. I SSH to server Ubuntu 18.04.3 LTS (GNU/Linux 4.15.0-96-generic x86_64) using putty with my credentials, from Windows
  2. Go to the directory where I put my source code
  3. start Flask app by running command python3 main.py logs are showing on terminal
  4. however, after I left my computer for some time the session is disconnected/ended.
  5. I know the app still running because another team still can test the app
  6. when I re-login to the server and go to the same directory I don't want to kill/restart the already running app because it would interfere with others doing the test
  7. How to see the running log so I would know what testers are doing and occasionally catch what's wrong

my main.py code:

if __name__ == "__main__":
    ip = 'someip'
    port = 9053
    app.run(debug=True, host=os.getenv('IP', ip),
                port=int(os.getenv('PORT', port)), threaded=True)
Arif
  • 49
  • 1
  • 9

1 Answers1

0

you can save your python log on file, so you can review it any time, this the example of using logging lib:

import logging 

logger = logging.getLogger(<logging_name>)

fh = logging.FileHandler(<logging file>)

logger.addHandler(fh)
  • Thank you for the logging solution which is very useful, I have added log files. But while still in development I wrote too many print code in the script so that I can see what they print on console. – Arif Aug 07 '20 at 05:58