NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: bin/60338: The log priority after a newline in log(9) is forced to LOG_KERN | LOG_NOTICE
The following reply was made to PR bin/60338; it has been noted by GNATS.
From: mlelstv%serpens.de@localhost (Michael van Elst)
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: bin/60338: The log priority after a newline in log(9) is forced to LOG_KERN | LOG_NOTICE
Date: Wed, 17 Jun 2026 17:56:22 -0000 (UTC)
gnats-admin%NetBSD.org@localhost ("msaitoh%execsw.org@localhost via gnats") writes:
>When passing a multi-line string containing newline characters to log(9), all lines after the first are forced to use the priority LOG_KERN | LOG_NOTICE (DEFSPRI defined in usr.sbin/syslogd/syslogd.h).
>This behavior is likely unintended.
It's how syslog works, which is a line based protocol.
Output to the log is prefixed with "<priority>" and syslogd parses the
message. If a line doesn't start with such a tag, it uses DEFSPRI for
kernel messages and DEFUPRI for userland messages.
You can surely teach log(9) to prepend each line with a priority tag,
but since log(9) is something like:
logpri(level)
kprintf(...)
you either need hooks in kprintf or some kind of expensive postprocessing.
In any case, this will generate multiple events, and then it might
be more obvious if you also have to call log(9) once for each event.
Home |
Main Index |
Thread Index |
Old Index