redirect output of an already running process

Long story short: you have launched your script/program but forgot to redirect the output to a file for later inspection. #!/usr/bin/python3 #sample endless running program that prints to stdout import time,datetime while True: print(datetime.datetime.now().time()) time.sleep(1) Using GNU Debugger you can re-attach to the process, then invoke the creation of a logfile and duplicate the file descriptor to make the system send the data to the new file, instead of the terminal:...

April 24, 2015 · Andrea Manzini