Commit 18db2528 authored by Elena Grandi's avatar Elena Grandi
Browse files

Provide a (commented out) configuration to setup logging.

parent 0d8b3f51
octonet (0.2.51.5-2) UNRELEASED; urgency=medium
* Provide a (commented out) configuration to setup logging.
-- Elena Grandi <elena@truelite.it> Mon, 21 Oct 2019 10:35:35 +0200
octonet (0.2.51.5-1) unstable; urgency=medium
* Avoid HTTP Error 500 when editing a user's authorization(s).
......
debian/octonet.conf /etc/
debian/octonet_logging.conf /etc/
......@@ -10,3 +10,8 @@ ALLOWED_HOSTS = ["*"]
#makesecret: {GENERATED_SECRET} will be replaced by a newly generated one on package installation
SECRET_KEY = '{GENERATED_SECRET}'
# Uncomment the following two lines to activate logging to
# /var/log/octonet/octonet.log
#with open("/etc/octonet_logging.conf", "rt") as fd:
# exec(fd.read())
# Use this when debugging octonet, it activates logging to /var/log/octonet/octonet.log
LOGGING = {
'version': 1,
# 'disable_existing_loggers': False,
'filters': {
'require_debug_false': {
'()': 'django.utils.log.RequireDebugFalse',
},
'require_debug_true': {
'()': 'django.utils.log.RequireDebugTrue',
},
},
'formatters': {
'logfile': {
'format': '[%(asctime)s %(module)s] %(levelname)s: %(message)s',
},
},
'handlers': {
'console': {
'level': 'INFO',
'class': 'logging.StreamHandler',
},
'null': {
'class': 'django.utils.log.NullHandler',
},
'mail_admins': {
'level': 'ERROR',
'filters': ['require_debug_false'],
'class': 'django.utils.log.AdminEmailHandler'
},
'file': {
'level': 'DEBUG',
'class': 'logging.handlers.TimedRotatingFileHandler',
'filename': '/var/log/octonet/octonet.log',
'when': 'midnight',
'backupCount': 7,
'filters': ['require_debug_false'],
'formatter': 'logfile',
},
},
'loggers': {
'django': {
'handlers': ['console'],
},
'django.request': {
'handlers': ['file', 'mail_admins'],
'level': 'INFO',
'propagate': False,
},
'django.security': {
'handlers': ['mail_admins'],
'level': 'ERROR',
'propagate': False,
},
'django.db.backends': {
'level': 'INFO',
'handlers': ['file'],
'propagate': True,
},
'py.warnings': {
'handlers': ['console'],
},
},
'root': {
'level': 'INFO',
'handlers': ['file', 'console'],
},
}
......@@ -7,6 +7,9 @@ case "$1" in
adduser --disabled-password --quiet --system \
--home /var/cache/octonet \
--gecos "OctoNet web application" octonet
mkdir -p /var/log/octonet
chown octonet:root /var/log/octonet
chmod 0750 /var/log/octonet
cd /usr/share/octonet/ && su octonet -s /bin/sh -c "./manage.py collectstatic -l --noinput"
chown octonet.root /etc/octonet.conf
chmod 0640 /etc/octonet.conf
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment