Leave a comment

Logging, logging, logging……

So with a lot of help from friends and a programmer that works with us, we have just about completed our first wxPython GUI that we are going to use for a clients interface.  For those that have a clue about basic programming (which I did NOT) I am sure that you are familiar with setting break points to troubleshoot your code.  Even better than this (in my opinion and easier as well) is the use of logging.  Using logging statements all over your code in areas that may be giving you problems, you can see where the issue may be occurring.

import logging

 format='%(filename)s::%(module)s::%(funcName)s::%(lineno)d %(levelname)s %(message)s'

# above is the config/setup. Put at top of file.

# here's some examples using it.
 # look in "dev.log" for output!

def blah() :
 logging.debug("starting blah!")

logging.debug("finished blah!")

Now when you run your process you can check your dev.log to see if all of your logging statement are there.  If they are not all there, then you can see where the last statement was and it helps to zero in on your problem.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: