~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp_sitecustomize.py

  • Committer: Gavin Panella
  • Date: 2011-09-28 11:31:49 UTC
  • mto: This revision was merged to the branch mainline in revision 14064.
  • Revision ID: gavin.panella@canonical.com-20110928113149-xj6aweuzqy35o94o
Silence the amqplib logger globally, not just for scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
from collections import defaultdict
8
8
import itertools
 
9
import logging
9
10
import os
10
11
import warnings
11
 
import logging
12
12
 
 
13
from bzrlib.branch import Branch
13
14
from twisted.internet.defer import (
14
15
    Deferred,
15
16
    DeferredList,
16
17
    )
 
18
from zope.interface import alsoProvides
 
19
import zope.publisher.browser
 
20
from zope.security import checker
17
21
 
18
 
from bzrlib.branch import Branch
19
22
from canonical.launchpad.webapp.interfaces import IUnloggedException
20
23
from lp.services.log import loglevels
21
24
from lp.services.log.logger import LaunchpadLogger
22
25
from lp.services.log.mappingfilter import MappingFilter
23
26
from lp.services.log.nullhandler import NullHandler
24
27
from lp.services.mime import customizeMimetypes
25
 
from zope.interface import alsoProvides
26
 
from zope.security import checker
27
 
import zope.publisher.browser
28
28
 
29
29
 
30
30
def add_custom_loglevels():
74
74
            logger.parent = new_root
75
75
 
76
76
 
 
77
def silence_amqplib_logger():
 
78
    """Install the NullHandler on the amqplib logger to silence logs."""
 
79
    amqplib_logger = logging.getLogger('amqplib')
 
80
    amqplib_logger.addHandler(NullHandler())
 
81
    amqplib_logger.propagate = False
 
82
 
 
83
 
77
84
def silence_bzr_logger():
78
85
    """Install the NullHandler on the bzr logger to silence logs."""
79
86
    bzr_logger = logging.getLogger('bzr')
134
141
    This function is also invoked by the test infrastructure to reset
135
142
    logging between tests.
136
143
    """
 
144
    silence_amqplib_logger()
137
145
    silence_bzr_logger()
138
146
    silence_zcml_logger()
139
147
    silence_transaction_logger()