[PATCH] osmo-pcu[master]: Initialize logging before initializing rate_ctr

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Wed Oct 25 09:15:35 UTC 2017


Review at  https://gerrit.osmocom.org/4411

Initialize logging before initializing rate_ctr

The library code for rate counter initialization, which is called from
the descendants of bsc_network_alloc() might already want to log
something (particularly after Ifc6ac824f5dae9a848bb4a5d067c64a69eb40b56
in libosmocore), so the logging framework must be initialized before.

Change-Id: Ibf557d21552d9ff1d6b595b0594f2c7b18db4692
---
M src/bts.cpp
1 file changed, 7 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/11/4411/1

diff --git a/src/bts.cpp b/src/bts.cpp
index b768569..09a562a 100644
--- a/src/bts.cpp
+++ b/src/bts.cpp
@@ -33,6 +33,7 @@
 	#include <osmocom/core/talloc.h>
 	#include <osmocom/core/msgb.h>
 	#include <osmocom/core/stats.h>
+	#include <osmocom/core/application.h>
 	#include <osmocom/gsm/protocol/gsm_04_08.h>
 	#include <osmocom/gsm/gsm_utils.h>
 	#include <osmocom/core/gsmtap_util.h>
@@ -49,6 +50,7 @@
 extern void *tall_pcu_ctx;
 
 static BTS s_bts;
+static bool log_not_initialized = true;
 
 /**
  * For gcc-4.4 compat do not use extended initializer list but keep the
@@ -207,6 +209,11 @@
 		}
 	}
 
+	if (log_not_initialized) {
+		log_not_initialized = false;
+		osmo_init_logging(&gprs_log_info);
+	}
+
 	m_ratectrs = rate_ctr_group_alloc(tall_pcu_ctx, &bts_ctrg_desc, 0);
 	OSMO_ASSERT(m_ratectrs);
 	m_statg = osmo_stat_item_group_alloc(tall_pcu_ctx, &bts_statg_desc, 0);

-- 
To view, visit https://gerrit.osmocom.org/4411
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibf557d21552d9ff1d6b595b0594f2c7b18db4692
Gerrit-PatchSet: 1
Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list