From c38fffb7a4c818b9257fc3431fcf55a128c9b849 Mon Sep 17 00:00:00 2001 From: Benjamin Diaz Date: Wed, 24 Jul 2019 15:57:38 -0300 Subject: [PATCH] Adds django stdout logging Change-Id: Ic2ff3d346502c03c0ae9d08e238ed8ca956cc0bd Signed-off-by: Benjamin Diaz --- django.ini | 4 +--- sf_t3d/settings.py | 27 +++++++++++++++++++++++++++ supervisor-app.conf | 10 +++++++++- 3 files changed, 37 insertions(+), 4 deletions(-) diff --git a/django.ini b/django.ini index 3eb767f..1d87a3b 100644 --- a/django.ini +++ b/django.ini @@ -12,6 +12,4 @@ max-requests = 5000 # clear environment on exit vacuum = true # optional path to a virtualenv -#home = env -# background the process -daemonize = django.uwsgi.log \ No newline at end of file +#home = env \ No newline at end of file diff --git a/sf_t3d/settings.py b/sf_t3d/settings.py index 644cba9..0beb212 100644 --- a/sf_t3d/settings.py +++ b/sf_t3d/settings.py @@ -15,6 +15,8 @@ # import os +import sys + from sqlalchemy.engine.url import make_url # Build paths inside the project like this: os.path.join(BASE_DIR, ...) @@ -206,3 +208,28 @@ else: LOCALE_PATHS = ( os.path.join(BASE_DIR, 'locale'), ) + +LOGGING = { + 'version': 1, + 'disable_existing_loggers': False, + 'formatters': { + 'verbose': { + 'format': '[django] %(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s' + } + }, + 'handlers': { + 'console': { + 'level': 'DEBUG', + 'class': 'logging.StreamHandler', + 'stream': sys.stdout, + 'formatter': 'verbose' + }, + }, + 'loggers': { + 'django': { + 'handlers': ['console'], + 'level': 'DEBUG', + 'propagate': True, + }, + }, +} \ No newline at end of file diff --git a/supervisor-app.conf b/supervisor-app.conf index 1dabdea..c482e86 100644 --- a/supervisor-app.conf +++ b/supervisor-app.conf @@ -1,6 +1,14 @@ [program:app-uwsgi] -command = /usr/local/bin/uwsgi --ini /usr/share/osm-lightui/django.ini +command = /usr/local/bin/uwsgi --ini /usr/share/osm-lightui/django.ini --log-master environment=DJANGO_ENV="prod" +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stdout_logfile=/dev/stderr +stdout_logfile_maxbytes=0 [program:nginx-app] command = /usr/sbin/nginx +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stdout_logfile=/dev/stderr +stdout_logfile_maxbytes=0 \ No newline at end of file -- 2.25.1