Hacker News new | ask | show | jobs
by z3t4 3445 days ago
Can you see them when you run journalctl -u nameOfUnit or systemctl status nameOfUnit ? I'm running Ubuntu server.
1 comments

Yup. It is possible that your service is buffering output before actually writing it to the standard error stream. Try attaching to it with strace -e write PID and observe whether it is actually calling write(2, "some message"..., somenumberofbytes).

To approach this from the other direction, try this program:

    import sys, time

    while True:
        print('test out', flush=True)
        print('test error', file=sys.stderr, flush=True)
        time.sleep(5)
With this service:

    [Service]
    Type=simple
    ExecStart=/usr/bin/python3 /tmp/test.py