Re: How to print debug printf messages when we login using telnet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Feb 27, 2019 at 12:49 PM Dhananjay Patil <Dhananjay.Patil@xxxxxxxx> wrote:

Dear All,

We successfully login using telnet on board.

Our application start as systemd service in order to start at boot time.

We define service as follow:

[Unit]

Description=Initmyapplication

 

[Service]

ExecStart=/usr/bin/myapplication &


The '&' is useless; ExecStart does not accept shell syntax, so all this is doing is passing a literal "&" in the program's argv. All services are already "in background" by definition.
 

Our application have some debug messages implemented using printf.

After completing login process using telnet those printf are not visible on telnet.


By default, services' output goes to the system log (journal or syslog). You should be able to find them in `systemctl status myapp` or `journalctl -b -u myapp`. (In recent systemd versions, you can also redirect the output to a file.)

Note that libc buffers stdout when writing to files or pipes, which can cause the printf output to be delayed. Make sure the application calls fflush(stdout) after every debug printf, or use setlinebuf(stdout) on application startup to switch to line-buffered mode.

--
Mantas Mikulėnas
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux