aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKeith <keith@rhizomatica.org>2020-03-27 19:43:34 -0500
committerKeith <keith@rhizomatica.org>2020-03-28 15:25:07 -0500
commit85fe6104c55c1d46efa2036afe927f924f6f9fcd (patch)
tree3f67441336a184ed5bd56cb844454fdfa300d992 /src
parentb5bfa71aa2ce2728f4e5e3b8e796d7ea226232ba (diff)
Meas Tools: Avoid OSMO_ASSERT due to uninitialised logging.
The measurement tools use libosmocore socket functions that will use logging if the socket cannot be opened, but the tools did not initialise logging, resulting in Assert failed osmo_log_info logging.c:235 backtrace() returned 9 addresses [.....] Initialise logging so that we get a nicer and more informative message, such as: unable to bind socket:(null):8888: Address already in use no suitable addr found for: (null):8888 Change-Id: Ib3b3558723682defcee22e7ea2d8bf5c2cff1278
Diffstat (limited to 'src')
-rw-r--r--src/utils/meas_json.c14
-rw-r--r--src/utils/meas_vis.c15
2 files changed, 29 insertions, 0 deletions
diff --git a/src/utils/meas_json.c b/src/utils/meas_json.c
index a3526de5d..6aa531a7f 100644
--- a/src/utils/meas_json.c
+++ b/src/utils/meas_json.c
@@ -34,6 +34,7 @@
#include <osmocom/core/socket.h>
#include <osmocom/core/msgb.h>
#include <osmocom/core/select.h>
+#include <osmocom/core/application.h>
#include <osmocom/gsm/gsm_utils.h>
@@ -171,8 +172,21 @@ static int udp_fd_cb(struct osmo_fd *ofd, unsigned int what)
return 0;
}
+/* default categories */
+static struct log_info_cat default_categories[] = {
+};
+
+static const struct log_info meas_json_log_info = {
+ .cat = default_categories,
+ .num_cat = ARRAY_SIZE(default_categories),
+};
+
int main(int argc, char **argv)
{
+
+ void *tall_ctx = talloc_named_const(NULL, 0, "meas_json");
+ osmo_init_logging2(tall_ctx, &meas_json_log_info);
+
int rc;
struct osmo_fd udp_ofd;
diff --git a/src/utils/meas_vis.c b/src/utils/meas_vis.c
index cba08f5c3..aea12bf9b 100644
--- a/src/utils/meas_vis.c
+++ b/src/utils/meas_vis.c
@@ -13,6 +13,8 @@
#include <osmocom/core/msgb.h>
#include <osmocom/core/select.h>
#include <osmocom/core/talloc.h>
+#include <osmocom/core/logging.h>
+#include <osmocom/core/application.h>
#include <osmocom/gsm/gsm_utils.h>
@@ -258,11 +260,24 @@ const struct value_string col_strs[] = {
{ 0, NULL }
};
+/* default categories */
+static struct log_info_cat default_categories[] = {
+};
+
+static const struct log_info meas_vis_log_info = {
+ .cat = default_categories,
+ .num_cat = ARRAY_SIZE(default_categories),
+};
+
int main(int argc, char **argv)
{
int rc;
char *header[1];
char *title[1];
+ struct log_target *stderr_target;
+
+ void *tall_ctx = talloc_named_const(NULL, 0, "meas_vis");
+ osmo_init_logging2(tall_ctx, &meas_vis_log_info);
msgb_talloc_ctx_init(NULL, 0);