[sr-dev] git:master: core: new global parameter corelog

Daniel-Constantin Mierla miconda at gmail.com
Mon Mar 7 17:18:25 CET 2011


Module: sip-router
Branch: master
Commit: 7e2e4ff44945483fac3725cb7fcb5d2f3adc2d0d
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7e2e4ff44945483fac3725cb7fcb5d2f3adc2d0d

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Mar  7 13:42:38 2011 +0100

core: new global parameter corelog

- control the log level for non-critical core error messages
- e.g., useful to disable messages such as:
	- tcp connection reset by peer
	- error parsing received message for garbage (non-sip/html/...)

---

 cfg.lex          |    2 ++
 cfg.y            |    3 +++
 cfg_core.c       |    5 ++++-
 cfg_core.h       |    1 +
 etc/kamailio.cfg |    1 +
 5 files changed, 11 insertions(+), 1 deletions(-)

diff --git a/cfg.lex b/cfg.lex
index 07c7b90..d8586db 100644
--- a/cfg.lex
+++ b/cfg.lex
@@ -386,6 +386,7 @@ SYN_BRANCH syn_branch
 MEMLOG		"memlog"|"mem_log"
 MEMDBG		"memdbg"|"mem_dbg"
 MEMSUM		"mem_summary"
+CORELOG		"corelog"|"core_log"
 SIP_WARNING sip_warning
 SERVER_SIGNATURE server_signature
 SERVER_HEADER server_header
@@ -747,6 +748,7 @@ SUBST       subst
 <INITIAL>{MEMLOG}	{ count(); yylval.strval=yytext; return MEMLOG; }
 <INITIAL>{MEMDBG}	{ count(); yylval.strval=yytext; return MEMDBG; }
 <INITIAL>{MEMSUM}	{ count(); yylval.strval=yytext; return MEMSUM; }
+<INITIAL>{CORELOG}	{ count(); yylval.strval=yytext; return CORELOG; }
 <INITIAL>{SIP_WARNING}	{ count(); yylval.strval=yytext; return SIP_WARNING; }
 <INITIAL>{USER}		{ count(); yylval.strval=yytext; return USER; }
 <INITIAL>{GROUP}	{ count(); yylval.strval=yytext; return GROUP; }
diff --git a/cfg.y b/cfg.y
index 92d8b69..dde4040 100644
--- a/cfg.y
+++ b/cfg.y
@@ -434,6 +434,7 @@ extern char *finame;
 %token MEMLOG
 %token MEMDBG
 %token MEMSUM
+%token CORELOG
 %token SIP_WARNING
 %token SERVER_SIGNATURE
 %token SERVER_HEADER
@@ -918,6 +919,8 @@ assign_stm:
 	| MEMDBG EQUAL error { yyerror("int value expected"); }
 	| MEMSUM EQUAL intno { default_core_cfg.mem_summary=$3; }
 	| MEMSUM EQUAL error { yyerror("int value expected"); }
+	| CORELOG EQUAL intno { default_core_cfg.corelog=$3; }
+	| CORELOG EQUAL error { yyerror("int value expected"); }
 	| SIP_WARNING EQUAL NUMBER { sip_warning=$3; }
 	| SIP_WARNING EQUAL error { yyerror("boolean value expected"); }
 	| USER EQUAL STRING     {
diff --git a/cfg_core.c b/cfg_core.c
index 77db37f..03605ee 100644
--- a/cfg_core.c
+++ b/cfg_core.c
@@ -119,8 +119,9 @@ struct cfg_group_core default_core_cfg = {
 	-1,  /**< udp4_raw_ttl (auto detect by default) */
 	0,  /*!< force_rport */
 	L_DBG, /*!< memlog */
-	3 /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
+	3, /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
 		4 pkg_sums, 8 shm_sums */
+	L_ERR /*!< corelog */
 };
 
 void	*core_cfg = &default_core_cfg;
@@ -307,5 +308,7 @@ cfg_def_t core_cfg_def[] = {
 		" 2 - dump all the shm used blocks (status),"
 		" 4 - summary of pkg used blocks,"
 		" 8 - summary of shm used blocks" },
+	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
+		"log level for non-critical core error messages"},
 	{0, 0, 0, 0, 0, 0}
 };
diff --git a/cfg_core.h b/cfg_core.h
index 45bd3d1..25f69ae 100644
--- a/cfg_core.h
+++ b/cfg_core.h
@@ -108,6 +108,7 @@ struct cfg_group_core {
 	int force_rport; /*!< if set rport will always be forced*/
 	int memlog; /*!< log level for memory status/summary info */
 	int mem_summary; /*!< display memory status/summary info on exit */
+	int corelog; /*!< log level for non-critcal core error messages */
 };
 
 extern struct cfg_group_core default_core_cfg;
diff --git a/etc/kamailio.cfg b/etc/kamailio.cfg
index 5e6d9f7..85f54e0 100644
--- a/etc/kamailio.cfg
+++ b/etc/kamailio.cfg
@@ -123,6 +123,7 @@ log_stderror=no
 
 memdbg=5
 memlog=5
+corelog=-2
 
 log_facility=LOG_LOCAL0
 




More information about the sr-dev mailing list