def logger_class(self): uri = self.settings["logger_class"].get() if uri == "simple": # support the default uri = "gunicorn.glogging.Logger" # if statsd is on, automagically switch to the statsd logger if "statsd_host" in self.settings and self.settings["statsd_host"].value is not None: logger_class = util.load_class("gunicorn.instrument.statsd.Statsd", section="gunicorn.loggers") else: logger_class = util.load_class(uri, default="gunicorn.glogging.Logger", section="gunicorn.loggers") if hasattr(logger_class, "install"): logger_class.install() return logger_class
def logger_class(self): uri = self.settings["logger_class"].get() logger_class = util.load_class(uri, default="simple", section="gunicorn.loggers") if hasattr(logger_class, "install"): logger_class.install() return logger_class
def logger_class(self): uri = self.settings['logger_class'].get() logger_class = util.load_class(uri, default="simple", section="gunicorn.loggers") if hasattr(logger_class, "install"): logger_class.install() return logger_class
def logger_class(self): uri = self.settings['logger_class'].get() if uri == "simple": # support the default uri = "gunicorn.glogging.Logger" # if statsd is on, automagically switch to the statsd logger if 'statsd_host' in self.settings and self.settings['statsd_host'].value is not None: logger_class = util.load_class("gunicorn.instrument.statsd.Statsd", section="gunicorn.loggers") else: logger_class = util.load_class(uri, default="gunicorn.glogging.Logger", section="gunicorn.loggers") if hasattr(logger_class, "install"): logger_class.install() return logger_class
def logger_class(self): uri = self.settings["logger_class"].get() if uri == "simple": # support the default uri = "gunicorn.glogging.Logger" else: logger_class = util.load_class(uri, default="gunicorn.glogging.Logger", section="gunicorn.loggers") if hasattr(logger_class, "install"): logger_class.install() return logger_class
def worker_class(self): uri = self.settings['worker_class'].get() ## are we using a threaded worker? is_sync = uri.endswith('SyncWorker') or uri == 'sync' if is_sync and self.threads > 1: uri = "gunicorn.workers.gthread.ThreadWorker" worker_class = util.load_class(uri) if hasattr(worker_class, "setup"): worker_class.setup() return worker_class
def logger_class(self): uri = self.settings['logger_class'].get() if uri == "simple": # support the default uri = "gunicorn.glogging.Logger" else: logger_class = util.load_class(uri, default="gunicorn.glogging.Logger", section="gunicorn.loggers") if hasattr(logger_class, "install"): logger_class.install() return logger_class
def logger_class(self): uri = self.settings['logger_class'].get() if uri == "simple": # support the default uri = LoggerClass.default # if default logger is in use, and statsd is on, automagically switch # to the statsd logger if uri == LoggerClass.default: if 'statsd_host' in self.settings and self.settings['statsd_host'].value is not None: uri = "gunicorn.instrument.statsd.Statsd" logger_class = util.load_class( uri, default="gunicorn.glogging.Logger", section="gunicorn.loggers") if hasattr(logger_class, "install"): logger_class.install() return logger_class
def worker_class(self): uri = self.settings['worker_class'].get() worker_class = util.load_class(uri) if hasattr(worker_class, "setup"): worker_class.setup() return worker_class
# -- """The Gunicorn publisher""" import os import logging import traceback import multiprocessing from functools import partial from ws4py import websocket from ws4py.server import wsgiutils from gunicorn.app import base from gunicorn import util, workers, glogging from nagare.server import http_publisher gthread_worker = util.load_class(workers.SUPPORTED_WORKERS['gthread']) workers.SUPPORTED_WORKERS[ 'gthread'] = 'nagare.publishers.gunicorn_publisher.Worker' class Logger(glogging.Logger): def __init__(self, cfg): super(Logger, self).__init__(cfg) self.error_log = logging.getLogger(cfg.logger_name + '.worker') self.access_log = logging.getLogger(cfg.logger_name + '.access') if cfg.loglevel: loglevel = self.LOG_LEVELS.get(cfg.loglevel.lower(), logging.INFO) self.error_log.setLevel(loglevel)