import java.lang.Integer;
import java.util.logging.Logger;
+import java.util.logging.Level;
import org.lttng.ust.jul.LTTngAgent;
int waitTime = Integer.parseInt(args[1]);
lttngAgent = LTTngAgent.getLTTngAgent();
+ lttng.setLevel(Level.FINEST);
for (int iter = 0; iter < nrIter; iter++) {
lttng.info("JUL tp fired!");
+ if (args.length == 3) {
+ /* Third arg, trigger finest TP. */
+ lttng.finest("JUL FINEST tp fired");
+ }
Thread.sleep(waitTime);
}
TRACE_PATH=$(mktemp -d)
-NUM_TESTS=37
+NUM_TESTS=53
source $TESTDIR/utils/utils.sh
function run_app
{
- java -cp $JAVA_CP -Djava.library.path="/usr/local/lib:/usr/lib" $TESTAPP_NAME $NR_ITER $NR_MSEC_WAIT >/dev/null 2>&1 &
+ local finest_tp=$1
+
+ java -cp $JAVA_CP -Djava.library.path="/usr/local/lib:/usr/lib" $TESTAPP_NAME $NR_ITER $NR_MSEC_WAIT $finest_tp >/dev/null 2>&1 &
}
function wait_apps
return $?
}
+function test_jul_loglevel_multiple ()
+{
+ diag "Test JUL application with multiple loglevel"
+
+ create_lttng_session $SESSION_NAME $TRACE_PATH
+ enable_jul_lttng_event_loglevel $SESSION_NAME $EVENT_NAME "JUL_INFO"
+ enable_jul_lttng_event_loglevel $SESSION_NAME $EVENT_NAME "JUL_FINEST"
+ start_lttng_tracing $SESSION_NAME
+
+ # Run 5 times with a 1 second delay and fire two TP.
+ run_app 1
+ wait_apps
+
+ stop_lttng_tracing $SESSION_NAME
+ destroy_lttng_session $SESSION_NAME
+
+ # Validate test. Expecting all events times two.
+ trace_matches $EVENT_NAME $(($NR_ITER * 2)) $TRACE_PATH
+ if [ $? -ne 0 ]; then
+ return $?
+ fi
+
+ create_lttng_session $SESSION_NAME $TRACE_PATH
+ enable_jul_lttng_event_loglevel $SESSION_NAME '*' "JUL_INFO"
+ enable_jul_lttng_event_loglevel $SESSION_NAME '*' "JUL_FINEST"
+ start_lttng_tracing $SESSION_NAME
+
+ # Run 5 times with a 1 second delay and fire two TP.
+ run_app 1
+ wait_apps
+
+ stop_lttng_tracing $SESSION_NAME
+ destroy_lttng_session $SESSION_NAME
+
+ # Validate test. Expecting all events times two.
+ trace_matches $EVENT_NAME $(($NR_ITER * 2)) $TRACE_PATH
+ if [ $? -ne 0 ]; then
+ return $?
+ fi
+}
+
plan_tests $NUM_TESTS
print_test_banner "$TEST_DESC"
tests=(
test_jul_loglevel
+ test_jul_loglevel_multiple
test_jul_before_start
test_jul_after_start
)