From: Philippe Proulx Date: Wed, 25 Nov 2015 19:56:19 +0000 (-0500) Subject: python-application: add `logging.basicConfig()` to example X-Git-Url: https://git.liburcu.org/?a=commitdiff_plain;h=d302f5b1ad2a4a77e69581f278d84d8e58a531a0;p=lttng-docs.git python-application: add `logging.basicConfig()` to example Signed-off-by: Philippe Proulx --- diff --git a/contents/using-lttng/instrumenting/python-application.md b/contents/using-lttng/instrumenting/python-application.md index 5a887f2..1159856 100644 --- a/contents/using-lttng/instrumenting/python-application.md +++ b/contents/using-lttng/instrumenting/python-application.md @@ -16,6 +16,7 @@ import time def example(): + logging.basicConfig() logger = logging.getLogger('my-logger') while True: @@ -34,6 +35,12 @@ if __name__ == '__main__': Importing `lttngust` adds a logging handler which emits LTTng-UST events. You do not need to get a special logger for tracing to work. +Note that `logging.basicConfig()`, which adds to the root logger a basic +logging handler which prints to the standard error stream, is not +strictly required for LTTng-UST tracing to work, but in versions of +Python preceding 3.2, a warning message could be seen indicating that no +handler exists for the logger `my-logger`. + Use the `--python` option of the `lttng enable-event`, `lttng disable-event`, and `lttng list` commands to target Python applications. For example, here's how to enable the events