Logger: Add manager command 'LoggerRotate' to rotate logger

Part of a series of AMI command equivalents to existing CLI
commands

Review: https://reviewboard.asterisk.org/r/3651/


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@416848 65c4cc65-6c06-0410-ace0-fbb531ad65f3
changes/97/197/1
Jonathan Rose 11 years ago
parent 86e8ab5ed4
commit e087ae0c02

@ -20,6 +20,9 @@ AMI
res_manager_presence_state.so. If the high frequency of these events is
problematic for you, do not load these modules.
* New AMI action LoggerRotate reloads and rotates logger in the same manner
as CLI command 'logger rotate'
chan_dahdi
------------------
* SS7 support now requires libss7 v2.0 or later.

@ -88,6 +88,9 @@ void ast_log_backtrace(void);
/*! \brief Reload logger without rotating log files */
int logger_reload(void);
/*! \brief Reload logger while rotating log files */
int ast_logger_rotate(void);
void __attribute__((format(printf, 5, 6))) ast_queue_log(const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt, ...);
/*!

@ -928,6 +928,11 @@ static char *handle_logger_rotate(struct ast_cli_entry *e, int cmd, struct ast_c
return CLI_SUCCESS;
}
int ast_logger_rotate()
{
return reload_logger(1, NULL);
}
static char *handle_logger_set_level(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
int x;

@ -802,6 +802,17 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
<para>List currently defined channels and some information about them.</para>
</description>
</manager>
<manager name="LoggerRotate" language="en_US">
<synopsis>
Reload and rotate the Asterisk logger.
</synopsis>
<syntax>
<xi:include xpointer="xpointer(/docs/manager[@name='Login']/syntax/parameter[@name='ActionID'])" />
</syntax>
<description>
<para>Reload and rotate the logger. Analogous to the CLI command 'logger rotate'.</para>
</description>
</manager>
<manager name="ModuleLoad" language="en_US">
<synopsis>
Module management.
@ -5444,6 +5455,19 @@ static int action_coreshowchannels(struct mansession *s, const struct message *m
return 0;
}
/*! \brief Manager command "LoggerRotate" - reloads and rotates the logger in
* the same manner as the CLI command 'logger rotate'. */
static int action_loggerrotate(struct mansession *s, const struct message *m)
{
if (ast_logger_rotate()) {
astman_send_error(s, m, "Failed to reload the logger and rotate log files");
return 0;
}
astman_send_ack(s, m, "Reloaded the logger and rotated log files");
return 0;
}
/*! \brief Manager function to check if module is loaded */
static int manager_modulecheck(struct mansession *s, const struct message *m)
{
@ -7930,6 +7954,7 @@ static void manager_shutdown(void)
ast_manager_unregister("CoreSettings");
ast_manager_unregister("CoreStatus");
ast_manager_unregister("Reload");
ast_manager_unregister("LoggerRotate");
ast_manager_unregister("CoreShowChannels");
ast_manager_unregister("ModuleLoad");
ast_manager_unregister("ModuleCheck");
@ -8126,6 +8151,7 @@ static int __init_manager(int reload, int by_external_config)
ast_manager_register_xml_core("CoreSettings", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, action_coresettings);
ast_manager_register_xml_core("CoreStatus", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, action_corestatus);
ast_manager_register_xml_core("Reload", EVENT_FLAG_CONFIG | EVENT_FLAG_SYSTEM, action_reload);
ast_manager_register_xml_core("LoggerRotate", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, action_loggerrotate);
ast_manager_register_xml_core("CoreShowChannels", EVENT_FLAG_SYSTEM | EVENT_FLAG_REPORTING, action_coreshowchannels);
ast_manager_register_xml_core("ModuleLoad", EVENT_FLAG_SYSTEM, manager_moduleload);
ast_manager_register_xml_core("ModuleCheck", EVENT_FLAG_SYSTEM, manager_modulecheck);

Loading…
Cancel
Save