diff --git a/man/logger.1 b/man/logger.1 index d7098ff..bcd1eb5 100644 --- a/man/logger.1 +++ b/man/logger.1 @@ -32,7 +32,7 @@ .Nd Send messages to system log, or a log file .Sh SYNOPSIS .Nm -.Op Fl hsv +.Op Fl chsv .Op Fl f Ar FILE .Op Fl p Ar PRIO .Op Fl r Ar SIZE:NUM @@ -51,6 +51,13 @@ reads input from .Sh OPTIONS This program follows the usual UNIX command line syntax: .Bl -tag -width Ds +.It Fl c +Log to console +.Ql ( LOG_CONS ) +if +.Fn syslog +fails to send message to +.Xr syslogd 8 . .It Fl f Ar FILE Log file to write messages to, instead of syslog daemon. .Nm diff --git a/src/logger.c b/src/logger.c index 6b1c77b..deaa3cb 100644 --- a/src/logger.c +++ b/src/logger.c @@ -182,6 +182,7 @@ static int usage(int code) "\n" "Write MESSAGE (or line-by-line stdin) to syslog, or file (with logrotate).\n" "\n" + " -c Log to console (LOG_CONS) on failure\n" " -p PRIO Log message priority (numeric or facility.severity pair)\n" " -t TAG Log using the specified tag (defaults to user name)\n" " -s Log to stderr as well as the system log\n" @@ -212,8 +213,12 @@ int main(int argc, char *argv[]) char *sockpath = NULL; char buf[512] = ""; - while ((c = getopt(argc, argv, "?f:p:r:st:u:v")) != EOF) { + while ((c = getopt(argc, argv, "?cf:p:r:st:u:v")) != EOF) { switch (c) { + case 'c': + log_opts |= LOG_CONS; + break; + case 'f': logfile = optarg; break;