Logging output to be redirected to a particular folder
Peter Otten
__peter__ at web.de
Tue Nov 6 07:26:11 EST 2012
anuradha.raghupathy2010 at gmail.com wrote:
> Hi,
>
> Below is the python code that I have. I want to redirect the output to my
> C drive..myapp.log.
>
> I am editing and creating scripts in IDLE and running it as a python shell
> or module.
>
> Can you help?
>
> import logging
>
> def main():
> logging.basicConfig(Filename='c://myapp.log', level=logging.ERROR)
Python is case-sensitive. Try:
logging.basicConfig(filename='c://myapp.log', level=logging.ERROR)
> logging.debug('started debug')
> logging.info('info printing')
> logging.warning('test warning')
> logging.debug('debug again')
> logging.error('Error')
>
> if __name__ == '__main__':
> main()
More information about the Python-list
mailing list