From d302f5b1ad2a4a77e69581f278d84d8e58a531a0 Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Wed, 25 Nov 2015 14:56:19 -0500 Subject: [PATCH] python-application: add `logging.basicConfig()` to example Signed-off-by: Philippe Proulx --- contents/using-lttng/instrumenting/python-application.md | 7 +++++++ 1 file changed, 7 insertions(+) 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 -- 2.34.1