diff --git a/gunicorn_config.py b/gunicorn_config.py new file mode 100644 index 000000000..11993ab78 --- /dev/null +++ b/gunicorn_config.py @@ -0,0 +1,8 @@ +import sys +import traceback + + +def worker_abort(worker): + worker.log.info("worker received ABORT") + for threadId, stack in sys._current_frames().items(): + worker.log.error(''.join(traceback.format_stack(stack))) diff --git a/manifest-base.yml b/manifest-base.yml index 3f6c0397e..bf16b7af8 100644 --- a/manifest-base.yml +++ b/manifest-base.yml @@ -1,7 +1,7 @@ --- buildpack: python_buildpack -command: scripts/run_app_paas.sh gunicorn -w 5 -b 0.0.0.0:$PORT wsgi +command: scripts/run_app_paas.sh gunicorn -c /home/vcap/app/gunicorn_config.py --error-logfile /home/vcap/logs/gunicorn_error.log -w 5 -b 0.0.0.0:$PORT wsgi services: - notify-aws - notify-config diff --git a/scripts/run_app_paas.sh b/scripts/run_app_paas.sh index 2112e4789..499cfeb2b 100755 --- a/scripts/run_app_paas.sh +++ b/scripts/run_app_paas.sh @@ -29,6 +29,11 @@ state_file = /home/vcap/logs/awslogs-state file = /home/vcap/logs/app.log* log_group_name = paas-${CW_APP_NAME}-application log_stream_name = {hostname} + +[/home/vcap/logs/gunicorn_error.log] +file = /home/vcap/logs/gunicorn_error.log +log_group_name = paas-${CW_APP_NAME}-gunicorn +log_stream_name = {hostname} EOF }