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
1=== modified file 'capomastro/settings.py'
2--- capomastro/settings.py 2014-11-03 19:06:32 +0000
3+++ capomastro/settings.py 2014-12-11 20:11:47 +0000
4@@ -113,6 +113,61 @@
5
6 SITE_ID = 1
7
8+# Logging Configuration
9+# See http://docs.djangoproject.com/en/dev/topics/logging for
10+# more details on how to customize your logging configuration.
11+LOGGING = {
12+ 'version': 1,
13+ 'disable_existing_loggers': False,
14+ 'formatters': {
15+ 'verbose': {
16+ 'format': '%(asctime)s | '
17+ '%(levelname)s | '
18+ '%(name)s | '
19+ '%(module)s | '
20+ '%(funcName)s | '
21+ '%(process)d | '
22+ '%(thread)d | '
23+ '%(message)s',
24+ 'datefmt': '%Y%m%d-%H:%M:%S',
25+ },
26+ 'simple': {
27+ 'format': '%(levelname)s %(message)s'
28+ },
29+ },
30+ 'filters': {
31+ 'require_debug_false': {
32+ '()': 'django.utils.log.RequireDebugFalse'
33+ }
34+ },
35+ 'handlers': {
36+ 'mail_admins': {
37+ 'level': 'ERROR',
38+ 'filters': ['require_debug_false'],
39+ 'class': 'django.utils.log.AdminEmailHandler',
40+ 'formatter': 'verbose'
41+ },
42+ 'logfile': {
43+ 'level': 'DEBUG',
44+ 'class': 'logging.handlers.TimedRotatingFileHandler',
45+ 'formatter': 'verbose',
46+ 'filename': '/var/log/capomastro/django.log',
47+ 'when': 'midnight',
48+ 'utc': True,
49+ },
50+ },
51+ 'loggers': {
52+ 'django.request': {
53+ 'handlers': ['logfile'],
54+ 'level': 'ERROR',
55+ },
56+ 'django.db.backends': {
57+ 'handlers': ['logfile'],
58+ 'level': 'ERROR',
59+ },
60+ },
61+}
62+
63 try:
64 from key_settings import * # noqa
65 except ImportError, e:
66
67=== modified file 'debian/capomastro.logrotate'
68--- debian/capomastro.logrotate 2014-11-27 15:37:33 +0000
69+++ debian/capomastro.logrotate 2014-12-11 20:11:47 +0000
70@@ -1,4 +1,4 @@
71-/var/log/capomastro/celery.log {
72+/var/log/capomastro/celery.log /var/log/capomastro/django.log {
73 rotate 7
74 maxsize 100M
75 daily
76
77=== modified file 'testing/provision-testing-environment'
78--- testing/provision-testing-environment 2014-11-12 09:27:27 +0000
79+++ testing/provision-testing-environment 2014-12-11 20:11:47 +0000
80@@ -4,6 +4,12 @@
81
82 set -e
83
84+# Makes Tarmac happy about the new LOGGING setup
85+# that would only be created by the debian package
86+logdir=/var/log/capomastro
87+mkdir -p ${logdir}
88+touch ${logdir}/django.log
89+
90 # Update to have the latest packages, this is needed because the image comes
91 # with an old (and no longer working) apt cache and links to many packages no
92 # longer work. This is also needed if the step above actually added any PPAs.

Subscribers

People subscribed via source and target branches