[asterisk-commits] oej: branch 1.4 r91366 - in /branches/1.4: include/asterisk/ main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Dec 6 06:54:11 CST 2007


Author: oej
Date: Thu Dec  6 06:54:11 2007
New Revision: 91366

URL: http://svn.digium.com/view/asterisk?view=rev&rev=91366
Log:
Make sure logger is reloaded at general reload in the cli.

(Discovered during Asterisk training in Portugal)

Modified:
    branches/1.4/include/asterisk/logger.h
    branches/1.4/main/loader.c
    branches/1.4/main/logger.c

Modified: branches/1.4/include/asterisk/logger.h
URL: http://svn.digium.com/view/asterisk/branches/1.4/include/asterisk/logger.h?view=diff&rev=91366&r1=91365&r2=91366
==============================================================================
--- branches/1.4/include/asterisk/logger.h (original)
+++ branches/1.4/include/asterisk/logger.h Thu Dec  6 06:54:11 2007
@@ -63,6 +63,9 @@
 	__attribute__ ((format (printf, 5, 6)));
 
 void ast_backtrace(void);
+
+/*! \brief Reload logger without rotating log files */
+int logger_reload(void);
 
 void ast_queue_log(const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt, ...)
 	__attribute__ ((format (printf, 5, 6)));

Modified: branches/1.4/main/loader.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/loader.c?view=diff&rev=91366&r1=91365&r2=91366
==============================================================================
--- branches/1.4/main/loader.c (original)
+++ branches/1.4/main/loader.c Thu Dec  6 06:54:11 2007
@@ -239,6 +239,7 @@
 	{ "manager",	reload_manager },
 	{ "rtp",	ast_rtp_reload },
 	{ "http",	ast_http_reload },
+	{ "logger",	logger_reload },
 	{ NULL, 	NULL }
 };
 

Modified: branches/1.4/main/logger.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/logger.c?view=diff&rev=91366&r1=91365&r2=91366
==============================================================================
--- branches/1.4/main/logger.c (original)
+++ branches/1.4/main/logger.c Thu Dec  6 06:54:11 2007
@@ -483,13 +483,21 @@
 	return res;
 }
 
+/*! \brief Reload the logger module without rotating log files (also used from loader.c during
+	a full Asterisk reload) */
+int logger_reload(void)
+{
+	if(reload_logger(0))
+		return RESULT_FAILURE;
+	return RESULT_SUCCESS;
+}
+
 static int handle_logger_reload(int fd, int argc, char *argv[])
 {
-	if(reload_logger(0)) {
+	int result = logger_reload();
+	if (result == RESULT_FAILURE)
 		ast_cli(fd, "Failed to reload the logger\n");
-		return RESULT_FAILURE;
-	} else
-		return RESULT_SUCCESS;
+	return result;
 }
 
 static int handle_logger_rotate(int fd, int argc, char *argv[])
@@ -497,8 +505,8 @@
 	if(reload_logger(1)) {
 		ast_cli(fd, "Failed to reload the logger and rotate log files\n");
 		return RESULT_FAILURE;
-	} else
-		return RESULT_SUCCESS;
+	}
+	return RESULT_SUCCESS;
 }
 
 /*! \brief CLI command to show logging system configuration */




More information about the asterisk-commits mailing list