when I execute command foo in console (ie tty1), the output is sent to the console.

daemon foo started successfully

When I execute the same command in virtual terminal (terminator), I see no output in the terminal, but the output is sent to syslog.

Why is this, and how can I control where the output is sent ?

I have an init startup script that executes command foo, and the output is sent to tty1. I would like to send the output to syslog instead (as if I had started the init script in virtual terminal, instead of in console)

  • Look at the source. – Ipor Sircer Aug 26 '20 at 9:48
  • You are mixing up console and virtual terminal here. – JdeBP Aug 26 '20 at 11:11
  • @ Ipor Sircer - do you think this behavior is specific to my application, not a system wide behavior? – 400 the Cat Aug 26 '20 at 12:08
  • If your startup script is started from the /etc/rc* standard script on a recent Unix, then the output of your script will behave as you want: through syslog. Just try a reboot. – dan Aug 31 '20 at 12:54

As you can read in the Debian man page for daemon, it vastly depends on how you implemented your daemon under which init system.

  • The SysV way (stdin/out/err connected to /dev/null)
  • The "New-style" way : (stdout/stderr directed to systemd-journald.service)

... 10.Instead of using the syslog() call to log directly to the system syslog service, a new-style daemon may choose to simply log to standard error via fprintf(), which is then forwarded to syslog by the init system ...

In this latter case, the behaviour you notice under your xterm is the normal way.

What the daemon outputs via fprintf (stdout / stderr) is then under the control of syslog.

Therefore, depending on your syslog configuration (as you find it in your syslog.conf file) and depending on the log level, what your daemon outputs will be ignored / appended to some particular file / echoed on the system console (your tty1), and never xterm.


This is a application behavior, not system wide. rsyslog will only be called upon when a application does, through a logging service or such. Standard output and error stream unless redirected appear on your screen.

  • - whether this is application specific, or not. How can I "fool" the application into thinking that it is running in virtual terminal, so that it outputs its output into syslog, instead of on the terminal ? – 400 the Cat Aug 29 '20 at 7:54
  • Not sure, but it might be a login shell identification issue. You might want to “su - <your own username” to get something like a login shell or ssh into yourself. That tricks programs into thinking its a login shell, as I can see with bash that reads .bash_profile instead of only .bashrc – Andrew Yu Aug 30 '20 at 2:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.