how to properly config my application logging?

hey guys. i have java spring app. and on the server its running as a service. heres my application123.service:
[Unit]
Description=application123
After=syslog.target
[Service]
User=appl
Environment="JAVA_OPTS=-Xmx128m"
ExecStart=/usr/local/bin/application123-1.0.jar --spring.config.location=/etc/spring/ --spring.config.name=application123
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
[Unit]
Description=application123
After=syslog.target
[Service]
User=appl
Environment="JAVA_OPTS=-Xmx128m"
ExecStart=/usr/local/bin/application123-1.0.jar --spring.config.location=/etc/spring/ --spring.config.name=application123
SuccessExitStatus=143
[Install]
WantedBy=multi-user.target
Now when this service runs on the server, everything is logged to syslog. And the thing is that id want to log everything to separate file. smth like application123.log. so my question is should i edit my application123.service file, or should i edit application.yaml file? thanks
5 Replies
JavaBot
JavaBot3w ago
This post has been reserved for your question.
Hey @bambyzas! Please use /close or the Close Post button above when your problem is solved. Please remember to follow the help guidelines. This post will be automatically marked as dormant after 300 minutes of inactivity.
TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.
dan1st
dan1st3w ago
Do you want the location where stuff is logged to to be a part of the application or part of the deployment? Also note that you can just do journalctl -u application123 to get the logs
bambyzas
bambyzasOP3w ago
but i can just add
StandardOutput=file:/var/log/application123 .log
StandardError=file:/var/log/application123 .log
StandardOutput=file:/var/log/application123 .log
StandardError=file:/var/log/application123 .log
to my .service file, right?
dan1st
dan1st3w ago
Are you sure you want the space before .log?
JavaBot
JavaBot3w ago
💤 Post marked as dormant
This post has been inactive for over 300 minutes, thus, it has been archived. If your question was not answered yet, feel free to re-open this post or create a new one. In case your post is not getting any attention, you can try to use /help ping. Warning: abusing this will result in moderative actions taken against you.
Want results from more Discord servers?
Add your server