Logging lib doesn't work
Barry Scott
barry at barrys-emacs.org
Tue Sep 29 10:33:07 EDT 2020
> On 29 Sep 2020, at 15:11, Alexandre FOURNEL <alexandre.fournel 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
>
More information about the Python-list
mailing list