diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-05-02 19:02:22 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-05-02 19:02:22 +0000 |
commit | 546cc0e6981a6aa03ba83974486689b881fc308b (patch) | |
tree | 40ce70999b2a5f0ca71a2a74a099e8e4b3c4b495 /main | |
parent | 36ca3290fad05a716a1485d64e295fd3b4e571ef (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
Diffstat (limited to 'main')
-rw-r--r-- | main/logger.c | 72 | ||||
-rw-r--r-- | main/manager.c | 9 |
2 files changed, 3 insertions, 78 deletions
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; } |