[asterisk-commits] kpfleming: trunk r191785 - in /trunk: ./ apps/ configs/ include/asterisk/ mai...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat May 2 14:02:25 CDT 2009


Author: kpfleming
Date: Sat May  2 14:02:22 2009
New Revision: 191785

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=191785
Log:
Remove rarely-used event_log/LOG_EVENT support

In discussions today at the Europe Asterisk Developer Meet-Up, we determined that
the event_log was used in only 9 places in the entire tree, and really was not needed
at all. The users have been converted to use LOG_NOTICE, or the messages have been
removed since other messages were already in place that provided the same information.


Modified:
    trunk/CHANGES
    trunk/apps/app_sms.c
    trunk/apps/app_verbose.c
    trunk/configs/logger.conf.sample
    trunk/include/asterisk/logger.h
    trunk/main/logger.c
    trunk/main/manager.c
    trunk/pbx/pbx_spool.c

Modified: trunk/CHANGES
URL: http://svn.digium.com/svn-view/asterisk/trunk/CHANGES?view=diff&rev=191785&r1=191784&r2=191785
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Sat May  2 14:02:22 2009
@@ -122,7 +122,7 @@
 http://svn.digium.com/svn/thirdparty/mISDN/trunk
 http://svn.digium.com/svn/thirdparty/mISDNuser/trunk
 
-Taged versions of the modified mISDN code are available under:
+Tagged versions of the modified mISDN code are available under:
 http://svn.digium.com/svn/thirdparty/mISDN/tags
 http://svn.digium.com/svn/thirdparty/mISDNuser/tags
 
@@ -139,6 +139,12 @@
    across all .conf files. All affected sample.conf files have been modified to
    reflect this change.  Previous options such as 'sslenable' still work,
    but options with the 'tls' prefix are preferred.
+
+Logger
+------
+ * The rarely used 'event_log' and LOG_EVENT channel have been removed; the few
+   users of this channel in the tree have been converted to LOG_NOTICE or removed
+   (in cases where the same message was already generated to another channel).
 
 ------------------------------------------------------------------------------
 --- Functionality changes from Asterisk 1.6.1 to Asterisk 1.6.2  -------------

Modified: trunk/apps/app_sms.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/apps/app_sms.c?view=diff&rev=191785&r1=191784&r2=191785
==============================================================================
--- trunk/apps/app_sms.c (original)
+++ trunk/apps/app_sms.c Sat May  2 14:02:22 2009
@@ -815,7 +815,7 @@
 	char line[1000];
 	FILE *s;
 	char dcsset = 0;                        /* if DSC set */
-	ast_log(LOG_EVENT, "Sending %s\n", fn);
+	ast_log(LOG_NOTICE, "Sending %s\n", fn);
 	h->rx = h->udl = *h->oa = *h->da = h->pid = h->srr = h->udhi = h->rp = h->vp = h->udhl = 0;
 	h->mr = -1;
 	h->dcs = 0xF1;                          /* normal messages class 1 */
@@ -1080,7 +1080,7 @@
 	if (rename(fn, fn2)) {
 		unlink(fn);
 	} else {
-		ast_log(LOG_EVENT, "Received to %s\n", fn2);
+		ast_log(LOG_NOTICE, "Received to %s\n", fn2);
 	}
 }
 

Modified: trunk/apps/app_verbose.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/apps/app_verbose.c?view=diff&rev=191785&r1=191784&r2=191785
==============================================================================
--- trunk/apps/app_verbose.c (original)
+++ trunk/apps/app_verbose.c Sat May  2 14:02:22 2009
@@ -146,8 +146,6 @@
 		lnum = __LOG_VERBOSE;
 	} else if (!strcasecmp(args.level, "DTMF")) {
 		lnum = __LOG_DTMF;
-	} else if (!strcasecmp(args.level, "EVENT")) {
-		lnum = __LOG_EVENT;
 	} else {
 		ast_log(LOG_ERROR, "Unknown log level: '%s'\n", args.level);
 	}

Modified: trunk/configs/logger.conf.sample
URL: http://svn.digium.com/svn-view/asterisk/trunk/configs/logger.conf.sample?view=diff&rev=191785&r1=191784&r2=191785
==============================================================================
--- trunk/configs/logger.conf.sample (original)
+++ trunk/configs/logger.conf.sample Sat May  2 14:02:22 2009
@@ -47,10 +47,6 @@
 ;
 ; exec_after_rotate=gzip -9 ${filename}.2
 ;
-; This determines whether or not we log generic events to a file
-; (defaults to yes).
-;event_log = no
-;
 ;
 ; For each file, specify what to log.
 ;

Modified: trunk/include/asterisk/logger.h
URL: http://svn.digium.com/svn-view/asterisk/trunk/include/asterisk/logger.h?view=diff&rev=191785&r1=191784&r2=191785
==============================================================================
--- trunk/include/asterisk/logger.h (original)
+++ trunk/include/asterisk/logger.h Sat May  2 14:02:22 2009
@@ -122,17 +122,6 @@
 #undef AST_LOG_DEBUG
 #endif
 #define AST_LOG_DEBUG      __LOG_DEBUG, _A_
-
-#ifdef LOG_EVENT
-#undef LOG_EVENT
-#endif
-#define __LOG_EVENT    1
-#define LOG_EVENT      __LOG_EVENT, _A_
-
-#ifdef AST_LOG_EVENT
-#undef AST_LOG_EVENT
-#endif
-#define AST_LOG_EVENT      __LOG_EVENT, _A_
 
 #ifdef LOG_NOTICE
 #undef LOG_NOTICE

Modified: trunk/main/logger.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/main/logger.c?view=diff&rev=191785&r1=191784&r2=191785
==============================================================================
--- trunk/main/logger.c (original)
+++ trunk/main/logger.c Sat May  2 14:02:22 2009
@@ -106,8 +106,7 @@
 
 static struct {
 	unsigned int queue_log:1;
-	unsigned int event_log:1;
-} logfiles = { 1, 1 };
+} logfiles = { 1 };
 
 static char hostname[MAXHOSTNAMELEN];
 
@@ -151,13 +150,12 @@
 static ast_cond_t logcond;
 static int close_logger_thread;
 
-static FILE *eventlog;
 static FILE *qlog;
 
 /*! \brief Logging channels used in the Asterisk logging system */
 static char *levels[] = {
 	"DEBUG",
-	"EVENT",
+	"---EVENT---",		/* no longer used */
 	"NOTICE",
 	"WARNING",
 	"ERROR",
@@ -196,8 +194,6 @@
 			res |= (1 << __LOG_WARNING);
 		else if (!strcasecmp(w, "notice"))
 			res |= (1 << __LOG_NOTICE);
-		else if (!strcasecmp(w, "event"))
-			res |= (1 << __LOG_EVENT);
 		else if (!strcasecmp(w, "debug"))
 			res |= (1 << __LOG_DEBUG);
 		else if (!strcasecmp(w, "verbose"))
@@ -382,8 +378,6 @@
 		ast_copy_string(dateformat, "%b %e %T", sizeof(dateformat));
 	if ((s = ast_variable_retrieve(cfg, "general", "queue_log")))
 		logfiles.queue_log = ast_true(s);
-	if ((s = ast_variable_retrieve(cfg, "general", "event_log")))
-		logfiles.event_log = ast_true(s);
 	if ((s = ast_variable_retrieve(cfg, "general", "queue_log_name")))
 		ast_copy_string(queue_log_name, s, sizeof(queue_log_name));
 	if ((s = ast_variable_retrieve(cfg, "general", "exec_after_rotate")))
@@ -592,28 +586,12 @@
 static int reload_logger(int rotate)
 {
 	char old[PATH_MAX] = "";
-	int event_rotate = rotate, queue_rotate = rotate;
+	int queue_rotate = rotate;
 	struct logchannel *f;
 	int res = 0;
 	struct stat st;
 
 	AST_RWLIST_WRLOCK(&logchannels);
-
-	if (eventlog) {
-		if (rotate < 0) {
-			/* Check filesize - this one typically doesn't need an auto-rotate */
-			snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, EVENTLOG);
-			if (stat(old, &st) != 0 || st.st_size > 0x40000000) { /* Arbitrarily, 1 GB */
-				fclose(eventlog);
-				eventlog = NULL;
-			} else
-				event_rotate = 0;
-		} else {
-			fclose(eventlog);
-			eventlog = NULL;
-		}
-	} else
-		event_rotate = 0;
 
 	if (qlog) {
 		if (rotate < 0) {
@@ -650,21 +628,6 @@
 
 	init_logger_chain(1 /* locked */);
 
-	if (logfiles.event_log) {
-		snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, EVENTLOG);
-		if (event_rotate)
-			rotate_file(old);
-
-		eventlog = fopen(old, "a");
-		if (eventlog) {
-			ast_log(LOG_EVENT, "Restarted Asterisk Event Logger\n");
-			ast_verb(1, "Asterisk Event Logger restarted\n");
-		} else {
-			ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno));
-			res = -1;
-		}
-	}
-
 	if (logfiles.queue_log) {
 		snprintf(old, sizeof(old), "%s/%s", ast_config_AST_LOG_DIR, queue_log_name);
 		if (queue_rotate)
@@ -675,7 +638,6 @@
 			AST_RWLIST_UNLOCK(&logchannels);
 			ast_queue_log("NONE", "NONE", "NONE", "CONFIGRELOAD", "%s", "");
 			AST_RWLIST_WRLOCK(&logchannels);
-			ast_log(LOG_EVENT, "Restarted Asterisk Queue Logger\n");
 			ast_verb(1, "Asterisk Queue Logger restarted\n");
 		} else {
 			ast_log(LOG_ERROR, "Unable to create queue log: %s\n", strerror(errno));
@@ -809,8 +771,6 @@
 			ast_cli(a->fd, "Notice ");
 		if (chan->logmask & (1 << __LOG_ERROR)) 
 			ast_cli(a->fd, "Error ");
-		if (chan->logmask & (1 << __LOG_EVENT)) 
-			ast_cli(a->fd, "Event ");
 		ast_cli(a->fd, "\n");
 	}
 	AST_RWLIST_UNLOCK(&logchannels);
@@ -872,13 +832,6 @@
 	char buf[BUFSIZ];
 
 	AST_RWLIST_RDLOCK(&logchannels);
-
-	if (logfiles.event_log && logmsg->level == __LOG_EVENT) {
-		fprintf(eventlog, "%s asterisk[%ld]: %s", logmsg->date, (long)getpid(), logmsg->str);
-		fflush(eventlog);
-		AST_RWLIST_UNLOCK(&logchannels);
-		return;
-	}
 
 	if (!AST_RWLIST_EMPTY(&logchannels)) {
 		AST_RWLIST_TRAVERSE(&logchannels, chan, list) {
@@ -943,7 +896,6 @@
 	/* If we need to reload because of the file size, then do so */
 	if (filesize_reload_needed) {
 		reload_logger(-1);
-		ast_log(LOG_EVENT, "Rotated Logs Per SIGXFSZ (Exceeded file size limit)\n");
 		ast_verb(1, "Rotated Logs Per SIGXFSZ (Exceeded file size limit)\n");
 	}
 
@@ -1029,19 +981,6 @@
 	/* create log channels */
 	init_logger_chain(0 /* locked */);
 
-	/* create the eventlog */
-	if (logfiles.event_log) {
-		snprintf(tmp, sizeof(tmp), "%s/%s", ast_config_AST_LOG_DIR, EVENTLOG);
-		eventlog = fopen(tmp, "a");
-		if (eventlog) {
-			ast_log(LOG_EVENT, "Started Asterisk Event Logger\n");
-			ast_verb(1, "Asterisk Event Logger Started %s\n", tmp);
-		} else {
-			ast_log(LOG_ERROR, "Unable to create event log: %s\n", strerror(errno));
-			res = -1;
-		}
-	}
-
 	if (logfiles.queue_log) {
 		snprintf(tmp, sizeof(tmp), "%s/%s", ast_config_AST_LOG_DIR, queue_log_name);
 		qlog = fopen(tmp, "a");
@@ -1064,11 +1003,6 @@
 		pthread_join(logthread, NULL);
 
 	AST_RWLIST_WRLOCK(&logchannels);
-
-	if (eventlog) {
-		fclose(eventlog);
-		eventlog = NULL;
-	}
 
 	if (qlog) {
 		fclose(qlog);

Modified: trunk/main/manager.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/main/manager.c?view=diff&rev=191785&r1=191784&r2=191785
==============================================================================
--- trunk/main/manager.c (original)
+++ trunk/main/manager.c Sat May  2 14:02:22 2009
@@ -1850,7 +1850,6 @@
 	if (manager_displayconnects(s->session)) {
 		ast_verb(2, "%sManager '%s' logged on from %s\n", (s->session->managerid ? "HTTP " : ""), s->session->username, ast_inet_ntoa(s->session->sin.sin_addr));
 	}
-	ast_log(LOG_EVENT, "%sManager '%s' logged on from %s\n", (s->session->managerid ? "HTTP " : ""), s->session->username, ast_inet_ntoa(s->session->sin.sin_addr));
 	astman_send_ack(s, m, "Authentication accepted");
 	return 0;
 }
@@ -3415,12 +3414,10 @@
 		if (manager_displayconnects(session)) {
 			ast_verb(2, "Manager '%s' logged off from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
 		}
-		ast_log(LOG_EVENT, "Manager '%s' logged off from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
 	} else {
 		if (displayconnects) {
 			ast_verb(2, "Connect attempt from '%s' unable to authenticate\n", ast_inet_ntoa(session->sin.sin_addr));
 		}
-		ast_log(LOG_EVENT, "Failed attempt from %s\n", ast_inet_ntoa(session->sin.sin_addr));
 	}
 
 	/* It is possible under certain circumstances for this session thread
@@ -4153,12 +4150,10 @@
 			if (manager_displayconnects(session)) {
 				ast_verb(2, "HTTP Manager '%s' logged off from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
 			}
-			ast_log(LOG_EVENT, "HTTP Manager '%s' logged off from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
 		} else {
 			if (displayconnects) {
 				ast_verb(2, "HTTP Connect attempt from '%s' unable to authenticate\n", ast_inet_ntoa(session->sin.sin_addr));
 			}
-			ast_log(LOG_EVENT, "HTTP Failed attempt from %s\n", ast_inet_ntoa(session->sin.sin_addr));
 		}
 		session->needdestroy = 1;
 	}
@@ -4420,9 +4415,6 @@
 		}
 		session->noncetime = session->sessionstart = time_now;
 		session->authenticated = 1;
-
-		ast_log(LOG_EVENT, "HTTP Manager '%s' logged in from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
-
 	} else if (stale) {
 		/*
 		 * Session found, but nonce is stale.
@@ -4498,7 +4490,6 @@
 		if (u_displayconnects) {
 			ast_verb(2, "HTTP Manager '%s' logged off from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
 		}
-		ast_log(LOG_EVENT, "HTTP Manager '%s' logged off from %s\n", session->username, ast_inet_ntoa(session->sin.sin_addr));
 
 		session->needdestroy = 1;
 	}

Modified: trunk/pbx/pbx_spool.c
URL: http://svn.digium.com/svn-view/asterisk/trunk/pbx/pbx_spool.c?view=diff&rev=191785&r1=191784&r2=191785
==============================================================================
--- trunk/pbx/pbx_spool.c (original)
+++ trunk/pbx/pbx_spool.c Sat May  2 14:02:22 2009
@@ -339,7 +339,7 @@
 		ast_log(LOG_NOTICE, "Call failed to go through, reason (%d) %s\n", reason, ast_channel_reason2str(reason));
 		if (o->retries >= o->maxretries + 1) {
 			/* Max retries exceeded */
-			ast_log(LOG_EVENT, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");
+			ast_log(LOG_NOTICE, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");
 			remove_from_queue(o, "Expired");
 		} else {
 			/* Notate that the call is still active */
@@ -347,7 +347,6 @@
 		}
 	} else {
 		ast_log(LOG_NOTICE, "Call completed to %s/%s\n", o->tech, o->dest);
-		ast_log(LOG_EVENT, "Queued call to %s/%s completed\n", o->tech, o->dest);
 		remove_from_queue(o, "Completed");
 	}
 	free_outgoing(o);
@@ -425,7 +424,7 @@
 		}
 		res = now;
 	} else {
-		ast_log(LOG_EVENT, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");
+		ast_log(LOG_NOTICE, "Queued call to %s/%s expired without completion after %d attempt%s\n", o->tech, o->dest, o->retries - 1, ((o->retries - 1) != 1) ? "s" : "");
 		remove_from_queue(o, "Expired");
 		free_outgoing(o);
 	}




More information about the asterisk-commits mailing list