lttng.control: Document and test the Python domain in the Control view
authorBruno Roy <bruno.roy@ericsson.com>
Thu, 11 Aug 2016 17:53:58 +0000 (13:53 -0400)
committerMatthew Khouzam <matthew.khouzam@ericsson.com>
Fri, 12 Aug 2016 20:27:32 +0000 (16:27 -0400)
Add the documentation and tests for enabling loggers of the Python
domain in the Control view.

Change-Id: I703927c048c2f850a7c441643e724025fec4e916
Signed-off-by: Bruno Roy <bruno.roy@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/78891
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Reviewed-by: Matthew Khouzam <matthew.khouzam@ericsson.com>
14 files changed:
doc/org.eclipse.tracecompass.doc.user/doc/User-Guide.mediawiki
doc/org.eclipse.tracecompass.doc.user/doc/images/LTTng2EnabledAllPythonLoggers.png [new file with mode: 0644]
doc/org.eclipse.tracecompass.doc.user/doc/images/LTTng2PythonLoggerEventsDialog.png [new file with mode: 0644]
doc/org.eclipse.tracecompass.doc.user/doc/images/LTTng2PythonLoglevelEventsDialog.png [new file with mode: 0644]
lttng/org.eclipse.tracecompass.lttng2.control.core.tests/src/org/eclipse/tracecompass/lttng2/control/core/tests/model/impl/BaseLoggerInfoTest.java
lttng/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/model/TracePythonLogLevel.java
lttng/org.eclipse.tracecompass.lttng2.control.core/src/org/eclipse/tracecompass/internal/lttng2/control/core/model/impl/BaseLoggerInfo.java
lttng/org.eclipse.tracecompass.lttng2.control.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/control/ui/swtbot/tests/ControlViewLoggerTest.java
lttng/org.eclipse.tracecompass.lttng2.control.ui.swtbot.tests/src/org/eclipse/tracecompass/lttng2/control/ui/swtbot/tests/ControlViewSwtBotUtil.java
lttng/org.eclipse.tracecompass.lttng2.control.ui.swtbot.tests/testfiles/CreateSessionTestLTTng2_8.cfg
lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/service/LTTngControlServiceMiTest.java
lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/src/org/eclipse/tracecompass/lttng2/control/ui/tests/service/LTTngControlServiceTest.java
lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMi3Test.cfg
lttng/org.eclipse.tracecompass.lttng2.control.ui.tests/testfiles/LTTngServiceMiTest.cfg

index 4e384a71190433d5aae3a01addda18c7c9d1b1ef..7f544e57421ada9a24ee43f8aec8527a051e62f5 100644 (file)
@@ -1178,7 +1178,7 @@ Under the host level two folder groups are located. The first one is the '''Prov
 
 Under the '''Provider''' group all trace providers are displayed. Trace providers are '''Kernel''' and any user space application that supports UST tracing. Under each provider a corresponding list of events are displayed.
 
-Under the '''Sessions''' group all current sessions will be shown. The level under the sessions show the configured domains. Currently the LTTng 2.0 Tracer Toolchan supports domain '''Kernel''' and '''UST global'''. Under each domain the configured channels will be displayed. The last level is under the channels where the configured events are displayed.
+Under the '''Sessions''' group all current sessions will be shown. The level under the sessions show the configured domains. Currently the LTTng Tracer Toolchain supports domain '''Kernel''', '''UST global''', '''JUL''', '''Log4j''' and '''Python'''. Under the domains '''Kernel''' and '''UST Global''' the configured channels will be displayed. The last level is under the channels where the configured events are displayed.
 
 Each session can be '''ACTIVE''' or '''INACTIVE'''. Active means that tracing has been started, inactive means that the tracing has been stopped. Depending on the state of a session a different icon is displayed. The icon for an active session is [[Image:images/Session_active.gif]]. The icon for an inactive session is [[Image:images/Session_inactive.gif]].
 
@@ -1272,7 +1272,7 @@ A dialog box will open for entering information about the channel to be created.
 
 By default the domain '''Kernel''' is selected. To create a UST channel, select '''UST''' under the domain section. The label <Default> in any text box indicates that the default value of the tracer will be configured. To initialize the dialog box press button '''Default'''.
 
-'''Note''': You cannot create a channel under the '''JUL''' and '''LOG4J''' domain. Instead those domains uses a default channel under the '''UST global''' domain named '''lttng_jul_channel''' or '''lttng_log4j_channel'''. Those are the channels that LTTng uses to trace Java application (using '''JUL''' or '''LOG4J''') and you cannot add '''UST''' events to those channels.
+'''Note''': You cannot create a channel under the '''JUL''', '''LOG4J''' and '''Python''' domain. Instead those domains uses a default channel under the '''UST global''' domain named '''lttng_jul_channel''', '''lttng_log4j_channel''' or '''lttng_python_channel'''. Those are the channels that LTTng uses to trace Java or Python application and you cannot add '''UST''' events to those channels.
 
 If required update the following channel information and then press '''Ok'''.
 
@@ -1463,9 +1463,28 @@ For LOG4J it is possible to enable '''Logger''' events using log levels. To enab
 
 [[Image:images/LTTng2Log4jLoglevelEventsDialog.png]]
 
+=== Enabling Python Events On Session Level ===
+
+For enabling Python loggers, first open the enable events dialog as described in section [[#Enabling JUL Events On Session Level | Enabling JUL Events On Session Level]] and select domain '''Python'''.
+
+To enable '''Loggers''', first select the corresponding '''Select''' button, then select either all loggers (select '''All''') or select selectively one or more loggers in the displayed tree of loggers. You can also enter the name of your logger in the text field. Finally press '''Ok'''.
+
+[[Image:images/LTTng2PythonLoggerEventsDialog.png]]
+
+Upon successful operation, the domain '''Python''' will be created in the tree (if neccessary). With Python loggers there is no channel, you see the enabled loggers directly under the '''Python''' domain. Note that for the case that '''All''' loggers were selected the wildcard '''*''' is used which will be shown in the Control View as below.
+
+[[Image:images/LTTng2EnabledAllPythonLoggers.png]]
+
+For Python it is possible to enable '''Logger''' events using log levels. To enable '''Logger''' events using log levels, check the corresponding '''Select''' button, select a log level from the drop down menu, fill in the relevant information (see below) and press '''Ok'''.
+
+* '''loglevel''': To specify if a range of log levels (0 to selected log level) shall be configured
+* '''loglevel-only''': To specify that only the specified log level shall be configured
+
+[[Image:images/LTTng2PythonLoglevelEventsDialog.png]]
+
 === Enabling Events On Domain Level ===
 
-Kernel events can also be enabled on the domain level. For that select the relevant domain tree node, click the right mouse button and the select '''Enable Event (default channel)...'''. A new dialog box will open for providing information about the events to be enabled. Depending on the domain, '''Kernel''', '''UST global''', '''JUL''' or '''LOG4J''', the domain specific fields are shown and the domain selector is preselected and read-only.
+Kernel events can also be enabled on the domain level. For that select the relevant domain tree node, click the right mouse button and the select '''Enable Event (default channel)...'''. A new dialog box will open for providing information about the events to be enabled. Depending on the domain, '''Kernel''', '''UST global''', '''JUL''', '''LOG4J''' or '''Python''', the domain specific fields are shown and the domain selector is preselected and read-only.
 
 [[Image:images/LTTng2EventOnDomainAction.png]]
 
@@ -1474,14 +1493,15 @@ Instructions for enalbing events for a particular domain can be found here:
 * '''UST global''' domain: [[#Enabling UST Events On Session Level | Enabling UST Events On Session Level]]
 * '''JUL''' domain: [[#Enabling JUL Events On Session Level | Enabling JUL Events On Session Level]]
 * '''LOG4J''' domain: [[#Enabling LOG4J Events On Session Level | Enabling LOG4J Events On Session Level]]
+* '''Python''' domain: [[#Enabling Python Events On Session Level | Enabling Python Events On Session Level]]
 
-The events will be add to the default channel '''channel0'''. This channel will be created by on the server side if neccessary.
+The events will be added to the default channel '''channel0'''. This channel will be created by on the server side if necessary.
 
 === Enabling Events On Channel Level ===
 
 Kernel events can also be enabled on the channel level. If necessary, create a channel as described in sections [[#Enabling Channels On Session Level | Enabling Channels On Session Level]] or [[#Enabling Channels On Domain Level | Enabling Channels On Domain Level]].
 
-Then select the relevant channel tree node, click the right mouse button and the select '''Enable Event...'''. A new dialog box will open for providing information about the events to be enabled. Depending on the domain, '''Kernel''' or '''UST global''', the domain specifc fields are shown and the domain selector is preselected and read-only. Since there is no channel under the '''JUL''' or '''LOG4J''' domain you cannot enable those loggers directly from a channel. 
+Then select the relevant channel tree node, click the right mouse button and the select '''Enable Event...'''. A new dialog box will open for providing information about the events to be enabled. Depending on the domain, '''Kernel''' or '''UST global''', the domain specific fields are shown and the domain selector is preselected and read-only. Since there is no channel under the '''JUL''', '''LOG4J''' or '''Python''' domain you cannot enable those loggers directly from a channel. 
 
 [[Image:images/LTTng2EventOnChannelAction.png]]
 
diff --git a/doc/org.eclipse.tracecompass.doc.user/doc/images/LTTng2EnabledAllPythonLoggers.png b/doc/org.eclipse.tracecompass.doc.user/doc/images/LTTng2EnabledAllPythonLoggers.png
new file mode 100644 (file)
index 0000000..90578a8
Binary files /dev/null and b/doc/org.eclipse.tracecompass.doc.user/doc/images/LTTng2EnabledAllPythonLoggers.png differ
diff --git a/doc/org.eclipse.tracecompass.doc.user/doc/images/LTTng2PythonLoggerEventsDialog.png b/doc/org.eclipse.tracecompass.doc.user/doc/images/LTTng2PythonLoggerEventsDialog.png
new file mode 100644 (file)
index 0000000..f87419f
Binary files /dev/null and b/doc/org.eclipse.tracecompass.doc.user/doc/images/LTTng2PythonLoggerEventsDialog.png differ
diff --git a/doc/org.eclipse.tracecompass.doc.user/doc/images/LTTng2PythonLoglevelEventsDialog.png b/doc/org.eclipse.tracecompass.doc.user/doc/images/LTTng2PythonLoglevelEventsDialog.png
new file mode 100644 (file)
index 0000000..2abe5a9
Binary files /dev/null and b/doc/org.eclipse.tracecompass.doc.user/doc/images/LTTng2PythonLoglevelEventsDialog.png differ
index dd611c8d0f4c8e4dd1eaf994188f2f465f1bdabc..ce7e1ba86443fd1cbb162bb3e719b164d9248416 100644 (file)
@@ -20,6 +20,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.core.model.IBaseLoggerIn
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceDomainType;
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceJulLogLevel;
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceLog4jLogLevel;
+import org.eclipse.tracecompass.internal.lttng2.control.core.model.TracePythonLogLevel;
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.impl.BaseLoggerInfo;
 import org.junit.Before;
 import org.junit.Test;
@@ -152,6 +153,25 @@ public class BaseLoggerInfoTest {
         assertEquals("LOG4J_FATAL", resultLog4j.name());
         assertEquals("LOG4J_FATAL", resultLog4j.toString());
         assertEquals(1, resultLog4j.ordinal());
+
+        // Case 5 : PYTHON_NOTSET
+        fixture.setDomain(TraceDomainType.PYTHON);
+        fixture.setLogLevel(TracePythonLogLevel.PYTHON_NOTSET);
+        TracePythonLogLevel resultPython = (TracePythonLogLevel) fixture.getLogLevel();
+        assertNotNull(resultPython);
+        assertEquals("Notset", resultPython.getInName());
+        assertEquals("PYTHON_NOTSET", resultPython.name());
+        assertEquals("PYTHON_NOTSET", resultPython.toString());
+        assertEquals(5, resultPython.ordinal());
+
+        // Case 6 : LOG4J_FATAL
+        fixture.setLogLevel(TracePythonLogLevel.PYTHON_DEBUG);
+        resultPython = (TracePythonLogLevel) fixture.getLogLevel();
+        assertNotNull(resultPython);
+        assertEquals("Debug", resultPython.getInName());
+        assertEquals("PYTHON_DEBUG", resultPython.name());
+        assertEquals("PYTHON_DEBUG", resultPython.toString());
+        assertEquals(4, resultPython.ordinal());
     }
 
     /**
@@ -335,6 +355,71 @@ public class BaseLoggerInfoTest {
         assertEquals("LEVEL_UNKNOWN", resultLog4j.getInName());
         assertEquals("LEVEL_UNKNOWN", resultLog4j.name());
         assertEquals(8, resultLog4j.ordinal());
+
+        // Case 3: Python log level
+        fixture.setDomain(TraceDomainType.PYTHON);
+
+        fixture.setLogLevel("Critical");
+
+        TracePythonLogLevel resultPython = (TracePythonLogLevel) fixture.getLogLevel();
+        assertNotNull(resultPython);
+        assertEquals("Critical", resultPython.getInName());
+        assertEquals("PYTHON_CRITICAL", resultPython.name());
+        assertEquals(0, resultPython.ordinal());
+
+        //------------------------
+        fixture.setLogLevel("Error");
+
+        resultPython = (TracePythonLogLevel) fixture.getLogLevel();
+        assertNotNull(resultPython);
+        assertEquals("Error", resultPython.getInName());
+        assertEquals("PYTHON_ERROR", resultPython.name());
+        assertEquals(1, resultPython.ordinal());
+
+        //------------------------
+        fixture.setLogLevel("Warning");
+
+        resultPython = (TracePythonLogLevel) fixture.getLogLevel();
+        assertNotNull(resultPython);
+        assertEquals("Warning", resultPython.getInName());
+        assertEquals("PYTHON_WARNING", resultPython.name());
+        assertEquals(2, resultPython.ordinal());
+
+        //------------------------
+        fixture.setLogLevel("Info");
+
+        resultPython = (TracePythonLogLevel) fixture.getLogLevel();
+        assertNotNull(resultPython);
+        assertEquals("Info", resultPython.getInName());
+        assertEquals("PYTHON_INFO", resultPython.name());
+        assertEquals(3, resultPython.ordinal());
+
+        //------------------------
+        fixture.setLogLevel("Debug");
+
+        resultPython = (TracePythonLogLevel) fixture.getLogLevel();
+        assertNotNull(resultPython);
+        assertEquals("Debug", resultPython.getInName());
+        assertEquals("PYTHON_DEBUG", resultPython.name());
+        assertEquals(4, resultPython.ordinal());
+
+        //------------------------
+        fixture.setLogLevel("Notset");
+
+        resultPython = (TracePythonLogLevel) fixture.getLogLevel();
+        assertNotNull(resultPython);
+        assertEquals("Notset", resultPython.getInName());
+        assertEquals("PYTHON_NOTSET", resultPython.name());
+        assertEquals(5, resultPython.ordinal());
+
+        //------------------------
+        fixture.setLogLevel("LEVEL_UNKNOWN");
+
+        resultPython = (TracePythonLogLevel) fixture.getLogLevel();
+        assertNotNull(resultPython);
+        assertEquals("LEVEL_UNKNOWN", resultPython.getInName());
+        assertEquals("LEVEL_UNKNOWN", resultPython.name());
+        assertEquals(6, resultPython.ordinal());
     }
 
     /**
@@ -354,6 +439,11 @@ public class BaseLoggerInfoTest {
         fixture.setLogLevel(TraceLog4jLogLevel.LOG4J_ERROR);
         result = fixture.toString();
         assertEquals("[BaseLoggerInfo([TraceInfo(Name=testName)],domain=LOG4J,level=LOG4J_ERROR)]", result);
+
+        fixture.setDomain(TraceDomainType.PYTHON);
+        fixture.setLogLevel(TracePythonLogLevel.PYTHON_CRITICAL);
+        result = fixture.toString();
+        assertEquals("[BaseLoggerInfo([TraceInfo(Name=testName)],domain=PYTHON,level=PYTHON_CRITICAL)]", result);
     }
 
     // ------------------------------------------------------------------------
index 200ab038de61167f05689a882ba4073127dd51a9..83a2d7ca2b0eb496a26fac3eb2d770caac1ccc82 100644 (file)
@@ -83,7 +83,7 @@ public enum TracePythonLogLevel implements ITraceLogLevel{
             throw new IllegalArgumentException();
         }
         for (TracePythonLogLevel tllevel : TracePythonLogLevel.values()) {
-            if (tllevel.name().equals(name)) {
+            if (tllevel.name().equals(name) || tllevel.getInName().equals(name)) {
                 return tllevel;
             }
         }
index 4157ac7afbb2cfe8c1a48b74087e96359feb290a..dee204b8485ee82c5ebddff1817f6c1e80fb22b1 100644 (file)
@@ -16,6 +16,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.core.model.ITraceLogLeve
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceDomainType;
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceJulLogLevel;
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceLog4jLogLevel;
+import org.eclipse.tracecompass.internal.lttng2.control.core.model.TracePythonLogLevel;
 
 /**
  * Implementation of the basic trace logger interface (IBaseLoggerInfo) to store
@@ -86,7 +87,7 @@ public class BaseLoggerInfo extends TraceInfo implements IBaseLoggerInfo {
             fLogLevel = TraceLog4jLogLevel.valueOfString(levelName);
             break;
         case PYTHON:
-            // TODO: Add the Python log level
+            fLogLevel = TracePythonLogLevel.valueOfString(levelName);
             break;
             //$CASES-OMITTED$
         default:
index 422cd7401403c44a67e67417da447eb9479ef613..868f32c8728355665f44d3287fcaeefe6625fa93 100644 (file)
@@ -36,6 +36,7 @@ public class ControlViewLoggerTest extends ControlViewTest {
     private static final String TEST_STREAM = "CreateSessionTestLTTng2_8.cfg";
     private static final String CREATE_SESSION_JUL_SCENARIO_NAME = "JulLogger";
     private static final String CREATE_SESSION_LOG4J_SCENARIO_NAME = "Log4jLogger";
+    private static final String CREATE_SESSION_PYTHON_SCENARIO_NAME = "PythonLogger";
 
     private static final String SESSION_NAME = "mysession";
     private static final String PROPERTIES_VIEW = "Properties";
@@ -79,6 +80,15 @@ public class ControlViewLoggerTest extends ControlViewTest {
         // Verify that the Properties view shows to right logger log level
         testLoggerProperties(TraceDomainType.LOG4J);
 
+        // Enable Python loggers
+        fProxy.setScenario(CREATE_SESSION_PYTHON_SCENARIO_NAME);
+        testEnableLoggers(TraceDomainType.PYTHON);
+        testStartStopTracing(TraceSessionState.ACTIVE);
+        testStartStopTracing(TraceSessionState.INACTIVE);
+        // Verify that the Properties view shows to right logger log level
+        testLoggerProperties(TraceDomainType.PYTHON);
+
+
         // Clean session
         testDestroySession();
         testDisconnectFromNode();
@@ -102,6 +112,10 @@ public class ControlViewLoggerTest extends ControlViewTest {
             domainName = ControlViewSwtBotUtil.LOG4J_DOMAIN_NAME;
             logLevel = "Fatal";
             break;
+        case PYTHON:
+            domainName = ControlViewSwtBotUtil.PYTHON_DOMAIN_NAME;
+            logLevel = "Critical";
+            break;
             //$CASES-OMITTED$
         default:
             break;
@@ -160,11 +174,11 @@ public class ControlViewLoggerTest extends ControlViewTest {
         // Expand the "All" and "All - application name" node
         SWTBotTreeItem allItem = loggersTree.getTreeItem(ControlViewSwtBotUtil.ALL_TREE_NODE);
         allItem.expand();
-        allItem = SWTBotUtils.getTreeItem(fBot, loggersTree, ControlViewSwtBotUtil.ALL_TREE_NODE, ControlViewSwtBotUtil.JAVA_APPLICATION_NAME);
+        allItem = SWTBotUtils.getTreeItem(fBot, loggersTree, ControlViewSwtBotUtil.ALL_TREE_NODE, ControlViewSwtBotUtil.LOGGER_APPLICATION_NAME);
         allItem.expand();
         treeItem = SWTBotUtils.getTreeItem(fBot, loggersTree,
                 ControlViewSwtBotUtil.ALL_TREE_NODE,
-                ControlViewSwtBotUtil.JAVA_APPLICATION_NAME,
+                ControlViewSwtBotUtil.LOGGER_APPLICATION_NAME,
                 ControlViewSwtBotUtil.LOGGER_NAME);
         treeItem.check();
 
@@ -239,15 +253,23 @@ public class ControlViewLoggerTest extends ControlViewTest {
      */
     protected void testLoggerProperties(TraceDomainType domain) {
         String domainName = new String();
-        String logLevel = new String();
+        String logLevel1 = new String();
+        String logLevel2 = new String();
         switch (domain) {
         case JUL:
             domainName = ControlViewSwtBotUtil.JUL_DOMAIN_NAME;
-            logLevel = "<= Warning";
+            logLevel1 = "All";
+            logLevel2 = "<= Warning";
             break;
         case LOG4J:
             domainName = ControlViewSwtBotUtil.LOG4J_DOMAIN_NAME;
-            logLevel = "<= Fatal";
+            logLevel1 = "All";
+            logLevel2 = "<= Fatal";
+            break;
+        case PYTHON:
+            domainName = ControlViewSwtBotUtil.PYTHON_DOMAIN_NAME;
+            logLevel1 = "Debug";
+            logLevel2 = "<= Critical";
             break;
             //$CASES-OMITTED$
         default:
@@ -279,7 +301,7 @@ public class ControlViewLoggerTest extends ControlViewTest {
 
         // Assert that the expression in the Properties view is the same as
         // the one we entered
-        assertEquals("All", loglevelExpression);
+        assertEquals(logLevel1, loglevelExpression);
 
         // Case 2: Select the "anotherLogger" logger in the Control view
         fBot.viewById(ControlView.ID).show();
@@ -303,7 +325,7 @@ public class ControlViewLoggerTest extends ControlViewTest {
 
         // Assert that the expression in the Properties view is the same as
         // the one we entered
-        assertEquals(logLevel, loglevelExpression);
+        assertEquals(logLevel2, loglevelExpression);
 
         // Close the Properties view
         SWTBotUtils.closeView(PROPERTIES_VIEW, fBot);
index 95fbff36c2fc254e1013a738766c316178266f23..317d063cee1f32f18cc928d9c138942743f6f3d1 100644 (file)
@@ -32,6 +32,7 @@ class ControlViewSwtBotUtil {
     public static final String UST_DOMAIN_NAME = "UST global";
     public static final String JUL_DOMAIN_NAME = "JUL";
     public static final String LOG4J_DOMAIN_NAME = "LOG4J";
+    public static final String PYTHON_DOMAIN_NAME = "Python";
     public static final String SESSION_GROUP_NAME = "Sessions";
     public static final String PROVIDER_GROUP_NAME = "Provider";
     public static final String ALL_EVENTS_NAME = "*";
@@ -78,7 +79,7 @@ class ControlViewSwtBotUtil {
     public static final String ENABLE_CHANNEL_DIALOG_TITLE = "Enable Channel";
     public static final String DOMAIN_GROUP_NAME = "Domain";
     public static final String UST_GROUP_NAME = "UST";
-    public static final String JAVA_APPLICATION_NAME = "All - ./client_bin/challenger [PID=14237] (With logger)";
+    public static final String LOGGER_APPLICATION_NAME = "All - ./client_bin/challenger [PID=14237] (With logger)";
     public static final String BUFFERTYPE_GROUP_NAME = "Buffer Type";
     public static final String BUFFERTYPE_PER_UID = "Per UID buffers";
     public static final String FILTER_EXPRESSION_LABEL = "Filter Expression";
index bfc4a07fac8a418e7694837992fe9a6726b17647..b3f8d46d04bf9f212bd1b74c858cacd90337ca9f 100644 (file)
@@ -69,7 +69,7 @@ lttng --mi xml list -p
 </COMMAND_RESULT>
 <COMMAND_OUTPUT>
 <?xml version="1.0" encoding="UTF-8"?>
-<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0"><name>list</name><output><domains><domain><type>PYTHON</type><buffer_type>PER_PID</buffer_type><pids><pid><id>18008</id><name>python3</name><events><event><name>my-logger</name><type>TRACEPOINT</type><enabled>true</enabled><loglevel>PYTHON_NOTSET</loglevel><loglevel_type>ALL</loglevel_type><exclusions/></event></events></pid></pids></domain></domains></output></command>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0"><name>list</name><output><domains><domain><type>PYTHON</type><buffer_type>PER_PID</buffer_type><pids><pid><id>14237</id><name>python3</name><events><event><name>anotherLogger</name><type>TRACEPOINT</type><enabled>true</enabled><loglevel>PYTHON_NOTSET</loglevel><loglevel_type>ALL</loglevel_type><exclusions/></event><event><name>logger</name><type>TRACEPOINT</type><enabled>true</enabled><loglevel>PYTHON_NOTSET</loglevel><loglevel_type>ALL</loglevel_type><exclusions/></event></events></pid></pids></domain></domains></output></command>
 </COMMAND_OUTPUT>
 <COMMAND_INPUT>
 lttng --mi xml list
@@ -917,3 +917,100 @@ lttng --mi xml destroy mysession
 <command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0"><name>destroy</name><output><sessions><session><name>mysession</name><path>${workspace}/lttng-traces/mysession-20160105-151744</path><enabled>false</enabled><snapshot_mode>0</snapshot_mode><live_timer_interval>0</live_timer_interval></session></sessions></output><success>true</success></command>
 </COMMAND_OUTPUT>
 </SCENARIO>
+
+###############################################################################
+# Enable Python loggers
+###############################################################################
+<SCENARIO>
+PythonLogger
+<COMMAND_INPUT>
+lttng --mi xml enable-event -a -p -s mysession --tracepoint
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0"><name>enable-event</name><output><events><event><name>*</name><type>TRACEPOINT</type><enabled>true</enabled><loglevel>PYTHON_DEBUG</loglevel><loglevel_type>ALL</loglevel_type><exclusions/><success>true</success></event></events></output><success>true</success></command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0"><name>list</name><output><sessions><session><name>mysession</name><path>/home/ebruroy/lttng-traces/mysession-20160811-104540</path><enabled>false</enabled><snapshot_mode>0</snapshot_mode><live_timer_interval>0</live_timer_interval><domains><domain><type>UST</type><buffer_type>PER_UID</buffer_type><trackers/><channels><channel><name>lttng_python_channel</name><enabled>true</enabled><attributes><overwrite_mode>DISCARD</overwrite_mode><subbuffer_size>131072</subbuffer_size><subbuffer_count>4</subbuffer_count><switch_timer_interval>0</switch_timer_interval><read_timer_interval>0</read_timer_interval><output_type>MMAP</output_type><tracefile_size>0</tracefile_size><tracefile_count>0</tracefile_count><live_timer_interval>0</live_timer_interval><discarded_events>0</discarded_events><lost_packets>0</lost_packets></attributes><events/></channel></channels></domain><domain><type>PYTHON</type><buffer_type>PER_UID</buffer_type><events><event><name>*</name><type>TRACEPOINT</type><enabled>true</enabled><loglevel>PYTHON_DEBUG</loglevel><loglevel_type>ALL</loglevel_type><exclusions/></event></events></domain></domains></session></sessions></output></command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml enable-event logger -p -s mysession --tracepoint
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0"><name>enable-event</name><output><events><event><name>logger</name><type>TRACEPOINT</type><enabled>true</enabled><loglevel>PYTHON_DEBUG</loglevel><loglevel_type>ALL</loglevel_type><exclusions/><success>true</success></event></events></output><success>true</success></command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0"><name>list</name><output><sessions><session><name>mysession</name><path>/home/ebruroy/lttng-traces/mysession-20160811-104716</path><enabled>false</enabled><snapshot_mode>0</snapshot_mode><live_timer_interval>0</live_timer_interval><domains><domain><type>UST</type><buffer_type>PER_UID</buffer_type><trackers/><channels><channel><name>lttng_python_channel</name><enabled>true</enabled><attributes><overwrite_mode>DISCARD</overwrite_mode><subbuffer_size>131072</subbuffer_size><subbuffer_count>4</subbuffer_count><switch_timer_interval>0</switch_timer_interval><read_timer_interval>0</read_timer_interval><output_type>MMAP</output_type><tracefile_size>0</tracefile_size><tracefile_count>0</tracefile_count><live_timer_interval>0</live_timer_interval><discarded_events>0</discarded_events><lost_packets>0</lost_packets></attributes><events/></channel></channels></domain><domain><type>PYTHON</type><buffer_type>PER_UID</buffer_type><events><event><name>logger</name><type>TRACEPOINT</type><enabled>true</enabled><filter_expression>logger_name == &quot;logger&quot;</filter_expression><loglevel>PYTHON_DEBUG</loglevel><loglevel_type>ALL</loglevel_type><exclusions/></event><event><name>*</name><type>TRACEPOINT</type><enabled>true</enabled><loglevel>PYTHON_DEBUG</loglevel><loglevel_type>ALL</loglevel_type><exclusions/></event></events></domain></domains></session></sessions></output></command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml enable-event anotherLogger -p -s mysession --loglevel Critical
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0"><name>enable-event</name><output><events><event><name>anotherLogger</name><type>TRACEPOINT</type><enabled>true</enabled><loglevel>PYTHON_CRITICAL</loglevel><loglevel_type>RANGE</loglevel_type><exclusions/><success>true</success></event></events></output><success>true</success></command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0"><name>list</name><output><sessions><session><name>mysession</name><path>/home/ebruroy/lttng-traces/mysession-20160811-104716</path><enabled>false</enabled><snapshot_mode>0</snapshot_mode><live_timer_interval>0</live_timer_interval><domains><domain><type>UST</type><buffer_type>PER_UID</buffer_type><trackers/><channels><channel><name>lttng_python_channel</name><enabled>true</enabled><attributes><overwrite_mode>DISCARD</overwrite_mode><subbuffer_size>131072</subbuffer_size><subbuffer_count>4</subbuffer_count><switch_timer_interval>0</switch_timer_interval><read_timer_interval>0</read_timer_interval><output_type>MMAP</output_type><tracefile_size>0</tracefile_size><tracefile_count>0</tracefile_count><live_timer_interval>0</live_timer_interval><discarded_events>0</discarded_events><lost_packets>0</lost_packets></attributes><events/></channel></channels></domain><domain><type>PYTHON</type><buffer_type>PER_UID</buffer_type><events><event><name>logger</name><type>TRACEPOINT</type><enabled>true</enabled><filter_expression>logger_name == &quot;logger&quot;</filter_expression><loglevel>PYTHON_DEBUG</loglevel><loglevel_type>ALL</loglevel_type><exclusions/></event><event><name>anotherLogger</name><type>TRACEPOINT</type><enabled>true</enabled><filter_expression>(logger_name == &quot;anotherLogger&quot;) &amp;&amp; (int_loglevel &gt;= 50)</filter_expression><loglevel>PYTHON_CRITICAL</loglevel><loglevel_type>RANGE</loglevel_type><exclusions/></event><event><name>*</name><type>TRACEPOINT</type><enabled>true</enabled><loglevel>PYTHON_DEBUG</loglevel><loglevel_type>ALL</loglevel_type><exclusions/></event></events></domain></domains></session></sessions></output></command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml start mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0"><name>start</name><output><sessions><session><name>mysession</name><enabled>true</enabled></session></sessions></output><success>true</success></command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml stop mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0"><name>stop</name><output><sessions><session><name>mysession</name><enabled>false</enabled></session></sessions></output><success>true</success></command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml destroy mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0"><name>destroy</name><output><sessions><session><name>mysession</name><path>${workspace}/lttng-traces/mysession-20160105-151744</path><enabled>false</enabled><snapshot_mode>0</snapshot_mode><live_timer_interval>0</live_timer_interval></session></sessions></output><success>true</success></command>
+</COMMAND_OUTPUT>
+</SCENARIO>
\ No newline at end of file
index ec42eadce45dd1bfa8801a12d40f295f8b4cd683..49cffe5f2c2054418eca101333398ccf60a54187 100644 (file)
@@ -36,6 +36,7 @@ import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceEventTyp
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceJulLogLevel;
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceLog4jLogLevel;
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceLogLevel;
+import org.eclipse.tracecompass.internal.lttng2.control.core.model.TracePythonLogLevel;
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.TraceSessionState;
 import org.eclipse.tracecompass.internal.lttng2.control.core.model.impl.SessionInfo;
 import org.eclipse.tracecompass.internal.lttng2.control.ui.views.service.ILttngControlService;
@@ -56,6 +57,7 @@ public class LTTngControlServiceMiTest extends LTTngControlServiceTest {
     private static final String SCEN_LIST_SESSION_2_7_COMPAT = "ListSession2.7Compat";
     private static final String SCEN_ENABLING_JUL_LOGGERS = "EnableJulLoggers";
     private static final String SCEN_ENABLING_LOG4J_LOGGERS = "EnableLog4jLoggers";
+    private static final String SCEN_ENABLING_PYTHON_LOGGERS = "EnablePythonLoggers";
 
     @Override
     protected ILttngControlService getControlService() {
@@ -410,4 +412,53 @@ public class LTTngControlServiceMiTest extends LTTngControlServiceTest {
             fail(e.toString());
         }
     }
+
+    @Override
+    public void testEnablePythonLoggers() {
+        try {
+            String sessionName = "mysession";
+            // Lists
+            List<String> loggerList = new ArrayList<>();
+            // Loggers
+            String loggerName1 = "logger";
+            String loggerName2 = "anotherLogger";
+            String allLoggerName = "*";
+
+            fShell.setScenario(SCEN_ENABLING_PYTHON_LOGGERS);
+
+            // 1) Enabling all loggers
+            loggerList.add(allLoggerName);
+            fService.enableEvents(sessionName, null, loggerList, TraceDomainType.PYTHON, null, null, new NullProgressMonitor());
+            loggerList.clear();
+
+            // 2) Enabling one logger
+            loggerList.add(loggerName1);
+            fService.enableEvents(sessionName, null, loggerList, TraceDomainType.PYTHON, null, null, new NullProgressMonitor());
+
+            // 3) Enabling two loggers with loglevel-only PYTHON_CRITICAL and
+            //    verifying the attributes of one of them
+            loggerList.add(loggerName2);
+            fService.enableLogLevel(sessionName, null, loggerList, LogLevelType.LOGLEVEL_ONLY, TracePythonLogLevel.PYTHON_CRITICAL, null, TraceDomainType.PYTHON, new NullProgressMonitor());
+
+            @Nullable
+            ISessionInfo session = fService.getSession(sessionName, new NullProgressMonitor());
+            assertNotNull(session);
+            // Get the list of loggers
+            List<ILoggerInfo> loggers = session.getDomains()[1].getLoggers();
+            assertNotNull(loggers);
+            assertEquals(4, loggers.size());
+            // Get the "anotherLogger" logger
+            ILoggerInfo loggerInfo = loggers.stream()
+                    .filter(logger -> logger.getName().equals(loggerName2))
+                    .findFirst().get();
+            // Verify attributes
+            assertEquals(loggerName2, loggerInfo.getName());
+            assertEquals(TraceDomainType.PYTHON, loggerInfo.getDomain());
+            assertEquals(TracePythonLogLevel.PYTHON_CRITICAL, loggerInfo.getLogLevel());
+            assertEquals(LogLevelType.LOGLEVEL_ONLY, loggerInfo.getLogLevelType());
+            assertEquals(TraceEnablement.ENABLED, loggerInfo.getState());
+        } catch (ExecutionException e) {
+            fail(e.toString());
+        }
+    }
 }
index cf76665e271519695b8e60889e76fde3e0037cc9..5d0b70be33042ba1ed68d30a4c1de0a3aaf097d5 100644 (file)
@@ -1157,13 +1157,19 @@ public class LTTngControlServiceTest {
     @Test
     public void testEnableJulLoggers() {
         // Trace Compass only supports JUL starting with LTTng 2.6 that supports MI.
-        // The implementation of this test is the LTTngControlServiceMiTest.java.
+        // The implementation of this test is in the LTTngControlServiceMiTest.java file.
     }
 
     @Test
     public void testEnableLog4jLoggers() {
         // Trace Compass only supports LOG4J starting with LTTng 2.6 that supports MI.
-        // The implementation of this test is the LTTngControlServiceMiTest.java.
+        // The implementation of this test is in the LTTngControlServiceMiTest.java file.
+    }
+
+    @Test
+    public void testEnablePythonLoggers() {
+        // LTTng only support Python logging starting with LTTng 2.7 that supports MI.
+        // The implementation of this test is in the LTTngControlServiceMiTest.java file.
     }
 
     @Test
index b5bf24f9a44f9b5547f65d190332896492815673..3cf340f36d667711f9346a325fd5d46edffcb0be 100644 (file)
@@ -2721,6 +2721,192 @@ lttng --mi xml list mysession
 </COMMAND_OUTPUT>
 </SCENARIO>
 
+####################################################################
+# Scenario: Test "lttng enable-events ..." with Python loggers
+####################################################################
+<SCENARIO>
+EnablePythonLoggers
+
+<COMMAND_INPUT>
+lttng --mi xml enable-event -a -p -s mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0">
+  <name>enable-event</name>
+  <output>
+    <events>
+      <event>
+        <name>*</name>
+        <type>TRACEPOINT</type>
+        <enabled>true</enabled>
+        <loglevel>PYTHON_DEBUG</loglevel>
+        <loglevel_type>ALL</loglevel_type>
+        <exclusions />
+        <success>true</success>
+      </event>
+    </events>
+  </output>
+  <success>true</success>
+</command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml enable-event logger -p -s mysession --tracepoint
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0">
+  <name>enable-event</name>
+  <output>
+    <events>
+      <event>
+        <name>logger</name>
+        <type>TRACEPOINT</type>
+        <enabled>true</enabled>
+        <loglevel>PYTHON_DEBUG</loglevel>
+        <loglevel_type>ALL</loglevel_type>
+        <exclusions />
+        <success>true</success>
+      </event>
+    </events>
+  </output>
+  <success>true</success>
+</command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml enable-event logger,anotherLogger -p -s mysession --loglevel-only Critical
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0">
+  <name>enable-event</name>
+  <output>
+    <events>
+      <event>
+        <name>logger</name>
+        <type>TRACEPOINT</type>
+        <enabled>true</enabled>
+        <loglevel>PYTHON_CRITICAL</loglevel>
+        <loglevel_type>SINGLE</loglevel_type>
+        <exclusions />
+        <success>true</success>
+      </event>
+      <event>
+        <name>anotherLogger</name>
+        <type>TRACEPOINT</type>
+        <enabled>true</enabled>
+        <loglevel>PYTHON_CRITICAL</loglevel>
+        <loglevel_type>SINGLE</loglevel_type>
+        <exclusions />
+        <success>true</success>
+      </event>
+    </events>
+  </output>
+  <success>true</success>
+</command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command xmlns="http://lttng.org/xml/ns/lttng-mi" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://lttng.org/xml/ns/lttng-mi http://lttng.org/xml/schemas/lttng-mi/3/lttng-mi-3.0.xsd" schemaVersion="3.0">
+  <name>list</name>
+  <output>
+    <sessions>
+      <session>
+        <name>mysession</name>
+        <path>${workspace}/lttng-traces/mysession-20160811-112808</path>
+        <enabled>false</enabled>
+        <snapshot_mode>0</snapshot_mode>
+        <live_timer_interval>0</live_timer_interval>
+        <domains>
+          <domain>
+            <type>UST</type>
+            <buffer_type>PER_UID</buffer_type>
+            <trackers />
+            <channels>
+              <channel>
+                <name>lttng_python_channel</name>
+                <enabled>true</enabled>
+                <attributes>
+                  <overwrite_mode>DISCARD</overwrite_mode>
+                  <subbuffer_size>131072</subbuffer_size>
+                  <subbuffer_count>4</subbuffer_count>
+                  <switch_timer_interval>0</switch_timer_interval>
+                  <read_timer_interval>0</read_timer_interval>
+                  <output_type>MMAP</output_type>
+                  <tracefile_size>0</tracefile_size>
+                  <tracefile_count>0</tracefile_count>
+                  <live_timer_interval>0</live_timer_interval>
+                  <discarded_events>0</discarded_events>
+                  <lost_packets>0</lost_packets>
+                </attributes>
+                <events />
+              </channel>
+            </channels>
+          </domain>
+          <domain>
+            <type>PYTHON</type>
+            <buffer_type>PER_UID</buffer_type>
+            <events>
+              <event>
+                <name>logger</name>
+                <type>TRACEPOINT</type>
+                <enabled>true</enabled>
+                <filter_expression>(logger_name == "logger") &amp;&amp; (int_loglevel == 50)</filter_expression>
+                <loglevel>PYTHON_CRITICAL</loglevel>
+                <loglevel_type>SINGLE</loglevel_type>
+                <exclusions />
+              </event>
+              <event>
+                <name>logger</name>
+                <type>TRACEPOINT</type>
+                <enabled>true</enabled>
+                <filter_expression>logger_name == "logger"</filter_expression>
+                <loglevel>PYTHON_DEBUG</loglevel>
+                <loglevel_type>ALL</loglevel_type>
+                <exclusions />
+              </event>
+              <event>
+                <name>anotherLogger</name>
+                <type>TRACEPOINT</type>
+                <enabled>true</enabled>
+                <filter_expression>(logger_name == "anotherLogger") &amp;&amp; (int_loglevel == 50)</filter_expression>
+                <loglevel>PYTHON_CRITICAL</loglevel>
+                <loglevel_type>SINGLE</loglevel_type>
+                <exclusions />
+              </event>
+              <event>
+                <name>*</name>
+                <type>TRACEPOINT</type>
+                <enabled>true</enabled>
+                <loglevel>PYTHON_DEBUG</loglevel>
+                <loglevel_type>ALL</loglevel_type>
+                <exclusions />
+              </event>
+            </events>
+          </domain>
+        </domains>
+      </session>
+    </sessions>
+  </output>
+</command>
+</COMMAND_OUTPUT>
+</SCENARIO>
+
 ####################################################################
 # Scenario: Test "lttng enable-events ..." with exclusion
 ####################################################################
index 528a47f02dccedd9b971220d7e10dbb0bcd6df5d..972a5b5e383c2857dfddbec60edb6a5f940acd80 100644 (file)
@@ -2707,6 +2707,195 @@ lttng --mi xml list mysession
 </COMMAND_OUTPUT>
 </SCENARIO>
 
+####################################################################
+# Scenario: Test "lttng enable-events ..." with Python loggers
+####################################################################
+<SCENARIO>
+EnablePythonLoggers
+
+<COMMAND_INPUT>
+lttng --mi xml enable-event -a -p -s mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command>
+  <name>enable-event</name>
+  <output>
+    <events>
+      <event>
+        <name>*</name>
+        <type>TRACEPOINT</type>
+        <enabled>true</enabled>
+        <filter>false</filter>
+        <loglevel>PYTHON_DEBUG</loglevel>
+        <loglevel_type>ALL</loglevel_type>
+        <exclusion>false</exclusion>
+        <success>true</success>
+      </event>
+    </events>
+  </output>
+  <success>true</success>
+</command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml enable-event logger -p -s mysession --tracepoint
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command>
+  <name>enable-event</name>
+  <output>
+    <events>
+      <event>
+        <name>logger</name>
+        <type>TRACEPOINT</type>
+        <enabled>true</enabled>
+        <filter>false</filter>
+        <loglevel>PYTHON_DEBUG</loglevel>
+        <loglevel_type>ALL</loglevel_type>
+        <exclusion>false</exclusion>
+        <success>true</success>
+      </event>
+    </events>
+  </output>
+  <success>true</success>
+</command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml enable-event logger,anotherLogger -p -s mysession --loglevel-only Critical
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command>
+  <name>enable-event</name>
+  <output>
+    <events>
+      <event>
+        <name>logger</name>
+        <type>TRACEPOINT</type>
+        <enabled>true</enabled>
+        <filter>false</filter>
+        <loglevel>PYTHON_CRITICAL</loglevel>
+        <loglevel_type>SINGLE</loglevel_type>
+        <exclusion>false</exclusion>
+        <success>true</success>
+      </event>
+      <event>
+        <name>anotherLogger</name>
+        <type>TRACEPOINT</type>
+        <enabled>true</enabled>
+        <filter>false</filter>
+        <loglevel>PYTHON_CRITICAL</loglevel>
+        <loglevel_type>SINGLE</loglevel_type>
+        <exclusion>false</exclusion>
+        <success>true</success>
+      </event>
+    </events>
+  </output>
+  <success>true</success>
+</command>
+</COMMAND_OUTPUT>
+<COMMAND_INPUT>
+lttng --mi xml list mysession
+</COMMAND_INPUT>
+<COMMAND_RESULT>
+0
+</COMMAND_RESULT>
+<COMMAND_OUTPUT>
+<?xml version="1.0" encoding="UTF-8"?>
+<command>
+  <name>list</name>
+  <output>
+    <sessions>
+      <session>
+        <name>mysession</name>
+        <path>${workspace}/lttng-traces/mysession-20160811-113341</path>
+        <enabled>false</enabled>
+        <snapshot_mode>0</snapshot_mode>
+        <live_timer_interval>0</live_timer_interval>
+        <domains>
+          <domain>
+            <type>UST</type>
+            <buffer_type>PER_UID</buffer_type>
+            <trackers />
+            <channels>
+              <channel>
+                <name>lttng_python_channel</name>
+                <enabled>true</enabled>
+                <attributes>
+                  <overwrite_mode>DISCARD</overwrite_mode>
+                  <subbuffer_size>131072</subbuffer_size>
+                  <subbuffer_count>4</subbuffer_count>
+                  <switch_timer_interval>0</switch_timer_interval>
+                  <read_timer_interval>0</read_timer_interval>
+                  <output_type>MMAP</output_type>
+                  <tracefile_size>0</tracefile_size>
+                  <tracefile_count>0</tracefile_count>
+                  <live_timer_interval>0</live_timer_interval>
+                </attributes>
+                <events />
+              </channel>
+            </channels>
+          </domain>
+          <domain>
+            <type>PYTHON</type>
+            <buffer_type>PER_UID</buffer_type>
+            <events>
+              <event>
+                <name>anotherLogger</name>
+                <type>TRACEPOINT</type>
+                <enabled>true</enabled>
+                <filter>false</filter>
+                <loglevel>PYTHON_CRITICAL</loglevel>
+                <loglevel_type>SINGLE</loglevel_type>
+                <exclusion>false</exclusion>
+              </event>
+              <event>
+                <name>*</name>
+                <type>TRACEPOINT</type>
+                <enabled>true</enabled>
+                <filter>false</filter>
+                <loglevel>PYTHON_DEBUG</loglevel>
+                <loglevel_type>ALL</loglevel_type>
+                <exclusion>false</exclusion>
+              </event>
+              <event>
+                <name>logger</name>
+                <type>TRACEPOINT</type>
+                <enabled>true</enabled>
+                <filter>false</filter>
+                <loglevel>PYTHON_CRITICAL</loglevel>
+                <loglevel_type>SINGLE</loglevel_type>
+                <exclusion>false</exclusion>
+              </event>
+              <event>
+                <name>logger</name>
+                <type>TRACEPOINT</type>
+                <enabled>true</enabled>
+                <filter>false</filter>
+                <loglevel>PYTHON_DEBUG</loglevel>
+                <loglevel_type>ALL</loglevel_type>
+                <exclusion>false</exclusion>
+              </event>
+            </events>
+          </domain>
+        </domains>
+      </session>
+    </sessions>
+  </output>
+</command>
+</COMMAND_OUTPUT>
+</SCENARIO>
+
 ####################################################################
 # Scenario: Test "lttng enable-events ..." with exclusion
 ####################################################################
This page took 0.048674 seconds and 5 git commands to generate.