#include <common/mi-lttng.hpp>
#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/lttng-kernel.hpp>
#include <common/utils.hpp>
#include <lttng/domain-internal.hpp>
ret = lttng_enable_channel(handle, channel);
if (ret < 0) {
+ bool msg_already_printed = false;
+
success = 0;
switch (-ret) {
case LTTNG_ERR_KERN_CHAN_EXIST:
case LTTNG_ERR_UST_CHAN_EXIST:
case LTTNG_ERR_CHAN_EXIST:
- WARN("Channel %s: %s (session %s)",
- channel_name,
- lttng_strerror(ret),
- session_name);
warn = 1;
break;
case LTTNG_ERR_INVALID_CHANNEL_NAME:
"Channel names may not start with '.', and "
"may not contain '/'.",
channel_name);
+ msg_already_printed = true;
error = 1;
break;
default:
- ERR("Channel %s: %s (session %s)",
- channel_name,
- lttng_strerror(ret),
- session_name);
error = 1;
break;
}
+
+ if (!msg_already_printed) {
+ LOG(error ? PRINT_ERR : PRINT_WARN,
+ "Failed to enable channel `%s` under session `%s`: %s",
+ channel_name,
+ session_name,
+ lttng_strerror(ret));
+ }
+
+ if (opt_kernel) {
+ print_kernel_tracer_status_error();
+ }
} else {
- MSG("%s channel %s enabled for session %s",
+ MSG("%s channel `%s` enabled for session `%s`",
lttng_domain_type_str(dom.type),
channel_name,
session_name);