def get_logger(KOLIBRI_HOME):
    """
    We define a minimal default logger config here, since we can't yet load up Django settings.
    """
    from kolibri.utils.conf import LOG_ROOT

    logging.config.dictConfig(get_base_logging_config(LOG_ROOT))
    return logging.getLogger(__name__)
Beispiel #2
0
def setup_logging(debug=False):
    """
    Configures logging in cases where a Django environment is not supposed
    to be configured.
    """
    # Would be ideal to use the upgrade logic for this, but that is currently
    # only designed for post-Django initialization tasks. If there are more cases
    # for pre-django initialization upgrade tasks, we can generalize the logic here
    if matches_version(get_version(), "<0.12.4"):
        check_log_file_location()
    LOGGING = get_base_logging_config(LOG_ROOT)
    if debug:
        LOGGING["handlers"]["console"]["level"] = "DEBUG"
        LOGGING["loggers"]["kolibri"]["level"] = "DEBUG"
    logging.config.dictConfig(LOGGING)
Beispiel #3
0
def setup_logging(debug=False, debug_database=False):
    """
    Configures logging in cases where a Django environment is not supposed
    to be configured.
    """
    # Sets the global DEBUG flag to be picked up in other contexts
    # (Django settings)
    OPTIONS["Server"]["DEBUG"] = debug
    OPTIONS["Server"]["DEBUG_LOG_DATABASE"] = debug_database

    # Would be ideal to use the upgrade logic for this, but that is currently
    # only designed for post-Django initialization tasks. If there are more cases
    # for pre-django initialization upgrade tasks, we can generalize the logic here
    if matches_version(get_version(), "<0.12.4"):
        sanity_checks.check_log_file_location()

    LOGGING = get_base_logging_config(LOG_ROOT,
                                      debug=debug,
                                      debug_database=debug_database)
    logging.config.dictConfig(LOGGING)