-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logging configuration for both dev and prod environments
- Loading branch information
1 parent
70717f5
commit 20a0f38
Showing
17 changed files
with
139 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,53 +61,33 @@ def get_secret(setting, secret_type=env): | |
|
||
|
||
# LOGGING CONFIGURATION | ||
# ------------------------------------------------------------------------------ | ||
# See: https://docs.djangoproject.com/en/dev/ref/settings/#logging | ||
# 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 when DEBUG=False. | ||
# See http://docs.djangoproject.com/en/dev/topics/logging for | ||
# See http://docs.djangoproject.com/en/2.2/topics/logging for | ||
# more details on how to customize your logging configuration. | ||
ADMINS = [('FNNDSC Developers', '[email protected]')] | ||
LOGGING = { | ||
'version': 1, | ||
'disable_existing_loggers': False, | ||
'filters': { | ||
'require_debug_false': { | ||
'()': 'django.utils.log.RequireDebugFalse' | ||
} | ||
}, | ||
'formatters': { | ||
'verbose': { | ||
'format': '%(levelname)s %(asctime)s %(module)s ' | ||
'%(process)d %(thread)d %(message)s' | ||
'console': { | ||
'format': '[%(levelname)s][%(name)s][%(filename)s:%(lineno)d %(funcName)s] %(message)s' | ||
}, | ||
}, | ||
'handlers': { | ||
'mail_admins': { | ||
'level': 'ERROR', | ||
'filters': ['require_debug_false'], | ||
'class': 'django.utils.log.AdminEmailHandler' | ||
}, | ||
'console': { | ||
'level': 'DEBUG', | ||
'level': 'INFO', | ||
'class': 'logging.StreamHandler', | ||
'formatter': 'verbose', | ||
'formatter': 'console', | ||
}, | ||
}, | ||
'loggers': { | ||
'django.request': { | ||
'handlers': ['mail_admins'], | ||
'level': 'ERROR', | ||
'propagate': True | ||
}, | ||
'django.security.DisallowedHost': { | ||
'level': 'ERROR', | ||
'handlers': ['console', 'mail_admins'], | ||
'propagate': True | ||
'': { # root logger | ||
'level': 'INFO', | ||
'handlers': ['console'], | ||
} | ||
} | ||
} | ||
|
||
|
||
# Your production stuff: Below this line define 3rd party library settings | ||
|
||
# CORSHEADERS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
|
||
import logging | ||
|
||
from django.test import TestCase | ||
from django.contrib.auth.models import User | ||
|
||
|
@@ -9,6 +11,9 @@ | |
class ModelTests(TestCase): | ||
|
||
def setUp(self): | ||
# avoid cluttered console output (for instance logging all the http requests) | ||
logging.disable(logging.WARNING) | ||
|
||
self.username = 'foo' | ||
self.password = 'foopassword' | ||
self.email = '[email protected]' | ||
|
@@ -44,6 +49,10 @@ def setUp(self): | |
plugin.descriptor_file.name = self.plugin_name + '.json' | ||
plugin.save() | ||
|
||
def tearDown(self): | ||
# re-enable logging | ||
logging.disable(logging.NOTSET) | ||
|
||
|
||
class PluginMetaModelTests(ModelTests): | ||
|
||
|
Oops, something went wrong.