python-application: add `logging.basicConfig()` to example
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 25 Nov 2015 19:56:19 +0000 (14:56 -0500)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Wed, 25 Nov 2015 20:22:41 +0000 (15:22 -0500)
Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
contents/using-lttng/instrumenting/python-application.md

index 5a887f2581911ab4564bc3f74be7b6f701718174..1159856f7608ad9df5661d0e5d33e04e5bc30cfa 100644 (file)
@@ -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
This page took 0.023143 seconds and 4 git commands to generate.