Turn on logging and set up the global config.

    This expects the :mod:`yakonfig` global configuration to be unset,
    and establishes it.  It starts the log system via the :mod:`dblogger`
    setup.  In addition to :mod:`dblogger`'s defaults, if `logpath` is
    provided, a :class:`logging.handlers.RotatingFileHandler` is set to
    write log messages to that file.

    This should not be called if the target worker is
    :class:`rejester.workers.ForkWorker`, since that manages logging on
    its own.

    :param dict gconfig: the :mod:`yakonfig` global configuration
    :param str logpath: optional location to write a log file

def start_logging(gconfig, logpath):
    '''Turn on logging and set up the global config.

    This expects the :mod:`yakonfig` global configuration to be unset,
    and establishes it.  It starts the log system via the :mod:`dblogger`
    setup.  In addition to :mod:`dblogger`'s defaults, if `logpath` is
    provided, a :class:`logging.handlers.RotatingFileHandler` is set to
    write log messages to that file.

    This should not be called if the target worker is
    :class:`rejester.workers.ForkWorker`, since that manages logging on
    its own.

    :param dict gconfig: the :mod:`yakonfig` global configuration
    :param str logpath: optional location to write a log file

    '''
    yakonfig.set_default_config([rejester, dblogger], config=gconfig)
    if logpath:
        formatter = dblogger.FixedWidthFormatter()
        # TODO: do we want byte-size RotatingFileHandler or TimedRotatingFileHandler?
        handler = logging.handlers.RotatingFileHandler(
            logpath, maxBytes=10000000, backupCount=3)
        handler.setFormatter(formatter)
        logging.getLogger('').addHandler(handler)