I have a service configured with systemctl. This is the config file:
[Unit]
Description=eureka-server
After=syslog.target
[Service]
User=bhushanp
#User=root
ExecStart=/usr/bin/java -jar /home/bhushanp/apps/eureka_server.jar > /var/log/es.log 2>>&1
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
But its not writing logs to /var/log/es.log file.
Any help is appreciated.
ExecStart
is not managed by a shell, so if you want that, prefix it with/bin/sh -c
and quote your arguments. I would recommend you rather let stdout be connected to the journal and look at log output usingjournalctl -u foo.service
than grabbing it out of a file on disk.If you want to follow the log in a similar fashion to
tail -f
, you can usejournalctl -f -u foo.service
.