Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #32814 > unrolled thread

Logging output to be redirected to a particular folder

Started byanuradha.raghupathy2010@gmail.com
First post2012-11-06 03:28 -0800
Last post2012-11-06 22:39 -0800
Articles 6 — 4 participants

Back to article view | Back to comp.lang.python


Contents

  Logging output to be redirected to a particular folder anuradha.raghupathy2010@gmail.com - 2012-11-06 03:28 -0800
    Re: Logging output to be redirected to a particular folder Peter Otten <__peter__@web.de> - 2012-11-06 13:26 +0100
    Re: Logging output to be redirected to a particular folder Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-11-06 12:38 -0500
    RE: Logging output to be redirected to a particular folder "Prasad, Ramit" <ramit.prasad@jpmorgan.com> - 2012-11-06 17:58 +0000
      Re: Logging output to be redirected to a particular folder anuradha.raghupathy2010@gmail.com - 2012-11-06 22:39 -0800
      Re: Logging output to be redirected to a particular folder anuradha.raghupathy2010@gmail.com - 2012-11-06 22:39 -0800

#32814 — Logging output to be redirected to a particular folder

Fromanuradha.raghupathy2010@gmail.com
Date2012-11-06 03:28 -0800
SubjectLogging output to be redirected to a particular folder
Message-ID<bdec816f-bde8-427a-b604-30e12a773595@googlegroups.com>
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)
   logging.debug('started debug')
   logging.info('info printing')
   logging.warning('test warning')
   logging.debug('debug again')
   logging.error('Error')

if __name__ == '__main__':
   main()

[toc] | [next] | [standalone]


#32815

FromPeter Otten <__peter__@web.de>
Date2012-11-06 13:26 +0100
Message-ID<mailman.3318.1352204779.27098.python-list@python.org>
In reply to#32814
anuradha.raghupathy2010@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()

[toc] | [prev] | [next] | [standalone]


#32835

FromDennis Lee Bieber <wlfraed@ix.netcom.com>
Date2012-11-06 12:38 -0500
Message-ID<mailman.3333.1352223519.27098.python-list@python.org>
In reply to#32814
On Tue, 06 Nov 2012 13:26:11 +0100, Peter Otten <__peter__@web.de>
declaimed the following in gmane.comp.python.general:

> anuradha.raghupathy2010@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)
>
	The double forward slashes might also be confusing... At the least,
unneeded...

>>> import os.path
>>> print os.path.normpath("c://somefile.log")
c:\somefile.log
>>> print os.path.normpath("c:\\somefile.log")
c:\somefile.log
>>> print os.path.normpath("c:\\tryfile.log")
c:\tryfile.log
>>> print os.path.normpath("c:\tryfile.log")
c:	ryfile.log
>>> print os.path.normpath("c:/tryfile.log")
c:\tryfile.log
>>> 

	Doubling back-slashes is needed to avoid the problem of literal
escapes corrupting the intent...
-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

[toc] | [prev] | [next] | [standalone]


#32837

From"Prasad, Ramit" <ramit.prasad@jpmorgan.com>
Date2012-11-06 17:58 +0000
Message-ID<mailman.3335.1352224715.27098.python-list@python.org>
In reply to#32814
Dennis Lee Bieber wrote:
> 
> On Tue, 06 Nov 2012 13:26:11 +0100, Peter Otten <__peter__@web.de>
> declaimed the following in gmane.comp.python.general:
> 
> > anuradha.raghupathy2010@gmail.com wrote:
[snip]
> > > 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)
> >
> 	The double forward slashes might also be confusing... At the least,
> unneeded...
> 
> >>> import os.path
> >>> print os.path.normpath("c://somefile.log")
> c:\somefile.log
> >>> print os.path.normpath("c:\\somefile.log")
> c:\somefile.log
> >>> print os.path.normpath("c:\\tryfile.log")
> c:\tryfile.log
> >>> print os.path.normpath("c:\tryfile.log")
> c:	ryfile.log
> >>> print os.path.normpath("c:/tryfile.log")
> c:\tryfile.log
> >>>
> 
> 	Doubling back-slashes is needed to avoid the problem of literal
> escapes corrupting the intent...

Or use the raw literal form r"c:\tryfile.log". I know several
people that prefer to use forward slashes as it works in both 
Windows and *nix.


~Ramit


This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.  

[toc] | [prev] | [next] | [standalone]


#32874

Fromanuradha.raghupathy2010@gmail.com
Date2012-11-06 22:39 -0800
Message-ID<58708428-cea7-4ff7-8665-c31c7e6dac3d@googlegroups.com>
In reply to#32837
Thanks ...this works perfectly fine now.

On Tuesday, November 6, 2012 11:28:46 PM UTC+5:30, Prasad, Ramit wrote:
> Dennis Lee Bieber wrote:
> 
> > 
> 
> > On Tue, 06 Nov 2012 13:26:11 +0100, Peter Otten <__peter__@web.de>
> 
> > declaimed the following in gmane.comp.python.general:
> 
> > 
> 
> > > anuradha.raghupathy2010@gmail.com wrote:
> 
> [snip]
> 
> > > > 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)
> 
> > >
> 
> > 	The double forward slashes might also be confusing... At the least,
> 
> > unneeded...
> 
> > 
> 
> > >>> import os.path
> 
> > >>> print os.path.normpath("c://somefile.log")
> 
> > c:\somefile.log
> 
> > >>> print os.path.normpath("c:\\somefile.log")
> 
> > c:\somefile.log
> 
> > >>> print os.path.normpath("c:\\tryfile.log")
> 
> > c:\tryfile.log
> 
> > >>> print os.path.normpath("c:\tryfile.log")
> 
> > c:	ryfile.log
> 
> > >>> print os.path.normpath("c:/tryfile.log")
> 
> > c:\tryfile.log
> 
> > >>>
> 
> > 
> 
> > 	Doubling back-slashes is needed to avoid the problem of literal
> 
> > escapes corrupting the intent...
> 
> 
> 
> Or use the raw literal form r"c:\tryfile.log". I know several
> 
> people that prefer to use forward slashes as it works in both 
> 
> Windows and *nix.
> 
> 
> 
> 
> 
> ~Ramit
> 
> 
> 
> 
> 
> This email is confidential and subject to important disclaimers and
> 
> conditions including on offers for the purchase or sale of
> 
> securities, accuracy and completeness of information, viruses,
> 
> confidentiality, legal privilege, and legal entity disclaimers,
> 
> available at http://www.jpmorgan.com/pages/disclosures/email.

[toc] | [prev] | [next] | [standalone]


#32875

Fromanuradha.raghupathy2010@gmail.com
Date2012-11-06 22:39 -0800
Message-ID<mailman.3357.1352270983.27098.python-list@python.org>
In reply to#32837
Thanks ...this works perfectly fine now.

On Tuesday, November 6, 2012 11:28:46 PM UTC+5:30, Prasad, Ramit wrote:
> Dennis Lee Bieber wrote:
> 
> > 
> 
> > On Tue, 06 Nov 2012 13:26:11 +0100, Peter Otten <__peter__@web.de>
> 
> > declaimed the following in gmane.comp.python.general:
> 
> > 
> 
> > > anuradha.raghupathy2010@gmail.com wrote:
> 
> [snip]
> 
> > > > 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)
> 
> > >
> 
> > 	The double forward slashes might also be confusing... At the least,
> 
> > unneeded...
> 
> > 
> 
> > >>> import os.path
> 
> > >>> print os.path.normpath("c://somefile.log")
> 
> > c:\somefile.log
> 
> > >>> print os.path.normpath("c:\\somefile.log")
> 
> > c:\somefile.log
> 
> > >>> print os.path.normpath("c:\\tryfile.log")
> 
> > c:\tryfile.log
> 
> > >>> print os.path.normpath("c:\tryfile.log")
> 
> > c:	ryfile.log
> 
> > >>> print os.path.normpath("c:/tryfile.log")
> 
> > c:\tryfile.log
> 
> > >>>
> 
> > 
> 
> > 	Doubling back-slashes is needed to avoid the problem of literal
> 
> > escapes corrupting the intent...
> 
> 
> 
> Or use the raw literal form r"c:\tryfile.log". I know several
> 
> people that prefer to use forward slashes as it works in both 
> 
> Windows and *nix.
> 
> 
> 
> 
> 
> ~Ramit
> 
> 
> 
> 
> 
> This email is confidential and subject to important disclaimers and
> 
> conditions including on offers for the purchase or sale of
> 
> securities, accuracy and completeness of information, viruses,
> 
> confidentiality, legal privilege, and legal entity disclaimers,
> 
> available at http://www.jpmorgan.com/pages/disclosures/email.

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web