I'm Getting somewhere.

I changed the Logging.basic config to have a filename of 
/home/pi/mqtt/debug_log.txt  and took out the asctime and levelname formatting 
bits.   I added  the Logging. debug  lines in a couple of the functions. It 
worked in that the file is in that location, and one of the debug messages has 
printed. Have to look at the others now.
Anyway, progress!

Still have to figure out how to add the ultrasonic functions and get them to 
work. I will probably add a do-nothing function to the program for testing 
first.
P.

On 29/01/2021 10:36, PeterMerchant wrote:
You should find that file given your first debug() call as those lines
work for me here.

     $ cat >peter.py
     import logging
     logging.basicConfig(filename='debug_log.txt', level=logging.DEBUG, 
format='%(asctime)s - %(levelname)s - %(message)s')
     logging.debug('This is a log message.')
     $
     $ python peter.py
     $ cat debug_log.txt
     2021-01-29 09:42:35,195 - DEBUG - This is a log message.

I added those three lines to my file after the import time line,

and now it does not work, and I cannot find the logfile.

--
 Next meeting: Online, Jitsi, Tuesday, 2021-02-02 20:00
 Check to whom you are replying
 Meetings, mailing list, IRC, ...  http://dorset.lug.org.uk
 New thread, don't hijack:  mailto:dorset@mailman.lug.org.uk

Reply via email to