X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fconfig%2Fsession-config.c;h=4d12870e8d9bdd469cca73cf5cea127ec9f317f6;hp=8b91f32d5aebf47f6a05af102bb3358c069155b7;hb=194dfca0b76448fb6fa1daa28462031a68c138d8;hpb=90936dcf0968343f20b2f6fd365b9c015cdb9717 diff --git a/src/common/config/session-config.c b/src/common/config/session-config.c index 8b91f32d5..4d12870e8 100644 --- a/src/common/config/session-config.c +++ b/src/common/config/session-config.c @@ -1345,10 +1345,6 @@ end: static int create_session(const char *name, - struct lttng_domain *kernel_domain, - struct lttng_domain *ust_domain, - struct lttng_domain *jul_domain, - struct lttng_domain *log4j_domain, xmlNodePtr output_node, uint64_t live_timer_interval, const struct config_load_session_override_attr *overrides) @@ -2437,10 +2433,31 @@ int process_domain_node(xmlNodePtr domain_node, const char *session_name) /* create all channels */ for (node = xmlFirstElementChild(channels_node); node; node = xmlNextElementSibling(node)) { + const enum lttng_domain_type original_domain = domain.type; xmlNodePtr contexts_node = NULL; xmlNodePtr events_node = NULL; xmlNodePtr channel_attr_node; + /* + * Channels of the "agent" types cannot be created directly. + * They are meant to be created implicitly through the + * activation of events in their domain. However, a user + * can override the default channel configuration attributes + * by creating the underlying UST channel _before_ enabling + * an agent domain event. + * + * Hence, the channel's type is substituted before the creation + * and restored by the time the events are created. + */ + switch (domain.type) { + case LTTNG_DOMAIN_JUL: + case LTTNG_DOMAIN_LOG4J: + case LTTNG_DOMAIN_PYTHON: + domain.type = LTTNG_DOMAIN_UST; + default: + break; + } + channel = lttng_channel_create(&domain); if (!channel) { ret = -1; @@ -2462,6 +2479,9 @@ int process_domain_node(xmlNodePtr domain_node, const char *session_name) goto end; } + /* Restore the original channel domain. */ + domain.type = original_domain; + ret = process_events_node(events_node, handle, channel->name); if (ret) { goto end; @@ -2761,13 +2781,11 @@ domain_init_error: overrides); } else if (live_timer_interval && live_timer_interval != UINT64_MAX) { - ret = create_session((const char *) name, kernel_domain, - ust_domain, jul_domain, log4j_domain, + ret = create_session((const char *) name, output_node, live_timer_interval, overrides); } else { /* regular session */ - ret = create_session((const char *) name, kernel_domain, - ust_domain, jul_domain, log4j_domain, + ret = create_session((const char *) name, output_node, UINT64_MAX, overrides); } if (ret) {