[CentOS] systemd does not generate both StandardOutput and StandardError files in /var/log/ directory

Fri Nov 5 08:06:50 UTC 2021
Kaushal Shriyan <kaushalshriyan at gmail.com>

Hi,

I am running CentOS Linux release 7.9.2009 (Core). I have created a systemd
service for a java service. I want to capture both stdout and stderr to
files under /var/log directory.
# cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
#
# rpm -qa | grep systemd
systemd-sysv-219-78.el7_9.3.x86_64
systemd-libs-219-78.el7_9.3.x86_64
systemd-219-78.el7_9.3.x86_64

# cat /etc/systemd/system/smartresponse.service
[Unit]
Description=Smart Response Service

[Service]
WorkingDirectory=/opt/demo
ExecStart=/bin/java -jar old2-wsb-smart-response-0.0.2-SNAPSHOT.jar
Type=simple
Restart=on-failure
RestartSec=10
StandardOutput=file:/var/log/smartresponseserviceoutput.log
StandardError=file:/var/log/smartresponseserviceerror.log

[Install]
WantedBy=multi-user.target
#

The files /var/log/smartresponseserviceoutput.log and
/var/log/smartresponseserviceoutput.log are not created. Please guide.

Thanks in advance.

Best Regards,

Kaushal