Separate output for log file and stdout

amit.uttam at gmail.com amit.uttam at gmail.com
Mon May 19 16:58:28 EDT 2008


On May 16, 6:37 pm, Ben Finney <bignose+hates-s... at benfinney.id.au>
wrote:
> amit.ut... at gmail.com writes:
> > I've recently jumped big time into python and I'm working on a
> > software program for testing automation.
>
> Welcome, to both fields :-)
>

Thanks! I am having a great time learning and coding in python. It's
an amazing programming language.

> > I had a question about proper logging of output. What I would like
> > is:
>
> >  1. a function syslog (to log output to log file only)
> >  2. a function stdout (to log output to stdout only)
> >  3. a function sslog (to log output to both log and stdout)
>
> > Right now I am using StandOut module
>
> Have you investigated the 'logging' module in the Python standard
> library <URL:http://www.python.org/doc/lib/module-logging>? It appears
> to meet your listed requirements, without need of external
> dependencies.

Hmm..Yeah I didn't realize python had its own standard logging
facility. I took a look at it and it seems to do the job. However, the
output seems to be syslog style output. In the program I am writing,
the log file stores all the output of the commands being run (e.g. tcl
scripts, etc). Will this be possible using the built in python logging
module?

Thanks,
Amit



More information about the Python-list mailing list