Browse Source

Merge pull request #2003 from doccano/enhancement/settingLogging

[Enhancement] setting logging
pull/2004/head
Hiroki Nakayama 3 years ago
committed by GitHub
parent
commit
01e818bf78
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 4 deletions
  1. 2
      backend/cli.py
  2. 28
      backend/config/settings/production.py
  3. 8
      tools/prod-django.sh
  4. 9
      tools/run.sh

2
backend/cli.py

@ -56,7 +56,7 @@ def run_on_nix(args):
"workers": args.workers,
"chdir": base,
"capture_output": True,
"loglevel": "debug",
"loglevel": "info",
}
StandaloneApplication(options).run()

28
backend/config/settings/production.py

@ -1,3 +1,31 @@
from .base import * # noqa: F401,F403
DEBUG = False
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {
"standard": {
"format": "[%(asctime)s] [%(process)d] [%(levelname)s] [%(name)s::%(funcName)s::%(lineno)d] %(message)s",
"datefmt": "%Y-%m-%d %H:%M:%S %z",
}
},
"handlers": {
"console": {
"level": "INFO",
"class": "logging.StreamHandler",
"formatter": "standard",
},
},
"root": {
"handlers": ["console"],
"level": "INFO",
},
"loggers": {
"django": {
"handlers": ["console"],
"level": "INFO",
},
},
}

8
tools/prod-django.sh

@ -31,4 +31,10 @@ if [[ -n "${ADMIN_USERNAME}" ]] && [[ -n "${ADMIN_PASSWORD}" ]] && [[ -n "${ADMI
fi
echo "Starting django"
gunicorn --bind="${HOST:-0.0.0.0}:${PORT:-8000}" --workers="${WORKERS:-4}" config.wsgi --timeout 300
gunicorn \
--bind="${HOST:-0.0.0.0}:${PORT:-8000}" \
--workers="${WORKERS:-4}" \
--timeout=300 \
--capture-output \
--log-level info \
config.wsgi

9
tools/run.sh

@ -35,8 +35,13 @@ if [[ -n "${ADMIN_USERNAME}" ]] && [[ -n "${ADMIN_PASSWORD}" ]] && [[ -n "${ADMI
fi
echo "Starting django"
# gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-4}" app.wsgi --timeout 300
gunicorn --bind="0.0.0.0:${PORT:-8000}" --workers="${WORKERS:-1}" config.wsgi --timeout=300 &
gunicorn \
--bind="0.0.0.0:${PORT:-8000}" \
--workers="${WORKERS:-1}" \
--timeout=300 \
--capture-output \
--log-level info \
config.wsgi &
gunicorn_pid="$!"
echo "Starting celery"

Loading…
Cancel
Save