Merge lp:~michael.nelson/ubuntu-webcatalog/load-logging-config-in-wsgi into lp:ubuntu-webcatalog
Status: | Merged |
---|---|
Approved by: | Łukasz Czyżykowski |
Approved revision: | 189 |
Merged at revision: | 188 |
Proposed branch: | lp:~michael.nelson/ubuntu-webcatalog/load-logging-config-in-wsgi |
Merge into: | lp:ubuntu-webcatalog |
Diff against target: |
198 lines (+66/-52) 5 files modified
django_project/config/main.cfg (+1/-50) django_project/wsgi.py (+2/-2) src/webcatalog/management/commands/import_sca_apps.py (+23/-0) src/webcatalog/schema.py (+4/-0) src/webcatalog/wsgi.py (+36/-0) |
To merge this branch: | bzr merge lp:~michael.nelson/ubuntu-webcatalog/load-logging-config-in-wsgi |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Łukasz Czyżykowski (community) | Approve | ||
Review via email: mp+183586@code.launchpad.net |
Commit message
Separate logging configs for webapp and import command.
Description of the change
Related to RT 61147 - providing a log file for the import_sca_apps job that can be monitored.
After switching to a dictConfig and adding a separate logger for the import command, the deploy to staging errored because every cron/setup/whatever script which would use ./manage.py would automatically try to touch the webapp.log file (as Django loads the logging config directly after settings are loaded), and doesn't have perms on the filesystem.
This branch separates the logging configs and only initialises them when they are used (ie. in this case when the webapp is started).
As the "dictConfig" defined in a configglue ini file was getting hard to follow, rather than adding a separate dict config there, I've moved them into a more readable (ie. normal) dict where they're used, and just used settings for the relevant pieces we'd want to change (format, file location).
Finally, and strangely, I had to specify a django logger (with no handlers) just to ensure that the msgs were propagated to the root logger.
I like the idea of pulling only the relevant config bits into configglue file.