Skip to content
Snippets Groups Projects
Commit 63cb53c9 authored by David Ormsbee's avatar David Ormsbee
Browse files

Move logging config, add tracking info to console, remove logging tests.

parent 98efb8c0
No related merge requests found
......@@ -35,10 +35,6 @@ def profile(request):
if not request.user.is_authenticated():
return redirect('/')
log.info("Profile called")
logging.info("Now the root")
logging.getLogger("tracking").info("this should be unformatted")
dom=content_parser.course_file(request.user)
hw=[]
course = dom.xpath('//course/@name')[0]
......
......@@ -56,87 +56,6 @@ USE_I18N = True
# calendars according to the current locale
USE_L10N = True
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters' : {
'standard' : {
'format' : '%(levelname)s %(asctime)s PID:%(process)d %(name)s %(filename)s:%(lineno)d %(message)s',
},
'raw' : {
'format' : '%(message)s',
}
},
'handlers' : {
'console' : {
'level' : 'DEBUG' if DEBUG else 'INFO',
'class' : 'logging.StreamHandler',
'formatter' : 'standard',
'stream' : sys.stdout,
},
'console_err' : {
'level' : 'ERROR',
'class' : 'logging.StreamHandler',
'formatter' : 'standard',
'stream' : sys.stderr,
},
# 'app' : {
# 'level' : 'INFO',
# 'class' : 'logging.handlers.TimedRotatingFileHandler',
# 'formatter' : 'standard',
# 'filename' : '/tmp/mitx.log', # temporary location for proof of concept
# 'when' : 'midnight',
# 'utc' : True,
# 'encoding' : 'utf-8',
# },
# We should actually use this for tracking:
# http://pypi.python.org/pypi/ConcurrentLogHandler/0.8.2
'tracking' : {
'level' : 'INFO',
'class' : 'logging.handlers.TimedRotatingFileHandler',
'formatter' : 'raw',
'filename' : BASE_DIR + '/track_dir/tracking.log',
'when' : 'midnight',
'utc' : True,
'encoding' : 'utf-8',
},
'mail_admins' : {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
},
},
'loggers' : {
'django.request': {
'handlers': ['mail_admins', 'console', 'console_err'],
'level': 'INFO',
'propagate': True,
},
'tracking' : {
'handlers' : ['tracking'],
'level' : 'DEBUG',
'propagate' : False,
},
'root' : {
'handlers' : ['console', 'console_err'],
'level' : 'DEBUG',
'propagate' : False
},
'mitx' : {
'handlers' : ['console', 'console_err'],
'level' : 'DEBUG',
'propagate' : False
},
}
}
STATIC_URL = '/static/'
# URL prefix for admin static files -- CSS, JavaScript and images.
......@@ -201,9 +120,100 @@ TRACK_MAX_EVENT = 1000
# Maximum length of log file before starting a new one.
MAXLOG = 500
LOG_DIR = "/tmp/"
# Make sure we execute correctly regardless of where we're called from
execfile(os.path.join(BASE_DIR, "settings.py"))
# A sample logging configuration. The only tangible logging
# performed by this configuration is to send an email to
# the site admins on every HTTP 500 error.
# See http://docs.djangoproject.com/en/dev/topics/logging for
# more details on how to customize your logging configuration.
LOGGING = {
'version': 1,
'disable_existing_loggers': True,
'formatters' : {
'standard' : {
'format' : '%(asctime)s %(levelname)s %(process)d [%(name)s] %(filename)s:%(lineno)d - %(message)s',
},
'raw' : {
'format' : '%(message)s',
}
},
'handlers' : {
'console' : {
'level' : 'DEBUG' if DEBUG else 'INFO',
'class' : 'logging.StreamHandler',
'formatter' : 'standard',
'stream' : sys.stdout,
},
'console_err' : {
'level' : 'ERROR',
'class' : 'logging.StreamHandler',
'formatter' : 'standard',
'stream' : sys.stderr,
},
'app' : {
'level' : 'INFO',
'class' : 'logging.handlers.TimedRotatingFileHandler',
'formatter' : 'standard',
'filename' : LOG_DIR + '/mitx.log', # temporary location for proof of concept
'when' : 'midnight',
'utc' : True,
'encoding' : 'utf-8',
},
'app_err' : {
'level' : 'ERROR',
'class' : 'logging.handlers.TimedRotatingFileHandler',
'formatter' : 'standard',
'filename' : LOG_DIR + '/mitx.err.log', # temporary location for proof of concept
'when' : 'midnight',
'utc' : True,
'encoding' : 'utf-8',
},
# We should actually use this for tracking:
# http://pypi.python.org/pypi/ConcurrentLogHandler/0.8.2
'tracking' : {
'level' : 'INFO',
'class' : 'logging.handlers.TimedRotatingFileHandler',
'formatter' : 'raw',
'filename' : LOG_DIR + '/tracking.log',
'when' : 'midnight',
'utc' : True,
'encoding' : 'utf-8',
},
'mail_admins' : {
'level': 'ERROR',
'class': 'django.utils.log.AdminEmailHandler',
},
},
'loggers' : {
'django' : {
'handlers' : ['console', 'mail_admins'],
'propagate' : True,
'level' : 'INFO'
},
'tracking' : {
'handlers' : ['console', 'tracking'],
'level' : 'DEBUG',
'propagate' : False,
},
'root' : {
'handlers' : ['console', 'app', 'app_err'],
'level' : 'DEBUG',
'propagate' : False
},
'mitx' : {
'handlers' : ['console', 'app', 'app_err'],
'level' : 'DEBUG',
'propagate' : False
},
}
}
if PERFSTATS :
MIDDLEWARE_CLASSES = ( 'perfstats.middleware.ProfileMiddleware',) + MIDDLEWARE_CLASSES
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment