MT#55283 Squashed commit of the following:

closes #1560
closes #1559

commit e11f52c041
Author: Dup4 <lyuzhi.pan@gmail.com>
Date:   Tue Nov 1 22:58:44 2022 +0800

    fix: add comma

commit e0c2f47b49
Author: Dup4 <lyuzhi.pan@gmail.com>
Date:   Tue Nov 1 22:01:26 2022 +0800

    feat: add log-name option

Change-Id: I40a7b68120efb240faea86eb2d716d5e01a420c3
pull/1563/head
Dup4 3 years ago committed by Richard Fuchs
parent aab897d62e
commit ad5d98e4d0

@ -1023,7 +1023,7 @@ static void early_init(void) {
}
static void init_everything(void) {
log_init("rtpengine");
log_init(rtpe_common_config_ptr->log_name);
log_format(rtpe_config.log_format);
recording_fs_init(rtpe_config.spooldir, rtpe_config.rec_method, rtpe_config.rec_format);
rtpe_ssl_init();

@ -318,6 +318,11 @@ if logging to syslog.
Don't add timestamps to log lines written to stderr.
Only useful in combination with B<--log-stderr>.
=item B<--log-name=>I<STRING>
Set the id to be printed in syslog.
Defaults to B<rtpengine>.
=item B<--log-mark-prefix=>I<STRING>
Prefix to be added to particular data fields in log files that are deemed

@ -96,6 +96,7 @@ void config_load_free(struct rtpengine_common_config *cconfig) {
g_free(cconfig->config_file);
g_free(cconfig->config_section);
g_free(cconfig->log_facility);
g_free(cconfig->log_name);
g_free(cconfig->log_mark_prefix);
g_free(cconfig->log_mark_suffix);
g_free(cconfig->pidfile);
@ -155,6 +156,7 @@ void config_load(int *argc, char ***argv, GOptionEntry *app_entries, const char
{ "split-logs", 0, 0, G_OPTION_ARG_NONE, &rtpe_common_config_ptr->split_logs, "Split multi-line log messages", NULL },
{ "max-log-line-length",0, 0, G_OPTION_ARG_INT, &rtpe_common_config_ptr->max_log_line_length, "Break log lines at this length","INT" },
{ "no-log-timestamps", 0, 0, G_OPTION_ARG_NONE, &rtpe_common_config_ptr->no_log_timestamps,"Drop timestamps from log lines to stderr",NULL },
{ "log-name", 0, 0, G_OPTION_ARG_STRING, &rtpe_common_config_ptr->log_name, "Set the id to be printed in syslog", NULL },
{ "log-mark-prefix", 0, 0, G_OPTION_ARG_STRING, &rtpe_common_config_ptr->log_mark_prefix,"Prefix for sensitive log info", NULL },
{ "log-mark-suffix", 0, 0, G_OPTION_ARG_STRING, &rtpe_common_config_ptr->log_mark_suffix,"Suffix for sensitive log info", NULL },
{ "pidfile", 'p', 0, G_OPTION_ARG_FILENAME, &rtpe_common_config_ptr->pidfile, "Write PID to file", "FILE" },
@ -300,6 +302,9 @@ void config_load(int *argc, char ***argv, GOptionEntry *app_entries, const char
out:
// default common values, if not configured
if (rtpe_common_config_ptr->log_name == NULL)
rtpe_common_config_ptr->log_name = g_strdup("rtpengine");
if (rtpe_common_config_ptr->log_mark_prefix == NULL)
rtpe_common_config_ptr->log_mark_prefix = g_strdup("");

@ -23,6 +23,7 @@ struct rtpengine_common_config {
int log_stderr;
int split_logs;
int no_log_timestamps;
char *log_name;
char *log_mark_prefix;
char *log_mark_suffix;
char *pidfile;

Loading…
Cancel
Save