<commit_before>import os

from polyaxon.config_manager import ROOT_DIR, config

LOG_DIRECTORY = ROOT_DIR.child('logs')
if not os.path.exists(LOG_DIRECTORY):
    os.makedirs(LOG_DIRECTORY)

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,

    'formatters': {
        'standard': {
            'format': '[%(asctime)s] %(levelname)s %(message)s [%(name)s:%(lineno)s]',
            'datefmt': '%d/%b/%Y %H:%M:%S'
        },
        'simple': {
            'format': '%(levelname)8s  %(message)s [%(name)s]'
        },
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
        },
    },

    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse',
        },
    },
    'handlers': {
        'logfile': {
            'level': config.log_level,
            'class': 'logging.handlers.RotatingFileHandler',
            'filename': '{}/polyaxon_{}.log'.format(LOG_DIRECTORY, os.getpid()),
            'maxBytes': 1024 * 1024 * 8,  # 8 MByte
            'backupCount': 5,
            'formatter': 'standard',
        },
        'console': {
            'level': config.log_level,
            'class': 'logging.StreamHandler',
            'formatter': 'verbose'
        },
        'sentry': {
            'level': 'ERROR',
            'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
        },
    },
    'loggers': {
        'celery': {
            'handlers': config.log_handlers,
            'level': config.log_level
        },
        'polyaxon.streams': {
            'propagate': True,
            'handlers': config.log_handlers,
            'level': config.log_level,
        },
        'polyaxon.monitors': {
            'propagate': True,
            'handlers': config.log_handlers,
            'level': config.log_level,
        },
        'polyaxon.dockerizer': {
            'propagate': True,
            'handlers': config.log_handlers,
            'level': config.log_level,
        },
        'django.request': {
            'propagate': True,
            'handlers': config.log_handlers,
            'level': config.log_level,
        },
        'root': {
            'handlers': config.log_handlers,
            'level': config.log_level,
        },
        'sanic.error': {
            'propagate': True,
            'handlers': config.log_handlers,
            'level': config.log_level,
            'qualname': 'sanic.error'
        },

        'sanic.access': {
            'propagate': True,
            'handlers': config.log_handlers,
            'level': config.log_level,
            'qualname': 'sanic.access'
        }
    },
}

RAVEN_CONFIG = {}
if not (config.is_testing_env or config.is_local_env) and config.platform_dsn:
    RAVEN_CONFIG['dsn'] = config.platform_dsn
    RAVEN_CONFIG['transport'] = 'raven.transport.threaded_requests.ThreadedRequestsHTTPTransport'
    RAVEN_CONFIG['release'] = config.get_string('POLYAXON_CHART_VERSION',
                                                is_optional=True,
                                                default='0.0.0')
    RAVEN_CONFIG['ignore_exceptions'] = config.ignore_exceptions + [
        'django.db.ProgrammingError',
        'django.db.OperationalError',
        'django.db.InterfaceError'
    ]
    RAVEN_CONFIG['environment'] = config.env<commit_msg>Add psycopg2.OperationalError to list of ignored exceptions<commit_after>import os

from polyaxon.config_manager import ROOT_DIR, config

LOG_DIRECTORY = ROOT_DIR.child('logs')
if not os.path.exists(LOG_DIRECTORY):
    os.makedirs(LOG_DIRECTORY)

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,

    'formatters': {
        'standard': {
            'format': '[%(asctime)s] %(levelname)s %(message)s [%(name)s:%(lineno)s]',
            'datefmt': '%d/%b/%Y %H:%M:%S'
        },
        'simple': {
            'format': '%(levelname)8s  %(message)s [%(name)s]'
        },
        'verbose': {
            'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'
        },
    },

    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse',
        },
    },
    'handlers': {
        'logfile': {
            'level': config.log_level,
            'class': 'logging.handlers.RotatingFileHandler',
            'filename': '{}/polyaxon_{}.log'.format(LOG_DIRECTORY, os.getpid()),
            'maxBytes': 1024 * 1024 * 8,  # 8 MByte
            'backupCount': 5,
            'formatter': 'standard',
        },
        'console': {
            'level': config.log_level,
            'class': 'logging.StreamHandler',
            'formatter': 'verbose'
        },
        'sentry': {
            'level': 'ERROR',
            'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
        },
    },
    'loggers': {
        'celery': {
            'handlers': config.log_handlers,
            'level': config.log_level
        },
        'polyaxon.streams': {
            'propagate': True,
            'handlers': config.log_handlers,
            'level': config.log_level,
        },
        'polyaxon.monitors': {
            'propagate': True,
            'handlers': config.log_handlers,
            'level': config.log_level,
        },
        'polyaxon.dockerizer': {
            'propagate': True,
            'handlers': config.log_handlers,
            'level': config.log_level,
        },
        'django.request': {
            'propagate': True,
            'handlers': config.log_handlers,
            'level': config.log_level,
        },
        'root': {
            'handlers': config.log_handlers,
            'level': config.log_level,
        },
        'sanic.error': {
            'propagate': True,
            'handlers': config.log_handlers,
            'level': config.log_level,
            'qualname': 'sanic.error'
        },

        'sanic.access': {
            'propagate': True,
            'handlers': config.log_handlers,
            'level': config.log_level,
            'qualname': 'sanic.access'
        }
    },
}

RAVEN_CONFIG = {}
if not (config.is_testing_env or config.is_local_env) and config.platform_dsn:
    RAVEN_CONFIG['dsn'] = config.platform_dsn
    RAVEN_CONFIG['transport'] = 'raven.transport.threaded_requests.ThreadedRequestsHTTPTransport'
    RAVEN_CONFIG['release'] = config.get_string('POLYAXON_CHART_VERSION',
                                                is_optional=True,
                                                default='0.0.0')
    RAVEN_CONFIG['ignore_exceptions'] = config.ignore_exceptions + [
        'django.db.ProgrammingError',
        'django.db.OperationalError',
        'django.db.InterfaceError',
        'psycopg2.OperationalError'
    ]
    RAVEN_CONFIG['environment'] = config.env
{'fraction_non_alphanumeric': 0.14913429361268732, 'fraction_numerical': 0.004946893641786702, 'mean_word_length': 1.8594009983361064, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1359810', 'n_tokens_mistral': 2174, 'n_tokens_neox': 2099, 'n_words': 316}