2017-05-19 3:48 GMT+02:00 Leo Silver <leo.sil...@soholinux.com.au>: > I have written a several Python scripts to collect data from external > sources (an email account and an sftp site). > > In development I run the scripts from IDLE or the command line and can view > the output of various print statements in the scripts which helps me to > monitor progress and confirm correct operation. > > However, in production I will be running the scripts via Cron. > > Is there a recommended/ elegant way to collect this output on the fly for > later review/ processing. > > Previously I have written bash scripts simply redirecting the standard > output to a text file and emailed this back to myself but I would like to > do this directly within Python rather than having to wrap the Python script > in a bash script. > > Thanks, Leo. > _______________________________________________ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor >
Hi, There are two task here: as You wrote, firstly log must be written to files You could use the logging subsystem for this purpose https://docs.python.org/3/library/logging.html The second is to collect it and do someting. To do this You can use for example the scedule module https://docs.python.org/3/library/sched.html BR, George _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor