plugins: log failure to load plugin as a warning
authorSimon Marchi <simon.marchi@efficios.com>
Mon, 15 Jul 2019 02:45:56 +0000 (22:45 -0400)
committerPhilippe Proulx <eeppeliteloop@gmail.com>
Thu, 18 Jul 2019 05:27:26 +0000 (01:27 -0400)
In my experience writing a Python plugin, it is really helpful to see
when it fails to load, with a traceback of the failure.  We currently
output this failure at the "info" level, which is not shown by default.
Even if I set the log level to info, that failure is lost in a sea of
messages.

So, even if fail_on_load_error is false, a plugin that fails to load
is a bit suspicious and is warn-worthy, in my opinion.

Change-Id: I82844aaa62d33dc0ad1059d515ae1581356f4fe9
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1706
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
src/lib/plugin/plugin-so.c
src/python-plugin-provider/python-plugin-provider.c

index a11798cc1bbc4e5c63157d8381d4ef194de92aa6..319988beeb2dbd1be0406e7a94d89021ddc17cb5 100644 (file)
@@ -409,7 +409,7 @@ int bt_plugin_so_init(struct bt_plugin *plugin,
                                status = BT_FUNC_STATUS_LOADING_ERROR;
                                goto end;
                        } else {
-                               BT_LIB_LOGI(
+                               BT_LIB_LOGW(
                                        "Ignoring unknown plugin descriptor attribute: "
                                        "plugin-path=\"%s\", plugin-name=\"%s\", "
                                        "attr-type-name=\"%s\", attr-type-id=%d",
@@ -686,7 +686,7 @@ int bt_plugin_so_init(struct bt_plugin *plugin,
                                        status = BT_FUNC_STATUS_LOADING_ERROR;
                                        goto end;
                                } else {
-                                       BT_LIB_LOGI(
+                                       BT_LIB_LOGW(
                                                "Ignoring unknown component class descriptor attribute: "
                                                "plugin-path=\"%s\", "
                                                "plugin-name=\"%s\", "
@@ -728,7 +728,7 @@ int bt_plugin_so_init(struct bt_plugin *plugin,
                                status = init_status;
                                goto end;
                        } else {
-                               BT_LIB_LOGI(
+                               BT_LIB_LOGW(
                                        "User's plugin initialization function failed: "
                                        "status=%s",
                                        bt_common_func_status_string(init_status));
@@ -799,7 +799,7 @@ int bt_plugin_so_init(struct bt_plugin *plugin,
                                status = BT_FUNC_STATUS_LOADING_ERROR;
                                goto end;
                        } else {
-                               BT_LIB_LOGI(
+                               BT_LIB_LOGW(
                                        "Ignoring unknown component class type: "
                                        "plugin-path=\"%s\", plugin-name=\"%s\", "
                                        "comp-class-name=\"%s\", comp-class-type=%d",
@@ -1335,7 +1335,7 @@ int bt_plugin_so_create_all_from_sections(
                                status = BT_FUNC_STATUS_LOADING_ERROR;
                                goto error;
                        } else {
-                               BT_LIB_LOGI(
+                               BT_LIB_LOGW(
                                        "Unknown ABI major version: abi-major=%d",
                                                descriptor->major);
                                continue;
@@ -1524,7 +1524,7 @@ int bt_plugin_so_create_all_from_file(const char *path,
                                "__bt_get_end_section_plugin_descriptors");
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Cannot resolve plugin symbol: path=\"%s\", "
                                "symbol=\"%s\"", path,
                                "__bt_get_end_section_plugin_descriptors");
@@ -1564,7 +1564,7 @@ int bt_plugin_so_create_all_from_file(const char *path,
                                attrs_begin, attrs_end);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Found section start or end symbol, but not both: "
                                "path=\"%s\", symbol-start=\"%s\", "
                                "symbol-end=\"%s\", symbol-start-addr=%p, "
@@ -1608,7 +1608,7 @@ int bt_plugin_so_create_all_from_file(const char *path,
                                cc_descriptors_begin, cc_descriptors_end);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Found section start or end symbol, but not both: "
                                "path=\"%s\", symbol-start=\"%s\", "
                                "symbol-end=\"%s\", symbol-start-addr=%p, "
@@ -1652,7 +1652,7 @@ int bt_plugin_so_create_all_from_file(const char *path,
                                cc_descr_attrs_begin, cc_descr_attrs_end);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Found section start or end symbol, but not both: "
                                "path=\"%s\", symbol-start=\"%s\", "
                                "symbol-end=\"%s\", symbol-start-addr=%p, "
index 5bdcbfcd78c035ec4bbbd0a4249d8b7c077d1efb..a1324cff97ff7bbc8c4d259df24c97645687f39f 100644 (file)
@@ -252,7 +252,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Cannot find `name` attribute in Python plugin info object: "
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_NOT_FOUND;
@@ -270,7 +270,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Cannot find `author` attribute in Python plugin info object: "
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_NOT_FOUND;
@@ -288,7 +288,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Cannot find `description` attribute in Python plugin info object: "
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_NOT_FOUND;
@@ -306,7 +306,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Cannot find `license` attribute in Python plugin info object: "
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_NOT_FOUND;
@@ -324,7 +324,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Cannot find `version` attribute in Python plugin info object: "
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_NOT_FOUND;
@@ -343,7 +343,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Cannot find `comp_class_addrs` attribute in Python plugin info object: "
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_NOT_FOUND;
@@ -362,7 +362,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                        "py-plugin-info-addr=%p", plugin_info);
                                status = BT_FUNC_STATUS_LOADING_ERROR;
                        } else {
-                               BT_LIB_LOGI(
+                               BT_LIB_LOGW(
                                        "Cannot decode Python plugin name string: "
                                        "py-plugin-info-addr=%p", plugin_info);
                                status = BT_FUNC_STATUS_NOT_FOUND;
@@ -379,7 +379,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Plugin name is not a string: "
                                "py-plugin-info-addr=%p", plugin_info);
                        status = BT_FUNC_STATUS_NOT_FOUND;
@@ -398,7 +398,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                        "py-plugin-info-addr=%p", plugin_info);
                                status = BT_FUNC_STATUS_LOADING_ERROR;
                        } else {
-                               BT_LIB_LOGI(
+                               BT_LIB_LOGW(
                                        "Cannot decode Python plugin author string: "
                                        "py-plugin-info-addr=%p", plugin_info);
                                status = BT_FUNC_STATUS_NOT_FOUND;
@@ -418,7 +418,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                        "py-plugin-info-addr=%p", plugin_info);
                                status = BT_FUNC_STATUS_LOADING_ERROR;
                        } else {
-                               BT_LIB_LOGI(
+                               BT_LIB_LOGW(
                                        "Cannot decode Python plugin description string: "
                                        "py-plugin-info-addr=%p", plugin_info);
                                status = BT_FUNC_STATUS_NOT_FOUND;
@@ -438,7 +438,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                        "py-plugin-info-addr=%p", plugin_info);
                                status = BT_FUNC_STATUS_LOADING_ERROR;
                        } else {
-                               BT_LIB_LOGI(
+                               BT_LIB_LOGW(
                                        "Cannot decode Python plugin license string: "
                                        "py-plugin-info-addr=%p", plugin_info);
                                status = BT_FUNC_STATUS_NOT_FOUND;
@@ -479,7 +479,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                                "py-plugin-info-addr=%p", plugin_info);
                                        status = BT_FUNC_STATUS_LOADING_ERROR;
                                } else {
-                                       BT_LIB_LOGI(
+                                       BT_LIB_LOGW(
                                                "Invalid Python plugin version format: "
                                                "py-plugin-info-addr=%p", plugin_info);
                                        status = BT_FUNC_STATUS_NOT_FOUND;
@@ -504,7 +504,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                                        "py-plugin-info-addr=%p", plugin_info);
                                                status = BT_FUNC_STATUS_LOADING_ERROR;
                                        } else {
-                                               BT_LIB_LOGI(
+                                               BT_LIB_LOGW(
                                                        "Cannot decode Python plugin version's extra string: "
                                                        "py-plugin-info-addr=%p", plugin_info);
                                                status = BT_FUNC_STATUS_NOT_FOUND;
@@ -560,7 +560,7 @@ int bt_plugin_from_python_plugin_info(PyObject *plugin_info,
                                                plugin_info, i);
                                        status = BT_FUNC_STATUS_LOADING_ERROR;
                                } else {
-                                       BT_LIB_LOGI(
+                                       BT_LIB_LOGW(
                                                "Component class address is not an integer in Python plugin info object: "
                                                "py-plugin-info-addr=%p, index=%zu",
                                                plugin_info, i);
@@ -702,7 +702,7 @@ int bt_plugin_python_create_all_from_file(const char *path,
                                "Cannot load Python plugin: path=\"%s\"", path);
                        status = BT_FUNC_STATUS_LOADING_ERROR;
                } else {
-                       BT_LIB_LOGI(
+                       BT_LIB_LOGW(
                                "Cannot load Python plugin: path=\"%s\"", path);
                        status = BT_FUNC_STATUS_NOT_FOUND;
                }
@@ -750,7 +750,7 @@ int bt_plugin_python_create_all_from_file(const char *path,
 
 error:
        BT_ASSERT(status != BT_FUNC_STATUS_OK);
-       log_python_traceback(fail_on_load_error ? BT_LOG_WARNING : BT_LOG_INFO);
+       log_python_traceback(BT_LOG_WARNING);
        pyerr_clear();
        BT_OBJECT_PUT_REF_AND_RESET(*plugin_set_out);
 
This page took 0.031681 seconds and 4 git commands to generate.