No handlers could be found for logger "bzr"

Asked by Brian Murray

I've started seeing the message "No handlers could be found for logger 'bzr'" when using either python-launchpad-bugs or bughelper on servers with bzr version 1.6rc3. Someone mentioned it might be an issue with my ~/.bzr.log file however that file has permissions of 544.

python-launchpad-bugs checks to see what version it is using the following code:

try:
    from bzrlib.branch import Branch
    HAVE_BZR = True
except:
    HAVE_BZR = False
....
    if HAVE_BZR:
        try:
            version = get_version_from_changelog(path)
            if os.path.islink(os.path.dirname(__file__)):
                path = os.path.realpath(os.path.dirname(__file__))
            branch = Branch.open_containing(path)[0]
            bzr_revno = branch.revno()
            if show_nick:
                nick = branch.nick
                return "%sr%s, branch nick: %s" % (version, bzr_revno, nick)
            else:
                return "%sr%s" % (version, bzr_revno)

All of the code can be found at http://bazaar.launchpad.net/~bughelper-dev/python-launchpad-bugs/main/annotate/152?file_id=utils.py-20070420081525-1p9hbme73f0thzdr-18 .

I'm trying to get the bottom of this and any help would be appreciated.

Question information

Language:
English Edit question
Status:
Answered
For:
Bazaar Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
John A Meinel (jameinel) said :
#1

This is generally caused when some action would normally write to the log file, but "bzrlib.trace.enabled_default_logging()" has not been called yet.

As you are directly importing bzrlib, I would recommend adding that call somewhere before the "Branch.open()" possibly before the "get_version_from_changelog" depending on what that does.

Revision history for this message
Morten Siebuhr (msiebuhr) said :
#2

I've gotten this message on a fresh Ubuntu install - it turned out that as I had installed 'etckeeper' and 'bzr', the root user had initialized the ~/.bzr.log and ~/.bazaar/, why the local user could not write to these.

Doing 'chown -R $user:$user ~/.bzr.log ~/.bazaar/' solved the problem.

Revision history for this message
Barry Warsaw (barry) said :
#3

I'm seeing this problem when I do a simple 'bzr pull' in my home directory, but the permissions on ~/.bzr.log and ~/.bazaar are fine. I haven't figure it out yet.

Revision history for this message
Martin Pool (mbp) said :
#4

Barry, how interesting - with what version?

Revision history for this message
John A Meinel (jameinel) said :
#5

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> Question #42886 on Bazaar changed:
> https://answers.edge.launchpad.net/bzr/+question/42886
>
> Martin Pool requested for more information:
> Barry, how interesting - with what version?
>

I'm pretty sure Barry runs nightlies. I thought this was fallout from
your patch which disabled setting up logging inside of bzr itself. (no
more 'trace.enable_default_logging()'.)

The logging module seems to be designed that if there are no 'sinks' it
emits a failure to stderr.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktEHtAACgkQJdeBCYSNAAPMRQCeJkVctIAuH0vpE+TwTDnxUhMv
Wf0AoM6JSHfzRre+jL5HI0D6sE2swXTh
=ROiT
-----END PGP SIGNATURE-----

Revision history for this message
Martin Pool (mbp) said :
#6

2010/1/6 John A Meinel <email address hidden>:
> I'm pretty sure Barry runs nightlies. I thought this was fallout from
> your patch which disabled setting up logging inside of bzr itself. (no
> more 'trace.enable_default_logging()'.)
>
> The logging module seems to be designed that if there are no 'sinks' it
> emits a failure to stderr.

So in that case the question is, who (what code) is trying to write to
the bzr logger? It shouldn't be anything in the bzr codebase, but
possibly a plugin is trying to do it.

--
Martin <http://launchpad.net/~mbp/>

Revision history for this message
John A Meinel (jameinel) said :
#7

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> Question #42886 on Bazaar changed:
> https://answers.launchpad.net/bzr/+question/42886
>
> Martin Pool proposed the following answer:
> 2010/1/6 John A Meinel <email address hidden>:
>> I'm pretty sure Barry runs nightlies. I thought this was fallout from
>> your patch which disabled setting up logging inside of bzr itself. (no
>> more 'trace.enable_default_logging()'.)
>>
>> The logging module seems to be designed that if there are no 'sinks' it
>> emits a failure to stderr.
>
> So in that case the question is, who (what code) is trying to write to
> the bzr logger? It shouldn't be anything in the bzr codebase, but
> possibly a plugin is trying to do it.
>
>

in bzrlib.transport.ssh.ParamikoVendor._connect:

t = paramiko.Transport((host, port or 22))
t.set_log_channel('bzr.paramiko')
t.start_client()

^- I *think* that loggers are hierarchical, so that 'bzr.paramiko'
requires 'bzr' to be active.

This is in bzr.dev@4934

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAktElOIACgkQJdeBCYSNAAPp6gCeNLwz4mHqtseKbDxpP5LX1n9d
ANQAoNmkjoCQBzU6hv8wf0J0MwDpdUOy
=gFru
-----END PGP SIGNATURE-----

Revision history for this message
Martin Pool (mbp) said :
#8

then this is bug 494345

Revision history for this message
John A Meinel (jameinel) said :
#9

Actually, I'm pretty sure this is bug #503886

The no logger for paramiko is a different bug with a different cause. no logger for paramiko is because we didn't set up logging at all. Which is only relevant in trunk right now, and starting in about 2.1.0rc1.

No logger for "bzr" is generally when we try to open .bzr.log but can't, we try to log a warning, but we haven't gotten to the point of setting it up yet) This has been true for a very long time.

Can you help with this problem?

Provide an answer of your own, or ask Brian Murray for more information if necessary.

To post a message you must log in.