<filename>GUnicornConfig.py
import logging
import sys

from GServerHooks import ServerHooks
from gunicorn import glogging
from pythonjsonlogger import jsonlogger


class CustomLogger(glogging.Logger):
    """Custom logger for Gunicorn log messages."""

    def _set_handler(self, log, output, fmt, stream=None):
        log_handler = logging.StreamHandler(sys.stdout)
        log_handler.setLevel(logging.INFO)
        formatter = jsonlogger.JsonFormatter('%(asctime)%(levelname)%(filename)%(name)%(lineno)%(process)%(thread)%(message).1000s')
        log_handler.setFormatter(formatter)
        while log.hasHandlers():
            log.removeHandler(log.handlers[0])
        log.addHandler(log_handler)


bind = '0.0.0.0:8005'
backlog = 2048
workers = 5
threads = 5
worker_class = 'gevent'
worker_connections = 1000
timeout = 30
keepalive = 5
spew = False
daemon = False
# errorlog = '-'
# loglevel = 'info'
# accesslog = '-'
# access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
logger_class = CustomLogger
# do not change this
proc_name = "wc_app"
when_ready = ServerHooks.when_ready
on_exit = ServerHooks.on_exit
worker_exit = ServerHooks.on_worker_exit
worker_abort = ServerHooks.on_worker_abort
<filename>GUnicornConfig.py
import logging
import sys

from GServerHooks import ServerHooks
from gunicorn import glogging
from pythonjsonlogger import jsonlogger


class CustomLogger(glogging.Logger):
    """Custom logger for Gunicorn log messages."""

    def _set_handler(self, log, output, fmt, stream=None):
        log_handler = logging.StreamHandler(sys.stdout)
        log_handler.setLevel(logging.INFO)
        formatter = jsonlogger.JsonFormatter('%(asctime)%(levelname)%(filename)%(name)%(lineno)%(process)%(thread)%(message).1000s')
        log_handler.setFormatter(formatter)
        while log.hasHandlers():
            log.removeHandler(log.handlers[0])
        log.addHandler(log_handler)


bind = '0.0.0.0:8005'
backlog = 2048
workers = 5
threads = 5
worker_class = 'gevent'
worker_connections = 1000
timeout = 30
keepalive = 5
spew = False
daemon = False
# errorlog = '-'
# loglevel = 'info'
# accesslog = '-'
# access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"'
logger_class = CustomLogger
# do not change this
proc_name = "wc_app"
when_ready = ServerHooks.when_ready
on_exit = ServerHooks.on_exit
worker_exit = ServerHooks.on_worker_exit
worker_abort = ServerHooks.on_worker_abort
Custom logger for Gunicorn log messages. # errorlog = '-' # loglevel = 'info' # accesslog = '-' # access_log_format = '%(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s"' # do not change this