rattail-manual/docs/base/config/logging.rst

33 lines
1.4 KiB
ReStructuredText
Raw Normal View History

.. highlight:: ini
Configuring Logging
===================
Rattail relies on Python standard ``logging`` module to configure logging.
However if :doc:`inheritance` is involved then Rattail will first combine all
applicable config files into a single file before handing that off to
`logging.config.fileConfig()`_.
.. _logging.config.fileConfig(): https://docs.python.org/3/library/logging.config.html#logging.config.fileConfig
Rattail does not do any of this though, unless config says to. So if you want
it to configure logging in this way, specify this in your config file::
[rattail.config]
configure_logging = true
Beyond that you must ensure your config file(s) contains appropriate settings
for logging. Rattail `has a sample`_ ``rattail.conf`` which includes a typical
logging section. (This is the source used to generate a new file when you run
``rattail make-config -T rattail`` command.)
.. _has a sample: https://kallithea.rattailproject.org/rattail-project/rattail/files/master/rattail/data/config/rattail.conf
See the Python docs for more info, in particular these sections:
* `Configuration file format <https://docs.python.org/3/library/logging.config.html#logging-config-fileformat>`_
* `Logging Levels <https://docs.python.org/3/howto/logging.html#logging-levels>`_
* `Useful Handlers <https://docs.python.org/3/howto/logging.html#useful-handlers>`_
* `Formatters <https://docs.python.org/3/howto/logging.html#formatters>`_