Logging lib doesn't work
Alexandre FOURNEL
alexandre.fournel at sia-partners.com
Tue Sep 29 10:35:16 EDT 2020
Le mardi 29 septembre 2020 à 16:33:39 UTC+2, Barry Scott a écrit :
> > On 29 Sep 2020, at 15:11, Alexandre FOURNEL <alexandr... at sia-partners.com> wrote:
> >
> > Hi all !
> >
> > I'm trying to use logging lib in my python program.
> >
> > To try this lib, I am using basic code like :
> >
> > "import logging
> > logging.basicConfig(filename='pont.txt', filemode='w',format='%(asctime)s %(message)s', datefmt='%d/%m/%Y %H:%M:%S', level=logging.DEBUG)
> Do you want to over write the file each run?
> That is what 'w' says you want. Maybe try 'a' - append?
> > logging.debug('This message should go to the log file')
> > logging.info('So should this')
> > logging.warning('And this, too')"
> >
> > But between 2 execution, I have to open a new terminal to get new data in my file pont.txt. Do you know why ?
> Each time you run it the time stamps change right?
>
> Barry
>
>
> >
> > Thanks
> >
> > Alexandre
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
If I use also "a" instead of "w", it doesn't work ...
It works only when I use a new terminal (I am using Spyder to code)
More information about the Python-list
mailing list