__init__.py 1.73 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
# (C) Copyright 2005 Nuxeo SARL <http://nuxeo.com>
# Author: Florent Guillaume <fg@nuxeo.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as published
# by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#
# $Id: __init__.py,v 1.1 2005/02/23 15:35:21 fguillaume Exp $

"""Debug running threads

This adds a ZServer hook so that if a special URL is called, a full dump
with tracebacks of the running python threads will be made.

25
You MUST configure zope.conf before use.
26 27 28
"""

from zLOG import LOG, INFO, ERROR
29
from App.config import getConfiguration
30

31 32 33 34 35 36 37 38 39 40 41 42 43
config = getConfiguration()
if getattr(config, 'product_config', None) is not None:
    deadlockdebugger = config.product_config.get('deadlockdebugger')
    dump_url = ''
    secret = ''
    if deadlockdebugger is None:
        LOG('DeadlockDebugger', ERROR, 'Missing configuration statement '
          '<product-config deadlockdebugger>, not activated')
    else:
        if not 'dump_url' in deadlockdebugger:
            LOG('DeadlockDebugger', ERROR, 'Please configure dump_url and '
                'optionally secret in <product-config deadlockdebugger>, not '
                'activated')
44
        else:
45 46
            import dumper
            LOG('DeadlockDebugger', INFO, "Installed")