diff --git a/CHANGES/2921.doc b/CHANGES/2921.doc new file mode 100644 index 00000000000..3d24fff45ee --- /dev/null +++ b/CHANGES/2921.doc @@ -0,0 +1 @@ +Improve Gunicorn logging documentation diff --git a/docs/deployment.rst b/docs/deployment.rst index 84014444c1f..e1cf1ea3351 100644 --- a/docs/deployment.rst +++ b/docs/deployment.rst @@ -280,6 +280,8 @@ In this case, we will use: many worker processes to use for handling requests. (See the documentation for recommendations on `How Many Workers? `_) +* you may also want to use the *'--accesslog'* flag to enable the access + log to be populated. (See :ref:`logging ` for more information.) The custom worker subclass is defined in ``aiohttp.GunicornWebWorker``:: diff --git a/docs/logging.rst b/docs/logging.rst index f407bb3bf2a..a4348d59ae0 100644 --- a/docs/logging.rst +++ b/docs/logging.rst @@ -102,14 +102,26 @@ Example of drop-in replacement for :class:`aiohttp.helpers.AccessLogger`:: f'"{request.method} {request.path} ' f'done in {time}s: {response.status}') -.. note:: - When `Gunicorn `_ is used for - :ref:`deployment ` its default access log format - will be automatically replaced with the default aiohttp's access log format. +.. _gunicorn-accesslog: + +Gunicorn access logs +^^^^^^^^^^^^^^^^^^^^ +When `Gunicorn `_ is used for +:ref:`deployment ` its default access log format +will be automatically replaced with the default aiohttp's access log format. + +If Gunicorn's option access_logformat_ is +specified explicitly it should use aiohttp's format specification. + +Gunicorn access log works only if accesslog_ is specified explicitly in your +config or as a command line option. +This configuration can be either a path or ``'-'``. If the application uses +a custom logging setup intercepting the ``'gunicorn.access'`` logger, +accesslog_ should be set to ``'-'`` to prevent Gunicorn to create an empty +access log file upon every startup. + - If Gunicorn's option access_logformat_ is - specified explicitly it should use aiohttp's format specification. Error logs @@ -127,3 +139,6 @@ To use different logger name please specify *logger* parameter .. _access_logformat: http://docs.gunicorn.org/en/stable/settings.html#access-log-format + +.. _accesslog: + http://docs.gunicorn.org/en/stable/settings.html#accesslog