コード例 #1
0
def augment_logging_cfg(signal=None,
                        sender=None,
                        logger=None,
                        loglevel=None,
                        logfile=None,
                        format=None,
                        colorize=None,
                        *args,
                        **kargs):  # pragma: no cover
    logging.info("Adding AdminEmailHandler to celery loggers")
    from django.utils.log import AdminEmailHandler
    handler = AdminEmailHandler()
    handler.level = logging.ERROR
    logger.handlers.append(handler)
    logging.info("logger.handlers: %s" % logger.handlers)
    logging.info("settings.ADMINS:%s" % settings.ADMINS)

    import sys
    import os

    # Show a debugging info on console
    logging.debug("__file__ = %s", __file__)
    logging.debug("sys.version = %s", sys.version)
    logging.debug("os.getpid() = %s", os.getpid())
    logging.debug("os.getcwd() = %s", os.getcwd())
    logging.debug("os.curdir = %s", os.curdir)
    logging.debug("sys.path:\n\t%s", "\n\t".join(sys.path))
    logging.debug("PYTHONPATH:\n\t%s",
                  "\n\t".join(os.environ.get('PYTHONPATH', "").split(';')))
    logging.debug("sys.modules.keys() = %s", repr(sys.modules.keys()))
    logging.debug("sys.modules.has_key('website') = %s", 'website'
                  in sys.modules)

    if 'website' in sys.modules:
        logging.debug("sys.modules['website'].__name__ = %s",
                      sys.modules['website'].__name__)
        logging.debug("sys.modules['website'].__file__ = %s",
                      sys.modules['website'].__file__)
コード例 #2
0
ファイル: celery.py プロジェクト: wooyek/django-website-pro
def augment_logging_cfg(signal=None, sender=None, logger=None, loglevel=None, logfile=None, format=None, colorize=None):
    from django.utils.log import AdminEmailHandler
    handler = AdminEmailHandler()
    handler.level = logging.ERROR
    logger.handlers.append(handler)