So I just found pm2 and I really love it specially that it actually restarts whenever there is an error or something other similar stuff.
However I also read that it is possible to run python with it but I did found out an issue where it doesnt seem to use Global logs for Python in my case
Picture
So how do I print?
Im using a customize print that I call utils.py which looks like
class Logger:
def __init__(self):
colorama.init()
@staticmethod
def __timestamp():
timestamp = str(datetime.now().strftime("[%H:%M:%S.%f")[:-3]+"]")
return timestamp
def log(self, text):
sys.stdout.write("{}{} {}".format(self.__timestamp(), '[Profile-' + multiprocessing.current_process().name.replace("Process-", "").replace("MainThread", "MAIN") + ']', text))
sys.stdout.write("\n")
sys.stdout.flush()
and as you can see it contains stdout.
The problem here is now that whenever I am trying to call the function in our case logger.log("testing") it will not print out inside the Global logs of pm2 but it instead creates a new python.exe and executes the program there instead which I don't wish for. so I am here asking how can I possible make it so it runs through pm2 instead of its own python.exe?
