summaryrefslogtreecommitdiffstats
path: root/Doc/library/logging.rst
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2009-08-20 22:04:32 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2009-08-20 22:04:32 (GMT)
commit333c6e7d8f7233edf6a58d848ddf52764fd4f248 (patch)
tree02b7ce7e51cbd1d9f247f0cfcde44b8253788d10 /Doc/library/logging.rst
parent764fc235a6d6a8cf54ca47911e2237f2f17e38a7 (diff)
downloadcpython-333c6e7d8f7233edf6a58d848ddf52764fd4f248.zip
cpython-333c6e7d8f7233edf6a58d848ddf52764fd4f248.tar.gz
cpython-333c6e7d8f7233edf6a58d848ddf52764fd4f248.tar.bz2
Added section on exceptions raised during logging.
Diffstat (limited to 'Doc/library/logging.rst')
-rw-r--r--Doc/library/logging.rst22
1 files changed, 22 insertions, 0 deletions
diff --git a/Doc/library/logging.rst b/Doc/library/logging.rst
index d458bfe..bb5078a 100644
--- a/Doc/library/logging.rst
+++ b/Doc/library/logging.rst
@@ -1211,6 +1211,28 @@ are sent to both destinations.
This example uses console and file handlers, but you can use any number and
combination of handlers you choose.
+.. _logging-exceptions:
+
+Exceptions raised during logging
+--------------------------------
+
+The logging package is designed to swallow exceptions which occur while logging
+in production. This is so that errors which occur while handling logging events
+- such as logging misconfiguration, network or other similar errors - do not
+cause the application using logging to terminate prematurely.
+
+:class:`SystemExit` and :class:`KeyboardInterrupt` exceptions are never
+swallowed. Other exceptions which occur during the :meth:`emit` method of a
+:class:`Handler` subclass are passed to its :meth:`handleError` method.
+
+The default implementation of :meth:`handleError` in :class:`Handler` checks
+to see if a module-level variable, `raiseExceptions`, is set. If set, a
+traceback is printed to `sys.stderr`. If not set, the exception is swallowed.
+
+**Note:** The default value of `raiseExceptions` is `True`. This is because
+during development, you typically want to be notified of any exceptions that
+occur. It's advised that you set `raiseExceptions` to `False` for production
+usage.
.. _context-info: