Commit 22ec72df authored by Denis Laxalde's avatar Denis Laxalde
Browse files

[pyramid] Let logging be configured through .ini file

We do not initialize logging in CubicWebPyramidConfiguration thus
preventing logging to be started with cubicweb's configuration. On the
other hand, any logging configuration defined in ``development.ini``
file will be loaded by whatever start the instance using this file (i.e.
pserve, gunicorn, etc.). The benefit is that logging can now be
configured per "qualified name" in this file (i.e. one can easily set
the DEBUG level for the application cube while keeping all dependencies'
level to WARNING). In the development.ini template, we add logger
configurations for "logilab" and "cubicweb" qualified names (along with
those of the application cube).
parent 6a71cb23f827
......@@ -47,6 +47,11 @@ class CubicWebPyramidConfiguration(BaseWebConfiguration, ServerConfiguration):
options = merge_options(ServerConfiguration.options +
BaseWebConfiguration.options)
def init_log(self, *args, **kwargs):
"""Rely on logging configuration in Pyramid's .ini file, do nothing
here.
"""
def write_development_ini(self, cubes):
"""Write a 'development.ini' file into apphome."""
template_fpath = path.join(path.dirname(__file__), 'development.ini.tmpl')
......
......@@ -37,3 +37,47 @@ cubicweb.auth.authtkt.session.secret = %(auth-authtkt-session-secret)s
[server:main]
use = egg:waitress#main
listen = 127.0.0.1:6543 [::1]:6543
###
# logging configuration
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
###
[loggers]
keys = root, logilab, cubicweb, cubicweb_%(cubename)s
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = INFO
handlers = console
[logger_logilab]
level = WARNING
handlers = console
qualname = logilab
[logger_cubicweb]
level = INFO
handlers = console
qualname = cubicweb
[logger_cubicweb_%(cubename)s]
level = DEBUG
handlers = console
qualname = cubicweb_%(cubename)s
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
class = logilab.common.logging_ext.ColorFormatter
format = %%(asctime)s - (%%(name)s) %%(levelname)s: %%(message)s
datefmt = %%Y-%%m-%%d %%H:%%M:%%S
3.26 (unreleased)
=================
New features
------------
* For ``pyramid`` instance configuration kind, logging is not handled anymore
by CubicWeb but should be configured through ``development.ini`` file
following https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html.
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