aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-02 19:02:22 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-02 19:02:22 +0000
commit546cc0e6981a6aa03ba83974486689b881fc308b (patch)
tree40ce70999b2a5f0ca71a2a74a099e8e4b3c4b495
parent36ca3290fad05a716a1485d64e295fd3b4e571ef (diff)
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. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@191785 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--CHANGES8
-rw-r--r--apps/app_sms.c4
-rw-r--r--apps/app_verbose.c2
-rw-r--r--configs/logger.conf.sample4
-rw-r--r--include/asterisk/logger.h11
-rw-r--r--main/logger.c72
-rw-r--r--main/manager.c9
-rw-r--r--pbx/pbx_spool.c5
8 files changed, 14 insertions, 101 deletions
diff --git a/CHANGES b/CHANGES
index e96170830..59a736a7e 100644
--- a/CHANGES
+++ b/CHANGES
@@ -122,7 +122,7 @@ The latest modified mISDN v1.1.x based version is available at:
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
@@ -140,6 +140,12 @@ Asterisk Manager Interface
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 -------------
------------------------------------------------------------------------------
diff --git a/apps/app_sms.c b/apps/app_sms.c
index 0015cc842..0c53391d3 100644
--- a/apps/app_sms.c
+++ b/apps/app_sms.c
@@ -815,7 +815,7 @@ static void sms_readfile(sms_t * h, char *fn)
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 @@ static void sms_writefile(sms_t * h)
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);
}
}
diff --git a/apps/app_verbose.c b/apps/app_verbose.c
index b4c6a6384..a900dcacb 100644
--- a/apps/app_verbose.c
+++ b/apps/app_verbose.c
@@ -146,8 +146,6 @@ static int log_exec(struct ast_channel *chan, void *data)
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);
}
diff --git a/configs/logger.conf.sample b/configs/logger.conf.sample
index a441ebd8f..09b4b62a1 100644
--- a/configs/logger.conf.sample
+++ b/configs/logger.conf.sample
@@ -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.
;
diff --git a/include/asterisk/logger.h b/include/asterisk/logger.h
index 65448cfe4..785c3e8de 100644
--- a/include/asterisk/logger.h
+++ b/include/asterisk/logger.h
@@ -123,17 +123,6 @@ void ast_console_toggle_loglevel(int fd, int level, int state);
#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
#endif
diff --git a/main/logger.c b/main/logger.c
index 24e182a17..72411275d 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -106,8 +106,7 @@ enum rotatestrategy {
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 pthread_t logthread = AST_PTHREADT_NULL;
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 @@ static int make_components(const char *s, int lineno)
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 @@ static void init_logger_chain(int locked)
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,29 +586,13 @@ static int rotate_file(const char *filename)
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) {
/* Check filesize - this one typically doesn't need an auto-rotate */
@@ -650,21 +628,6 @@ static int reload_logger(int rotate)
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 @@ static int reload_logger(int rotate)
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 @@ static char *handle_logger_show_channels(struct ast_cli_entry *e, int cmd, struc
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);
@@ -873,13 +833,6 @@ static void logger_print_normal(struct logmsg *logmsg)
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) {
/* If the channel is disabled, then move on to the next one */
@@ -943,7 +896,6 @@ static void logger_print_normal(struct logmsg *logmsg)
/* 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 @@ int init_logger(void)
/* 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");
@@ -1065,11 +1004,6 @@ void close_logger(void)
AST_RWLIST_WRLOCK(&logchannels);
- if (eventlog) {
- fclose(eventlog);
- eventlog = NULL;
- }
-
if (qlog) {
fclose(qlog);
qlog = NULL;
diff --git a/main/manager.c b/main/manager.c
index 97d573c07..edcc8ccf6 100644
--- a/main/manager.c
+++ b/main/manager.c
@@ -1850,7 +1850,6 @@ static int action_login(struct mansession *s, const struct message *m)
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 @@ static void *session_do(void *data)
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 @@ static int generic_http_callback(struct ast_tcptls_session_instance *ser,
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 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
}
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 @@ static int auth_http_callback(struct ast_tcptls_session_instance *ser,
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;
}
diff --git a/pbx/pbx_spool.c b/pbx/pbx_spool.c
index 4b1b33e97..ca739333a 100644
--- a/pbx/pbx_spool.c
+++ b/pbx/pbx_spool.c
@@ -339,7 +339,7 @@ static void *attempt_thread(void *data)
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 @@ static void *attempt_thread(void *data)
}
} 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 @@ static int scan_service(char *fn, time_t now, time_t atime)
}
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);
}