[PATCH] Still more useful traces

John Arbash Meinel john at arbash-meinel.com
Tue Oct 18 13:55:44 BST 2005


Martin Pool wrote:
> On 18/10/05, David Allouche <david at allouche.net> wrote:
> 
>>Here's a new patch for trace.py.
>>
>>Print the repr of PWD instead of the str, which is useful to understand
>>errors with fancy non-ascii directory names.
> 
> 
> Thanks.  I changed the error formatting so that it shows the actual
> error first; I think this is easier to understand.
> 
> 
>>Set the logging level of the root logger, so setting BZR_DEBUG gives
>>debugging output from non-bzr code. I found that useful to get pybaz
>>debug logging while working on baz2bzr.
> 
> 
> It looks like python logging is quite slow compared to the previous
> version in bzrlib.trace - about 8-10x slower even when discarding
> messages.  I was wondering if any other applications used python
> logging -- I take it pybaz does?

I am wondering about a couple things. When looking at the --profile's,
you can see that _log is being called. (And is a little expensive).

If you look at the code you see this:
     def debug(self, msg, *args, **kwargs):
         """
         Log 'msg % args' with severity 'DEBUG'.

         To pass exception information, use the keyword argument
exc_info with
         a true value, e.g.

         logger.debug("Houston, we have a %s", "thorny problem", exc_info=1)
         """
         if self.manager.disable >= DEBUG:
             return
         if DEBUG >= self.getEffectiveLevel():
             apply(self._log, (DEBUG, msg, args), kwargs)

Which says that it should be checking against it's effective level and
never calling _log().

I'm not sure how everything is defined, but we might not be defining the
logging level properly. Such that instead of filtering at the creation
side, we are filtering at the "put it in a file" side.

Also, getEffectiveLevel() is a potentially recursive function call (if a
 logger doesn't have a level defined, it calls it's parent), so we might
also see a benefit from setting the log level in more than one place.

I think we can make it inexpensive again, if we can just figure out why
it is doing all the work. It was specifically designed to make logging
less expensive when it was turned off. At least that is how the
documentation reads.

John
=:->

> 
> --
> Martin
> 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051018/8cdec6a3/attachment.pgp 


More information about the bazaar mailing list