diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-06-15 13:38:46 -0400 |
|---|---|---|
| committer | Donald Sharp <sharpd@cumulusnetworks.com> | 2018-06-19 08:43:59 -0400 |
| commit | f8507817cf19d621cefd1d0310925ad07ec4646e (patch) | |
| tree | 3ea82f53181723fb6e4ff91a417f9bc73f019a3f /lib/libfrr.c | |
| parent | 1f1432364911625d5abd6384b190a2d75c37120f (diff) | |
lib: Add new cli to specify where to output logs on startup
When we are starting a daemon, allow the user to specify:
--log <stdout|syslog|file:file_name>
This can be used on early startup to put the log files
where the end user wants them to show up.
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
Diffstat (limited to 'lib/libfrr.c')
| -rw-r--r-- | lib/libfrr.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/libfrr.c b/lib/libfrr.c index 4f3b8c66d6..9292688327 100644 --- a/lib/libfrr.c +++ b/lib/libfrr.c @@ -78,6 +78,7 @@ static void opt_extend(const struct optspec *os) #define OPTION_VTYSOCK 1000 #define OPTION_MODULEDIR 1002 +#define OPTION_LOG 1003 static const struct option lo_always[] = { {"help", no_argument, NULL, 'h'}, @@ -86,6 +87,7 @@ static const struct option lo_always[] = { {"module", no_argument, NULL, 'M'}, {"vty_socket", required_argument, NULL, OPTION_VTYSOCK}, {"moduledir", required_argument, NULL, OPTION_MODULEDIR}, + {"log", required_argument, NULL, OPTION_LOG}, {NULL}}; static const struct optspec os_always = { "hvdM:", @@ -94,7 +96,8 @@ static const struct optspec os_always = { " -d, --daemon Runs in daemon mode\n" " -M, --module Load specified module\n" " --vty_socket Override vty socket path\n" - " --moduledir Override modules directory\n", + " --moduledir Override modules directory\n" + " --log Set Logging to stdout, syslog, or file:<name>\n", lo_always}; @@ -444,6 +447,9 @@ static int frr_opt(int opt) return 1; di->privs->group = optarg; break; + case OPTION_LOG: + di->early_logging = optarg; + break; default: return 1; } @@ -543,6 +549,9 @@ struct thread_master *frr_init(void) openzlog(di->progname, di->logname, di->instance, LOG_CONS | LOG_NDELAY | LOG_PID, LOG_DAEMON); + + if (di->early_logging) + command_setup_early_logging(di->early_logging); #if defined(HAVE_CUMULUS) zlog_set_level(ZLOG_DEST_SYSLOG, zlog_default->default_lvl); #endif |
