tracking log filename now determined by puppet, formatting cleanup
This commit is contained in:
@@ -13,6 +13,7 @@ from .logsettings import get_logger_config
|
||||
DEBUG = True
|
||||
TEMPLATE_DEBUG = True
|
||||
|
||||
|
||||
MITX_FEATURES['DISABLE_START_DATES'] = True
|
||||
MITX_FEATURES['ENABLE_SQL_TRACKING_LOGS'] = True
|
||||
MITX_FEATURES['SUBDOMAIN_COURSE_LISTINGS'] = False # Enable to test subdomains--otherwise, want all courses to show up
|
||||
@@ -55,6 +56,7 @@ CACHES = {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
XQUEUE_INTERFACE = {
|
||||
"url": "https://sandbox-xqueue.edx.org",
|
||||
"django_auth": {
|
||||
@@ -70,6 +72,7 @@ CACHE_TIMEOUT = 0
|
||||
# Dummy secret key for dev
|
||||
SECRET_KEY = '85920908f28904ed733fe576320db18cabd7b6cd'
|
||||
|
||||
|
||||
COURSE_LISTINGS = {
|
||||
'default': ['BerkeleyX/CS169.1x/2012_Fall',
|
||||
'BerkeleyX/CS188.1x/2012_Fall',
|
||||
@@ -85,6 +88,7 @@ COURSE_LISTINGS = {
|
||||
'sjsu': ['MITx/6.002x-EE98/2012_Fall_SJSU'],
|
||||
}
|
||||
|
||||
|
||||
SUBDOMAIN_BRANDING = {
|
||||
'sjsu': 'MITx',
|
||||
'mit': 'MITx',
|
||||
@@ -94,6 +98,8 @@ SUBDOMAIN_BRANDING = {
|
||||
|
||||
COMMENTS_SERVICE_KEY = "PUT_YOUR_API_KEY_HERE"
|
||||
|
||||
|
||||
|
||||
################################ LMS Migration #################################
|
||||
MITX_FEATURES['ENABLE_LMS_MIGRATION'] = True
|
||||
MITX_FEATURES['ACCESS_REQUIRE_STAFF_FOR_COURSE'] = False # require that user be in the staff_* group to be able to enroll
|
||||
@@ -116,6 +122,7 @@ OPENID_SSO_SERVER_URL = 'https://www.google.com/accounts/o8/id' # TODO: accept m
|
||||
OPENID_USE_AS_ADMIN_LOGIN = False
|
||||
|
||||
################################ MIT Certificates SSL Auth #################################
|
||||
|
||||
MITX_FEATURES['AUTH_USE_MIT_CERTIFICATES'] = True
|
||||
|
||||
################################ DEBUG TOOLBAR #################################
|
||||
|
||||
@@ -4,6 +4,7 @@ import platform
|
||||
import sys
|
||||
from logging.handlers import SysLogHandler
|
||||
|
||||
|
||||
def get_logger_config(log_dir,
|
||||
logging_env="no_env",
|
||||
tracking_filename=None,
|
||||
@@ -18,94 +19,91 @@ def get_logger_config(log_dir,
|
||||
settings are extended."""
|
||||
|
||||
# Revert to INFO if an invalid string is passed in
|
||||
if local_loglevel not in ['DEBUG','INFO','WARNING','ERROR','CRITICAL']:
|
||||
if local_loglevel not in ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']:
|
||||
local_loglevel = 'INFO'
|
||||
|
||||
# If we're given an explicit place to put tracking logs, we do that (say for
|
||||
# debugging). However, logging is not safe for multiple processes hitting
|
||||
# the same file. So if it's left blank, we dynamically create the filename
|
||||
# If we're given an explicit place to put tracking logs,
|
||||
# we do that (say for debugging). However, logging is not
|
||||
# safe for multiple processes hitting the same file.
|
||||
# So if it's left blank, we dynamically create the filename
|
||||
# based on the PID of this worker process.
|
||||
if tracking_filename:
|
||||
tracking_file_loc = os.path.join(log_dir, tracking_filename)
|
||||
else:
|
||||
pid = os.getpid() # So we can log which process is creating the log
|
||||
tracking_file_loc = os.path.join(log_dir, "tracking_{0}.log".format(pid))
|
||||
|
||||
hostname = platform.node().split(".")[0]
|
||||
syslog_format = ("[%(name)s][env:{logging_env}] %(levelname)s [{hostname} " +
|
||||
" %(process)d] [%(filename)s:%(lineno)d] - %(message)s").format(
|
||||
logging_env=logging_env, hostname=hostname)
|
||||
|
||||
handlers = ['console'] if debug else ['console', 'syslogger-remote', 'syslogger-local', 'newrelic']
|
||||
handlers = ['console'] if debug else ['console', 'syslogger-remote',
|
||||
'syslogger-local', 'newrelic']
|
||||
|
||||
return {
|
||||
'version': 1,
|
||||
'disable_existing_loggers': False,
|
||||
'formatters' : {
|
||||
'standard' : {
|
||||
'format' : '%(asctime)s %(levelname)s %(process)d [%(name)s] %(filename)s:%(lineno)d - %(message)s',
|
||||
'formatters': {
|
||||
'standard': {
|
||||
'format': '%(asctime)s %(levelname)s %(process)d [%(name)s] %(filename)s:%(lineno)d - %(message)s',
|
||||
},
|
||||
'syslog_format' : { 'format' : syslog_format },
|
||||
'raw' : { 'format' : '%(message)s' },
|
||||
'syslog_format': {'format': syslog_format ,
|
||||
'raw': {'format': '%(message)s'},
|
||||
},
|
||||
'handlers' : {
|
||||
'console' : {
|
||||
'level' : 'DEBUG' if debug else 'INFO',
|
||||
'class' : 'logging.StreamHandler',
|
||||
'formatter' : 'standard',
|
||||
'stream' : sys.stdout,
|
||||
'handlers': {
|
||||
'console': {
|
||||
'level': 'DEBUG' if debug else 'INFO',
|
||||
'class': 'logging.StreamHandler',
|
||||
'formatter': 'standard',
|
||||
'stream': sys.stdout,
|
||||
},
|
||||
'syslogger-remote' : {
|
||||
'level' : 'INFO',
|
||||
'class' : 'logging.handlers.SysLogHandler',
|
||||
'address' : syslog_addr,
|
||||
'formatter' : 'syslog_format',
|
||||
'syslogger-remote': {
|
||||
'level': 'INFO',
|
||||
'class': 'logging.handlers.SysLogHandler',
|
||||
'address': syslog_addr,
|
||||
'formatter': 'syslog_format',
|
||||
},
|
||||
'syslogger-local' : {
|
||||
'level' : local_loglevel,
|
||||
'class' : 'logging.handlers.SysLogHandler',
|
||||
'address' : '/dev/log',
|
||||
'formatter' : 'syslog_format',
|
||||
'syslogger-local': {
|
||||
'level': local_loglevel,
|
||||
'class': 'logging.handlers.SysLogHandler',
|
||||
'address': '/dev/log',
|
||||
'formatter': 'syslog_format',
|
||||
'facility': SysLogHandler.LOG_LOCAL0,
|
||||
},
|
||||
'tracking' : {
|
||||
'level' : 'DEBUG',
|
||||
'class' : 'logging.handlers.SysLogHandler',
|
||||
'address' : '/dev/log',
|
||||
'facility' : SysLogHandler.LOG_LOCAL1,
|
||||
'formatter' : 'raw',
|
||||
'tracking': {
|
||||
'level': 'DEBUG',
|
||||
'class': 'logging.handlers.SysLogHandler',
|
||||
'address': '/dev/log',
|
||||
'facility': SysLogHandler.LOG_LOCAL1,
|
||||
'formatter': 'raw',
|
||||
},
|
||||
'newrelic' : {
|
||||
'newrelic': {
|
||||
'level': 'ERROR',
|
||||
'class': 'newrelic_logging.NewRelicHandler',
|
||||
'formatter': 'raw',
|
||||
}
|
||||
},
|
||||
'loggers' : {
|
||||
'django' : {
|
||||
'handlers' : handlers,
|
||||
'propagate' : True,
|
||||
'level' : 'INFO'
|
||||
'loggers': {
|
||||
'django': {
|
||||
'handlers': handlers,
|
||||
'propagate': True,
|
||||
'level': 'INFO'
|
||||
},
|
||||
'tracking' : {
|
||||
'handlers' : ['tracking'],
|
||||
'level' : 'DEBUG',
|
||||
'propagate' : False,
|
||||
'tracking': {
|
||||
'handlers': ['tracking'],
|
||||
'level': 'DEBUG',
|
||||
'propagate': False,
|
||||
},
|
||||
'' : {
|
||||
'handlers' : handlers,
|
||||
'level' : 'DEBUG',
|
||||
'propagate' : False
|
||||
'': {
|
||||
'handlers': handlers,
|
||||
'level': 'DEBUG',
|
||||
'propagate': False
|
||||
},
|
||||
'mitx' : {
|
||||
'handlers' : handlers,
|
||||
'level' : 'DEBUG',
|
||||
'propagate' : False
|
||||
'mitx': {
|
||||
'handlers': handlers,
|
||||
'level': 'DEBUG',
|
||||
'propagate': False
|
||||
},
|
||||
'keyedcache' : {
|
||||
'handlers' : handlers,
|
||||
'level' : 'DEBUG',
|
||||
'propagate' : False
|
||||
'keyedcache': {
|
||||
'handlers': handlers,
|
||||
'level': 'DEBUG',
|
||||
'propagate': False
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user