diff --git a/conf.c b/conf.c index 8687e43..d9b6606 100644 --- a/conf.c +++ b/conf.c @@ -727,9 +727,7 @@ static void usage(const char *name, FILE *f, int status) " --trace Be extra verbose, implies --debug\n" " -q, --quiet Don't print informational messages\n" " -f, --foreground Don't run in background\n" - " default: run in background if started from a TTY\n" - " -e, --stderr Log to stderr too\n" - " default: log to system logger only if started from a TTY\n" + " default: run in background\n" " -l, --log-file PATH Log (only) to given file\n" " --log-size BYTES Maximum size of log file\n" " default: 1 MiB\n" @@ -1387,18 +1385,10 @@ void conf(struct ctx *c, int argc, char **argv) c->quiet = 0; break; case 'e': - if (logfile) - die("Can't log to both file and stderr"); - - c->force_stderr = 1; - logfile = NULL; + warn("--stderr will be dropped soon"); break; case 'l': - if (c->force_stderr) - die("Can't log to both stderr and file"); - logfile = optarg; - c->force_stderr = 0; break; case 'q': c->quiet = 1; @@ -1631,9 +1621,6 @@ void conf(struct ctx *c, int argc, char **argv) conf_ugid(runas, &uid, &gid); - if (!c->foreground && c->force_stderr) - die("Can't log to standard error if not running in foreground"); - if (logfile) { logfile_init(c->mode == MODE_PASTA ? "pasta" : "passt", logfile, logsize); diff --git a/passt.1 b/passt.1 index 7b9915b..abc13d5 100644 --- a/passt.1 +++ b/passt.1 @@ -96,21 +96,14 @@ Default is to fork into background. .TP .BR \-e ", " \-\-stderr -Log to standard error too. -Default is to log to the system logger only, if started from an interactive -terminal, and to both system logger and standard error otherwise. +This option has no effect, and is maintained for compatibility purposes only. -This option cannot be specified together with \fB--log-file\fR, because there -might be a reasonable expectation that messages are logged to standard error as -well as to a file, which is however not supported. +Note that this configuration option is \fBdeprecated\fR and will be removed in a +future version. .TP .BR \-l ", " \-\-log-file " " \fIPATH\fR -Log to file \fIPATH\fR, not to standard error, and not to the system logger. - -This option cannot be specified together with \fB--stderr\fR, because there -might be a reasonable expectation that messages are logged to a file as well as -to standard error, which is however not supported. +Log to file \fIPATH\fR, and not to the system logger. Specifying this option multiple times does \fInot\fR lead to multiple log files: the last given option takes effect. diff --git a/passt.c b/passt.c index aa9648a..19ecd68 100644 --- a/passt.c +++ b/passt.c @@ -302,7 +302,7 @@ int main(int argc, char **argv) if (isolate_prefork(&c)) die("Failed to sandbox process, exiting"); - if (!c.foreground || (!c.force_stderr && !isatty(fileno(stderr)))) + if (!c.foreground) __openlog(log_name, 0, LOG_DAEMON); if (!c.foreground) diff --git a/passt.h b/passt.h index 46d073a..21cf4c1 100644 --- a/passt.h +++ b/passt.h @@ -180,7 +180,6 @@ struct ip6_ctx { * @trace: Enable tracing (extra debug) mode * @quiet: Don't print informational messages * @foreground: Run in foreground, don't log to stderr by default - * @force_stderr: Force logging to stderr * @nofile: Maximum number of open files (ulimit -n) * @sock_path: Path for UNIX domain socket * @pcap: Path for packet capture file @@ -231,7 +230,6 @@ struct ctx { int trace; int quiet; int foreground; - int force_stderr; int nofile; char sock_path[UNIX_PATH_MAX]; char pcap[PATH_MAX];