Browse code

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/...)

Daniel-Constantin Mierla authored on 07/03/2011 12:42:38
Showing 5 changed files
... ...
@@ -386,6 +386,7 @@ SYN_BRANCH syn_branch
386 386
 MEMLOG		"memlog"|"mem_log"
387 387
 MEMDBG		"memdbg"|"mem_dbg"
388 388
 MEMSUM		"mem_summary"
389
+CORELOG		"corelog"|"core_log"
389 390
 SIP_WARNING sip_warning
390 391
 SERVER_SIGNATURE server_signature
391 392
 SERVER_HEADER server_header
... ...
@@ -747,6 +748,7 @@ SUBST       subst
747 747
 <INITIAL>{MEMLOG}	{ count(); yylval.strval=yytext; return MEMLOG; }
748 748
 <INITIAL>{MEMDBG}	{ count(); yylval.strval=yytext; return MEMDBG; }
749 749
 <INITIAL>{MEMSUM}	{ count(); yylval.strval=yytext; return MEMSUM; }
750
+<INITIAL>{CORELOG}	{ count(); yylval.strval=yytext; return CORELOG; }
750 751
 <INITIAL>{SIP_WARNING}	{ count(); yylval.strval=yytext; return SIP_WARNING; }
751 752
 <INITIAL>{USER}		{ count(); yylval.strval=yytext; return USER; }
752 753
 <INITIAL>{GROUP}	{ count(); yylval.strval=yytext; return GROUP; }
... ...
@@ -434,6 +434,7 @@ extern char *finame;
434 434
 %token MEMLOG
435 435
 %token MEMDBG
436 436
 %token MEMSUM
437
+%token CORELOG
437 438
 %token SIP_WARNING
438 439
 %token SERVER_SIGNATURE
439 440
 %token SERVER_HEADER
... ...
@@ -918,6 +919,8 @@ assign_stm:
918 918
 	| MEMDBG EQUAL error { yyerror("int value expected"); }
919 919
 	| MEMSUM EQUAL intno { default_core_cfg.mem_summary=$3; }
920 920
 	| MEMSUM EQUAL error { yyerror("int value expected"); }
921
+	| CORELOG EQUAL intno { default_core_cfg.corelog=$3; }
922
+	| CORELOG EQUAL error { yyerror("int value expected"); }
921 923
 	| SIP_WARNING EQUAL NUMBER { sip_warning=$3; }
922 924
 	| SIP_WARNING EQUAL error { yyerror("boolean value expected"); }
923 925
 	| USER EQUAL STRING     {
... ...
@@ -119,8 +119,9 @@ struct cfg_group_core default_core_cfg = {
119 119
 	-1,  /**< udp4_raw_ttl (auto detect by default) */
120 120
 	0,  /*!< force_rport */
121 121
 	L_DBG, /*!< memlog */
122
-	3 /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
122
+	3, /*!< mem_summary -flags: 0 off, 1 pkg_status, 2 shm_status,
123 123
 		4 pkg_sums, 8 shm_sums */
124
+	L_ERR /*!< corelog */
124 125
 };
125 126
 
126 127
 void	*core_cfg = &default_core_cfg;
... ...
@@ -307,5 +308,7 @@ cfg_def_t core_cfg_def[] = {
307 307
 		" 2 - dump all the shm used blocks (status),"
308 308
 		" 4 - summary of pkg used blocks,"
309 309
 		" 8 - summary of shm used blocks" },
310
+	{"corelog",		CFG_VAR_INT|CFG_ATOMIC,	0, 0, 0, 0,
311
+		"log level for non-critical core error messages"},
310 312
 	{0, 0, 0, 0, 0, 0}
311 313
 };
... ...
@@ -108,6 +108,7 @@ struct cfg_group_core {
108 108
 	int force_rport; /*!< if set rport will always be forced*/
109 109
 	int memlog; /*!< log level for memory status/summary info */
110 110
 	int mem_summary; /*!< display memory status/summary info on exit */
111
+	int corelog; /*!< log level for non-critcal core error messages */
111 112
 };
112 113
 
113 114
 extern struct cfg_group_core default_core_cfg;
... ...
@@ -123,6 +123,7 @@ log_stderror=no
123 123
 
124 124
 memdbg=5
125 125
 memlog=5
126
+corelog=-2
126 127
 
127 128
 log_facility=LOG_LOCAL0
128 129