mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-24 06:53:41 +00:00
Make sure logger is reloaded at general reload in the cli.
(Discovered during Asterisk training in Portugal) git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@91366 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -64,6 +64,9 @@ void ast_log(int level, const char *file, int line, const char *function, const
|
|||||||
|
|
||||||
void ast_backtrace(void);
|
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, ...)
|
void ast_queue_log(const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt, ...)
|
||||||
__attribute__ ((format (printf, 5, 6)));
|
__attribute__ ((format (printf, 5, 6)));
|
||||||
|
|
||||||
|
@@ -239,6 +239,7 @@ static struct reload_classes {
|
|||||||
{ "manager", reload_manager },
|
{ "manager", reload_manager },
|
||||||
{ "rtp", ast_rtp_reload },
|
{ "rtp", ast_rtp_reload },
|
||||||
{ "http", ast_http_reload },
|
{ "http", ast_http_reload },
|
||||||
|
{ "logger", logger_reload },
|
||||||
{ NULL, NULL }
|
{ NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -483,13 +483,21 @@ int reload_logger(int rotate)
|
|||||||
return res;
|
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[])
|
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");
|
ast_cli(fd, "Failed to reload the logger\n");
|
||||||
return RESULT_FAILURE;
|
return result;
|
||||||
} else
|
|
||||||
return RESULT_SUCCESS;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int handle_logger_rotate(int fd, int argc, char *argv[])
|
static int handle_logger_rotate(int fd, int argc, char *argv[])
|
||||||
@@ -497,8 +505,8 @@ static int handle_logger_rotate(int fd, int argc, char *argv[])
|
|||||||
if(reload_logger(1)) {
|
if(reload_logger(1)) {
|
||||||
ast_cli(fd, "Failed to reload the logger and rotate log files\n");
|
ast_cli(fd, "Failed to reload the logger and rotate log files\n");
|
||||||
return RESULT_FAILURE;
|
return RESULT_FAILURE;
|
||||||
} else
|
}
|
||||||
return RESULT_SUCCESS;
|
return RESULT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*! \brief CLI command to show logging system configuration */
|
/*! \brief CLI command to show logging system configuration */
|
||||||
|
Reference in New Issue
Block a user