-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1417 from camptocamp/c2cwsgiutils
Updates for c2cwsgiutils 5.0
- Loading branch information
Showing
5 changed files
with
154 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
### | ||
# app configuration | ||
# http://docs.pylonsproject.org/projects/pyramid/en/1.6-branch/narr/environment.html | ||
### | ||
|
||
[app:app] | ||
use = egg:tilecloud-chain | ||
filter-with = proxy-prefix | ||
|
||
pyramid.reload_templates = %(DEVELOPMENT)s | ||
pyramid.debug_authorization = %(DEVELOPMENT)s | ||
pyramid.debug_notfound = %(DEVELOPMENT)s | ||
pyramid.debug_routematch = %(DEVELOPMENT)s | ||
pyramid.debug_templates = %(DEVELOPMENT)s | ||
pyramid.default_locale_name = en | ||
|
||
c2c.base_path = /c2c | ||
|
||
tilegeneration_configfile = %(TILEGENERATION_CONFIGFILE)s | ||
|
||
[pipeline:main] | ||
pipeline = egg:c2cwsgiutils#client_info egg:c2cwsgiutils#profiler egg:c2cwsgiutils#sentry app | ||
|
||
[filter:proxy-prefix] | ||
use = egg:PasteDeploy#prefix | ||
prefix = %(VISIBLE_ENTRY_POINT)s | ||
|
||
### | ||
# logging configuration | ||
# http://docs.pylonsproject.org/projects/pyramid/en/1.6-branch/narr/logging.html | ||
### | ||
|
||
[loggers] | ||
keys = root, c2cwsgi, tilecloud, tilecloud_chain | ||
|
||
[handlers] | ||
keys = console, json | ||
|
||
[formatters] | ||
keys = generic | ||
format = %(levelname)-5.5s [%(name)s] %(message)s | ||
|
||
[logger_root] | ||
level = %(OTHER_LOG_LEVEL)s | ||
handlers = %(LOG_TYPE)s | ||
|
||
[logger_tilecloud] | ||
level = %(TILECLOUD_LOG_LEVEL)s | ||
handlers = | ||
qualname = tilecloud | ||
|
||
[logger_tilecloud_chain] | ||
level = %(TILECLOUD_CHAIN_LOG_LEVEL)s | ||
handlers = | ||
qualname = tilecloud_chain | ||
|
||
[logger_c2cwsgi] | ||
level = %(C2CWSGIUTILS_LOG_LEVEL)s | ||
handlers = | ||
qualname = c2cwsgiutils | ||
|
||
[handler_console] | ||
class = StreamHandler | ||
args = (sys.stdout,) | ||
level = NOTSET | ||
formatter = generic | ||
|
||
[formatter_generic] | ||
format = %(levelname)-5.5s %(name)s %(message)s | ||
|
||
[handler_json] | ||
class = c2cwsgiutils.pyramid_logging.JsonLogHandler | ||
args = (sys.stdout,) | ||
level = NOTSET |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
### | ||
# app configuration | ||
# https://docs.gunicorn.org/en/stable/settings.html | ||
### | ||
|
||
import os | ||
|
||
from c2cwsgiutils import get_config_defaults | ||
|
||
bind = ":8080" | ||
|
||
worker_class = "gthread" | ||
workers = os.environ.get("GUNICORN_WORKERS", 2) | ||
threads = os.environ.get("GUNICORN_THREADS", 10) | ||
|
||
preload = "true" | ||
|
||
accesslog = "-" | ||
access_log_format = os.environ.get( | ||
"GUNICORN_ACCESS_LOG_FORMAT", | ||
'%(H)s %({Host}i)s %(m)s %(U)s?%(q)s "%(f)s" "%(a)s" %(s)s %(B)s %(D)s %(p)s', | ||
) | ||
|
||
### | ||
# logging configuration | ||
# https://docs.python.org/3/library/logging.config.html#logging-config-dictschema | ||
### | ||
logconfig_dict = { | ||
"version": 1, | ||
"root": { | ||
"level": os.environ["OTHER_LOG_LEVEL"], | ||
"handlers": [os.environ["LOG_TYPE"]], | ||
}, | ||
"loggers": { | ||
"gunicorn.error": {"level": os.environ["GUNICORN_LOG_LEVEL"]}, | ||
"gunicorn.access": {"level": os.environ["GUNICORN_ACCESS_LOG_LEVEL"]}, | ||
# "level = INFO" logs SQL queries. | ||
# "level = DEBUG" logs SQL queries and results. | ||
# "level = WARN" logs neither. (Recommended for production systems.) | ||
"sqlalchemy.engine": {"level": os.environ["SQL_LOG_LEVEL"]}, | ||
"c2cwsgiutils": {"level": os.environ["C2CWSGIUTILS_LOG_LEVEL"]}, | ||
"tilecloud": {"level": os.environ["TILECLOUD_LOG_LEVEL"]}, | ||
"tilecloud_chain": {"level": os.environ["TILECLOUD_CHAIN_LOG_LEVEL"]}, | ||
}, | ||
"handlers": { | ||
"console": { | ||
"class": "logging.StreamHandler", | ||
"formatter": "generic", | ||
"stream": "ext://sys.stdout", | ||
}, | ||
"json": { | ||
"class": "c2cwsgiutils.pyramid_logging.JsonLogHandler", | ||
"formatter": "generic", | ||
"stream": "ext://sys.stdout", | ||
}, | ||
}, | ||
"formatters": { | ||
"generic": { | ||
"format": "%(asctime)s [%(process)d] [%(levelname)-5.5s] %(message)s", | ||
"datefmt": "[%Y-%m-%d %H:%M:%S %z]", | ||
"class": "logging.Formatter", | ||
} | ||
}, | ||
} | ||
|
||
raw_paste_global_conf = ["=".join(e) for e in get_config_defaults().items()] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters