Merge lp:~ce-infrastructure/capomastro/capomastro-django-logs into lp:capomastro

Proposed by Caio Begotti
Status: Merged
Approved by: Caio Begotti
Approved revision: 155
Merged at revision: 153
Proposed branch: lp:~ce-infrastructure/capomastro/capomastro-django-logs
Merge into: lp:capomastro
Diff against target: 92 lines (+62/-1)
3 files modified
capomastro/settings.py (+55/-0)
debian/capomastro.logrotate (+1/-1)
testing/provision-testing-environment (+6/-0)
To merge this branch: bzr merge lp:~ce-infrastructure/capomastro/capomastro-django-logs
Reviewer Review Type Date Requested Status
Sheila Miguez (community) Approve
Review via email: mp+244496@code.launchpad.net

Description of the change

Sheila, I'm asking you specifically to review it as I stole this setting from Poke and I think you know Django logging better than I do :-) in fact I just wanted to be on the safe side so we don't loose any Dajngo traces even though the log won't be too verbose at first.

To post a comment you must log in.
Revision history for this message
Sheila Miguez (codersquid) wrote :

It looks good to me.

I should borrow from you and remove the AdminEmailHandler in my loggers since I'm not doing anything with that yet.

review: Approve
Revision history for this message
Daniel Manrique (roadmr) wrote :

The attempt to merge lp:~ce-infrastructure/capomastro/capomastro-django-logs into lp:capomastro failed. Below is the output from the failed tests.

[trusty] starting container
[trusty] (timing) 0.06user 0.00system 0:05.20elapsed 1%CPU (0avgtext+0avgdata 7864maxresident)k
[trusty] (timing) 0inputs+32outputs (0major+6071minor)pagefaults 0swaps
[trusty] provisioning container
[trusty] (timing) 21.26user 5.10system 0:36.53elapsed 72%CPU (0avgtext+0avgdata 51708maxresident)k
[trusty] (timing) 0inputs+72outputs (0major+950632minor)pagefaults 0swaps
[trusty-testing] Starting tests...
[trusty-testing] : FAIL
[trusty-testing] stdout: http://paste.ubuntu.com/9479665/
[trusty-testing] stderr: http://paste.ubuntu.com/9479666/
[trusty-testing] (timing) Command exited with non-zero status 1
[trusty-testing] (timing) 24.78user 5.40system 3:32.51elapsed 14%CPU (0avgtext+0avgdata 31148maxresident)k
[trusty-testing] (timing) 0inputs+208992outputs (0major+1035842minor)pagefaults 0swaps
[trusty-testing] Destroying container

trusty-testing doesn't exist

Revision history for this message
Daniel Manrique (roadmr) wrote :

Ohnoes, tarmac is un happy because when running the tests it can't touch the required file (directory doesn't exist). Perhaps the configuration you wanted applies at all times, and we won't want it to if we're running in testing mode? and of course, in testing the given directory doesn't exist. Am I correct in assuming the capomastro package will create that dir?

155. By Caio Begotti

fix the tarmac verification if the file really exists

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'capomastro/settings.py'
--- capomastro/settings.py 2014-11-03 19:06:32 +0000
+++ capomastro/settings.py 2014-12-11 20:11:47 +0000
@@ -113,6 +113,61 @@
113113
114SITE_ID = 1114SITE_ID = 1
115115
116# Logging Configuration
117# See http://docs.djangoproject.com/en/dev/topics/logging for
118# more details on how to customize your logging configuration.
119LOGGING = {
120 'version': 1,
121 'disable_existing_loggers': False,
122 'formatters': {
123 'verbose': {
124 'format': '%(asctime)s | '
125 '%(levelname)s | '
126 '%(name)s | '
127 '%(module)s | '
128 '%(funcName)s | '
129 '%(process)d | '
130 '%(thread)d | '
131 '%(message)s',
132 'datefmt': '%Y%m%d-%H:%M:%S',
133 },
134 'simple': {
135 'format': '%(levelname)s %(message)s'
136 },
137 },
138 'filters': {
139 'require_debug_false': {
140 '()': 'django.utils.log.RequireDebugFalse'
141 }
142 },
143 'handlers': {
144 'mail_admins': {
145 'level': 'ERROR',
146 'filters': ['require_debug_false'],
147 'class': 'django.utils.log.AdminEmailHandler',
148 'formatter': 'verbose'
149 },
150 'logfile': {
151 'level': 'DEBUG',
152 'class': 'logging.handlers.TimedRotatingFileHandler',
153 'formatter': 'verbose',
154 'filename': '/var/log/capomastro/django.log',
155 'when': 'midnight',
156 'utc': True,
157 },
158 },
159 'loggers': {
160 'django.request': {
161 'handlers': ['logfile'],
162 'level': 'ERROR',
163 },
164 'django.db.backends': {
165 'handlers': ['logfile'],
166 'level': 'ERROR',
167 },
168 },
169}
170
116try:171try:
117 from key_settings import * # noqa172 from key_settings import * # noqa
118except ImportError, e:173except ImportError, e:
119174
=== modified file 'debian/capomastro.logrotate'
--- debian/capomastro.logrotate 2014-11-27 15:37:33 +0000
+++ debian/capomastro.logrotate 2014-12-11 20:11:47 +0000
@@ -1,4 +1,4 @@
1/var/log/capomastro/celery.log {1/var/log/capomastro/celery.log /var/log/capomastro/django.log {
2 rotate 72 rotate 7
3 maxsize 100M3 maxsize 100M
4 daily4 daily
55
=== modified file 'testing/provision-testing-environment'
--- testing/provision-testing-environment 2014-11-12 09:27:27 +0000
+++ testing/provision-testing-environment 2014-12-11 20:11:47 +0000
@@ -4,6 +4,12 @@
44
5set -e5set -e
66
7# Makes Tarmac happy about the new LOGGING setup
8# that would only be created by the debian package
9logdir=/var/log/capomastro
10mkdir -p ${logdir}
11touch ${logdir}/django.log
12
7# Update to have the latest packages, this is needed because the image comes13# Update to have the latest packages, this is needed because the image comes
8# with an old (and no longer working) apt cache and links to many packages no14# with an old (and no longer working) apt cache and links to many packages no
9# longer work. This is also needed if the step above actually added any PPAs.15# longer work. This is also needed if the step above actually added any PPAs.

Subscribers

People subscribed via source and target branches