Add 'log4j2' domain tests to the Log4j 2.x agent
[lttng-ust-java-tests.git] / lttng-tools-java / src / main / java / org / lttng / tools / ILttngSession.java
index e7d65a0f29a8224cba6aa20ecf9737bb4c4525fa..faecc0c96bda1fcd2305fac35d0ee078388f8533 100644 (file)
@@ -32,13 +32,18 @@ public interface ILttngSession extends AutoCloseable {
      */
     enum Domain {
         /** The JUL (java.util.logging) domain */
-        JUL("-j"), /** The log4j (org.apache.log4j) domain */
-        LOG4J("-l");
+        JUL("--jul", ">=", Integer.MIN_VALUE), /** The log4j (org.apache.log4j) domain */
+        LOG4J("--log4j", ">=", Integer.MIN_VALUE),
+        LOG4J2("--log4j2", "<=", Integer.MAX_VALUE);
 
         private final String flag;
+        private final String rangeOperator;
+        private final int levelAllValue;
 
-        private Domain(String flag) {
+        private Domain(String flag, String rangeOperator, int levelAllValue) {
             this.flag = flag;
+            this.rangeOperator = rangeOperator;
+            this.levelAllValue = levelAllValue;
         }
 
         /**
@@ -48,6 +53,14 @@ public interface ILttngSession extends AutoCloseable {
         public String flag() {
             return flag;
         }
+
+        public String rangeOperator() {
+            return rangeOperator;
+        }
+
+        public int levelAllValue() {
+            return levelAllValue;
+        }
     }
 
     // ------------------------------------------------------------------------
@@ -98,14 +111,25 @@ public interface ILttngSession extends AutoCloseable {
     // ------------------------------------------------------------------------
 
     /**
-     * Enable all events in the session (as with "enable-event -a").
+     * Enable an individual event, specifying a loglevel and filter string.
      *
-     * @return If the command executed successfully (return code = 0).
+     * @param eventName
+     *            The name of the event to enable
+     * @param loglevel
+     *            The loglevel, will be passed as-is to lttng. May be null to
+     *            not specify it.
+     * @param loglevelOnly
+     *            True to use this log level only (--loglevel-only), or false to
+     *            include all more severe levels (--loglevel). Ignored if
+     *            "loglevel" is null.
+     * @param filter
+     *            The filter string, may be null to not specify one.
+     * @return If the command executed successfully (return code = 0)
      */
-    boolean enableAllEvents();
+    boolean enableEvent(String eventName, String loglevel, boolean loglevelOnly, String filter);
 
     /**
-     * Enable individual event(s).
+     * Enable individual event(s) with no loglevel/filter specified.
      *
      * @param enabledEvents
      *            The list of events to enable. Should not be null or empty
@@ -114,7 +138,14 @@ public interface ILttngSession extends AutoCloseable {
     boolean enableEvents(String... enabledEvents);
 
     /**
-     * Send a disable-event command. Used to disable events that were previously
+     * Enable all events in the session (as with "enable-event -a").
+     *
+     * @return If the command executed successfully (return code = 0).
+     */
+    boolean enableAllEvents();
+
+    /**
+     * Send a disable-event command. Used to disable event(s) that were previously
      * enabled.
      *
      * @param disabledEvents
@@ -123,6 +154,36 @@ public interface ILttngSession extends AutoCloseable {
      */
     boolean disableEvents(String... disabledEvents);
 
+    /**
+     * Disable all events currently enabled in the session
+     * ("lttng disable-event -a").
+     *
+     * @return If the command executed successfully (return code = 0)
+     */
+    boolean disableAllEvents();
+
+    /**
+     * Get a list of events currently available (exposed by applications) in the
+     * session's domain.
+     *
+     * @return The list of available events
+     */
+    List<String> listEvents();
+
+    /**
+     * Enable an application context with the provided retriever/context names.
+     *
+     * There is currently no direct command to remove an existing context, the
+     * session has to be destroyed and re-created to do so.
+     *
+     * @param retrieverName
+     *            The name of the retriever (or "namespace" of the context)
+     * @param contextName
+     *            The name of the context
+     * @return If the command executed successfully (return code = 0)
+     */
+    boolean enableAppContext(String retrieverName, String contextName);
+
     /**
      * Start tracing
      *
This page took 0.024972 seconds and 4 git commands to generate.