Skip to content

Commit

Permalink
Improve Gunicorn logging documentation (#2921)
Browse files Browse the repository at this point in the history
* Improve gunicorn logging documentation

* Fix spelling error in logging documentation

* Fix anchor linking between different files

* Create 2921.doc
  • Loading branch information
crisidev authored and asvetlov committed Apr 17, 2018
1 parent c12de3d commit af0994f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES/2921.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve Gunicorn logging documentation
2 changes: 2 additions & 0 deletions docs/deployment.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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?
<http://docs.gunicorn.org/en/latest/design.html#how-many-workers>`_)
* you may also want to use the *'--accesslog'* flag to enable the access
log to be populated. (See :ref:`logging <gunicorn-accesslog>` for more information.)

The custom worker subclass is defined in ``aiohttp.GunicornWebWorker``::

Expand Down
27 changes: 21 additions & 6 deletions docs/logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 <http://docs.gunicorn.org/en/latest/index.html>`_ is used for
:ref:`deployment <aiohttp-deployment-gunicorn>` its default access log format
will be automatically replaced with the default aiohttp's access log format.
.. _gunicorn-accesslog:

Gunicorn access logs
^^^^^^^^^^^^^^^^^^^^
When `Gunicorn <http://docs.gunicorn.org/en/latest/index.html>`_ is used for
:ref:`deployment <aiohttp-deployment-gunicorn>` 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
Expand All @@ -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

0 comments on commit af0994f

Please sign in to comment.