Re: [Tutor] Logging script output

2013-12-15 Thread Reuben
Thanks everyone - your posts helped me. On 16-Dec-2013 2:22 AM, "Alan Gauld" wrote: > On 15/12/13 18:01, Tobias M. wrote: > > Yes, I think the logging module is the best way to do it. >> And it's pretty easy, see this minimal example: >> >> import logging >> >> logging.basicConfig(filename="foo.

Re: [Tutor] Logging script output

2013-12-15 Thread Alan Gauld
On 15/12/13 18:01, Tobias M. wrote: Yes, I think the logging module is the best way to do it. And it's pretty easy, see this minimal example: import logging logging.basicConfig(filename="foo.log", level=logging.DEBUG) logging.debug("This is a log message") But The OP didn't ask how to record

Re: [Tutor] Logging script output

2013-12-15 Thread Tobias M.
Hi Reuben, Yes, I think the logging module is the best way to do it. And it's pretty easy, see this minimal example: import logging logging.basicConfig(filename="foo.log", level=logging.DEBUG) logging.debug("This is a log message") The log levels are a great way, to control how much will be lo

Re: [Tutor] Logging script output

2013-12-15 Thread Alan Gauld
On 15/12/13 17:43, Reuben wrote: Hi, What is the best way to log the output of a python script execution. Best is always going to be subjective and depend on a lot of parameters. It might be that the best way of capturing the output is to use file redirection: $ python myscript.py > logfile.

Re: [Tutor] Logging script output

2013-12-15 Thread Mark Lawrence
On 15/12/2013 17:43, Reuben wrote: Hi, What is the best way to log the output of a python script execution. Do we need to use the logging module of python? Regards, Reuben You don't need to, but why reinvent the wheel? Use your favourite search engine to find lots of articles on how to cu

[Tutor] Logging script output

2013-12-15 Thread Reuben
Hi, What is the best way to log the output of a python script execution. Do we need to use the logging module of python? Regards, Reuben ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mail