Hi Kent, I'm checking out the logging module atm. I'm trying the second example in "Basic example":
import logging logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)s %(message)s', filename='C:\\pylogger.log', filemode='w') logging.debug('A debug message') logging.info('Some information') logging.warning('A shot across the bows') However when I run that I don't get any log file, while the doc page says I should have a log file. Only the warning is printed, as if I had not run the basicConfig method. Any suggestion? Danny and Alan: thanks a lot for the suggestions, I have to say that I'd prefer a text file instead of a database table, but I guess that is just matter of habits. This could change. Thanks Bernard On 1/2/06, Kent Johnson <[EMAIL PROTECTED]> wrote: > Danny Yoo wrote: > >>I think I see where you are going with this. Are you suggesting that > >>both parent and child thread might be trying to write to the log at > >>once, and one of them is closing the file while it is open for both? > > > > > > Hi Bernard, > > > > One possibility is that we have a shared resource that needs some kind of > > mutual exclusion. If two threads try to append directly to the file, I > > don't know what will happen, but the result will probably not be good. > > > > > > But the Queue module can be especially useful here: > > > > http://www.python.org/doc/lib/module-Queue.html > > > > The idea is that we keep a separate logger thread that reads messages off > > a Queue instance. > > You might be interested in the standard logging module which is > thread-safe and supports logging to a file, rather than inventing your own. > > Kent > > _______________________________________________ > Tutor maillist - Tutor@python.org > http://mail.python.org/mailman/listinfo/tutor > _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor