14.12.2024 15:52, Wietse Venema via Postfix-users пишет:
Michael Tokarev via Postfix-users:
09.12.2024 22:25, Wietse Venema via Postfix-users wrote:
Steffen Nurpmeso via Postfix-users:
    postfix_status() {
    # As postfix does not use stdout but console, no
    #        postfix__init
    #        ${prog} status 2>&1

I think that was fixed in Postfix 3.8.

20230308

          Cleanup: the postfix(1) and postlog(1) commands now produce
          stderr output even when stderr is not connected to a terminal.
          This eliminates an inconsistency, and makes these programs
          easier to use in some automated procedures. The canonical
          example is to capture output from "postmulti -p status" to
          figure out which instances are or are not running. Files:
          postfix/postfix.c, postlog/postlog.c.
The postlog manpage states:
         By default, logging is sent to syslogd(8) or postlogd(8); when
         the standard error stream is connected to a terminal, logging
         is sent  there  as well.

That text needs to be updated, because the stderr behavior has changed.

Both postfix and postconf do call isatty() and perform additional init
if it is, though.


Dec 14 09:27:25 gandalf postfix[165466]: postfix/postlog: starting the Postfix 
mail system
Dec 14 09:27:25 gandalf postfix/postfix-script[165466]: starting the Postfix 
mail system

One is sent by postlog to the syslog, and another is captured from
the stderr/out.  It's an interesting effect.

Captured from stdout"? Tht is not happening in postfix-script. If
systemd is doing that, then I am not going to fight that.
Please don't.  We've much better things to do in our lives and time than
fighting needlessly.

Today systemd plays major role in linux, and linux plays major role in the
IT world.  And while some its ideas are questionable or may look weird, some
are interesting.  And logging is one of them: it offers a trivial logging
capability to all services it starts, by writing to stdout or stderr
(configurable, both by default).  The rest - adding timestamp, tag[pid],
etc - is done by systemd and is the result is written to the log.  Priority
is recognized too at the beginning of the line.

That's just it - you write to stdout, no init, no sockets, no timestamps,
no formatting.  And you get descent logs or - when run from the command
line to debug things - on the tty to see it immediately.

Such things makes both life of programmer easier and logging much better.

/mjt
_______________________________________________
Postfix-users mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to