# Keycloak not logging to file when run from systemctl

**URL:** <https://forum.keycloak.org/t/keycloak-not-logging-to-file-when-run-from-systemctl/19553>\
**Category:** Configuring the server\
**Created:** [January 11, 2023, 9:20pm UTC](https://forum.keycloak.org/t/keycloak-not-logging-to-file-when-run-from-systemctl/19553 "2023-01-11T21:20:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![hmirsky](https://avatars.discourse-cdn.com/v4/letter/h/ac91a4/32.png) [@hmirsky](https://forum.keycloak.org/u/hmirsky)\
**Post date:** [January 11, 2023, 9:20pm UTC](https://forum.keycloak.org/t/keycloak-not-logging-to-file-when-run-from-systemctl/19553/1 "2023-01-11T21:20:19Z")

</div>

Hello,  
I am running Keycloak 20.2.2 and want to log to a file. When I start Keycloak from a shell prompt as follows, log lines are generated as expected. However, when I start Keycloak via a systemd unit no log entries are written to the file.

# /opt/keycloak/bin/kc.sh start --log-level=DEBUG --log=console,file --https-key-store-file=/opt/keycloak/MRK.jks

unit file:  
[Unit]  
Description=Keycloak Server  
After=syslog.target network.target mysql.service  
Before=httpd.service

[Service]  
User=keycloak  
Group=keycloak  
SuccessExitStatus=0 143  
ExecStart=!/opt/keycloak/bin/kc.sh start --log-level=DEBUG --log=console,file --https-key-store-file=/opt/keycloak/MRK.jks

[Install]  
WantedBy=multi-user.target

I’ve tried using the --log-file option as well.

Any/all ideas appreciated.

---

<div class="post-metadata">

**Author:** ![hmirsky](https://avatars.discourse-cdn.com/v4/letter/h/ac91a4/32.png) [@hmirsky](https://forum.keycloak.org/u/hmirsky)\
**Post date:** [January 11, 2023, 10:19pm UTC](https://forum.keycloak.org/t/keycloak-not-logging-to-file-when-run-from-systemctl/19553/2 "2023-01-11T22:19:08Z")

</div>

Oops I figured it out. An operator error! Keycloak logging works fine.

---

<div class="post-metadata">

**Author:** ![Sa-ad](https://avatars.discourse-cdn.com/v4/letter/s/53a042/32.png) [@Sa-ad](https://forum.keycloak.org/u/Sa-ad)\
**Post date:** [April 5, 2024, 11:51am UTC](https://forum.keycloak.org/t/keycloak-not-logging-to-file-when-run-from-systemctl/19553/3 "2024-04-05T11:51:02Z")

</div>

Hi, I have the same issue, can you clarify more the solution ?
