summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@peacefrogs.net>2013-02-18 19:49:35 +0100
committerÉtienne Loks <etienne.loks@peacefrogs.net>2013-02-18 19:49:35 +0100
commit7a1c278fb7ed736de0d744093aaafdf26274a969 (patch)
tree96440da62f3f82f20a64f9f3e3a2848d3516ea04
parent8d12c16e4489d2e9079d328c7d673a216444533a (diff)
downloadChimère - projet de référence-v2.0.tar.bz2
Chimère - projet de référence-v2.0.zip
Allow to easily specify the log filev2.0
-rw-r--r--settings.py81
1 files changed, 43 insertions, 38 deletions
diff --git a/settings.py b/settings.py
index eaeac4a..ca2b460 100644
--- a/settings.py
+++ b/settings.py
@@ -188,50 +188,55 @@ INSTALLED_APPS += [
# 'chimere.scripts', # activate it if you want to use old migration scripts
]
-LOGGING = {'version': 1,
- 'disable_existing_loggers': False,
- 'handlers': {
- # Include the default Django email handler for errors
- # This is what you'd get without configuring logging at all.
- 'mail_admins': {
- 'class': 'django.utils.log.AdminEmailHandler',
- 'level': 'ERROR',
- # But the emails are plain text by default - HTML is nicer
- 'include_html': True,
- },
- # Log to a text file that can be rotated by logrotate
- 'logfile': {
- 'class': 'logging.handlers.WatchedFileHandler',
- 'filename': '/var/log/django/chimere.log'
- },
- },
- 'loggers': {
- # Again, default Django configuration to email unhandled exceptions
- 'django.request': {
- 'handlers': ['mail_admins'],
- 'level': 'ERROR',
- 'propagate': True,
- },
- # Might as well log any errors anywhere else in Django
- 'django': {
- 'handlers': ['logfile'],
- 'level': 'ERROR',
- 'propagate': False,
- },
- # Your own app - this assumes all your logger names start with "myapp."
- 'chimere': {
- 'handlers': ['logfile'],
- 'level': 'WARNING', # Or maybe INFO or DEBUG
- 'propogate': False
- },
- },
-}
+LOG_PATH = '/var/log/django/'
try:
from local_settings import *
except ImportError, e:
print 'Unable to load local_settings.py:', e
+if 'LOGGING' not in globals():
+ global LOGGING
+ LOGGING = {'version': 1,
+ 'disable_existing_loggers': False,
+ 'handlers': {
+ # Include the default Django email handler for errors
+ # This is what you'd get without configuring logging at all.
+ 'mail_admins': {
+ 'class': 'django.utils.log.AdminEmailHandler',
+ 'level': 'ERROR',
+ # But the emails are plain text by default - HTML is nicer
+ 'include_html': True,
+ },
+ # Log to a text file that can be rotated by logrotate
+ 'logfile': {
+ 'class': 'logging.handlers.WatchedFileHandler',
+ 'filename': LOG_PATH + 'chimere.log'
+ },
+ },
+ 'loggers': {
+ # Again, default Django configuration to email unhandled exceptions
+ 'django.request': {
+ 'handlers': ['mail_admins'],
+ 'level': 'ERROR',
+ 'propagate': True,
+ },
+ # Might as well log any errors anywhere else in Django
+ 'django': {
+ 'handlers': ['logfile'],
+ 'level': 'ERROR',
+ 'propagate': False,
+ },
+ # Your own app - this assumes all your logger names start with "myapp."
+ 'chimere': {
+ 'handlers': ['logfile'],
+ 'level': 'WARNING', # Or maybe INFO or DEBUG
+ 'propogate': False
+ },
+ },
+ }
+
+
if 'CHIMERE_SHARE_NETWORKS' not in globals():
# after the locals to get the right STATIC_URL