[Asterisk-code-review] pjproject bundled: Compile pjsua with max log level = 2 (asterisk[master])

George Joseph asteriskteam at digium.com
Tue Jan 3 15:26:43 CST 2017


George Joseph has uploaded a new change for review. ( https://gerrit.asterisk.org/4692 )

Change subject: pjproject_bundled:  Compile pjsua with max log level = 2
......................................................................

pjproject_bundled:  Compile pjsua with max log level = 2

A while back, we changed config_site.h to set PJ_LOG_MAX_LEVEL = 6.
This allowed us to control the log level better from inside Asterisk.
An unfortunate side effect of this was that the pjsua binary and
python bindings were also compiled with log level set to 6 so whenever
a testsuite test that uses pjsua runs, it spits out 6795 lines of
debug in an instant even before the test starts.  I believe this
overruns the Jenkins capture buffer and prevents the test from
properly terminating.  In turn, this results in the testsuite just
hanging until the job is killed.  It's more frequent on the higher
end agents because they can spit out the messages faster.

Unfortunately, the messages are all spit out before we have control
of the python pj.Lib instance where we can set logging levels so the
only alternative was to actually compile pjsua and _pjsua.so with an
overridden PJ_LOG_MAX_LEVEL.  Although defining a lower max level was
done in the Makefile, the define in config_site.h had to be wrapped
with "#ifndef" so the change would take effect.  NDEBUG and PJ_DEBUG
were also wrapped in anticipation of future issues.

Change-Id: I2af9e7d48dde1927279c586c9c725d868fe6f3ff
---
M third-party/pjproject/Makefile
M third-party/pjproject/patches/config_site.h
2 files changed, 14 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/92/4692/1

diff --git a/third-party/pjproject/Makefile b/third-party/pjproject/Makefile
index 645e7c4..f4cce73 100644
--- a/third-party/pjproject/Makefile
+++ b/third-party/pjproject/Makefile
@@ -190,10 +190,12 @@
 	$(CMD_PREFIX) ar qs $@ $< >/dev/null 2>&1
 
 $(apps): APP = $(filter pj%,$(subst -, ,$(notdir $@)))
+$(apps): CFLAGS += -DPJ_LOG_MAX_LEVEL=2
 $(apps): pjproject.symbols $(APP_THIRD_PARTY_LIB_FILES)
 	$(ECHO_PREFIX) Compiling $(APP)
 	$(CMD_PREFIX) +$(MAKE) -C source/pjsip-apps/build $(filter pj%,$(subst -, ,$(notdir $@))) $(REALLY_QUIET)
 
+source/pjsip-apps/src/python/_pjsua.o: CFLAGS += -DPJ_LOG_MAX_LEVEL=2
 source/pjsip-apps/src/python/_pjsua.o: source/pjsip-apps/src/python/_pjsua.c $(apps)
 	$(ECHO_PREFIX) Compiling python bindings
 	$(CMD_PREFIX) $(CC) -o $@ -c $< $(PYTHONDEV_INCLUDE) $(CFLAGS) $(PJ_CFLAGS)
diff --git a/third-party/pjproject/patches/config_site.h b/third-party/pjproject/patches/config_site.h
index f84adeb..b323d02 100644
--- a/third-party/pjproject/patches/config_site.h
+++ b/third-party/pjproject/patches/config_site.h
@@ -21,7 +21,11 @@
 #define PJMEDIA_HAS_SRTP 0
 
 #define PJ_HAS_IPV6 1
+
+#ifndef NDEBUG
 #define NDEBUG 1
+#endif
+
 #define PJ_MAX_HOSTNAME (256)
 #define PJSIP_MAX_URL_SIZE (512)
 #ifdef PJ_HAS_LINUX_EPOLL
@@ -34,13 +38,21 @@
 
 #define PJ_SCANNER_USE_BITWISE	0
 #define PJ_OS_HAS_CHECK_STACK	0
+
+#ifndef PJ_LOG_MAX_LEVEL
 #define PJ_LOG_MAX_LEVEL		6
+#endif
+
 #define PJ_ENABLE_EXTRA_CHECK	1
 #define PJSIP_MAX_TSX_COUNT		((64*1024)-1)
 #define PJSIP_MAX_DIALOG_COUNT	((64*1024)-1)
 #define PJSIP_UDP_SO_SNDBUF_SIZE	(512*1024)
 #define PJSIP_UDP_SO_RCVBUF_SIZE	(512*1024)
+
+#ifndef PJ_DEBUG
 #define PJ_DEBUG			0
+#endif
+
 #define PJSIP_SAFE_MODULE		0
 #define PJ_HAS_STRICMP_ALNUM		0
 

-- 
To view, visit https://gerrit.asterisk.org/4692
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2af9e7d48dde1927279c586c9c725d868fe6f3ff
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: George Joseph <gjoseph at digium.com>



More information about the asterisk-code-review mailing list