# Keycloak SPI logging

**URL:** <https://forum.keycloak.org/t/keycloak-spi-logging/12031>\
**Category:** Miscellanaeous\
**Created:** [November 11, 2021, 11:39am UTC](https://forum.keycloak.org/t/keycloak-spi-logging/12031 "2021-11-11T11:39:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![eldarj](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/eldarj/32/4365_2.png) [@eldarj](https://forum.keycloak.org/u/eldarj)\
**Post date:** [November 11, 2021, 11:39am UTC](https://forum.keycloak.org/t/keycloak-spi-logging/12031/1 "2021-11-11T11:39:13Z")

</div>

I’m developing a keycloak event listener and I managed to do that, but I’m having an issue with writing to $KEYCLOAK\_DIR/standalone/log/server.log

I assumed that this is where jboss writes out all logs, and that any logging done in a custom SPI would also be written into this file, but this doesnt seem like the case.

Could someone check this out please?

---

<div class="post-metadata">

**Author:** ![dasniko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dasniko/32/2969_2.png) [@dasniko](https://forum.keycloak.org/u/dasniko)\
**Post date:** [November 11, 2021, 12:50pm UTC](https://forum.keycloak.org/t/keycloak-spi-logging/12031/2 "2021-11-11T12:50:32Z")

</div>

Is your code available somewhere? Without knowing what you do (or did), it‘s hard to guess.

---

<div class="post-metadata">

**Author:** ![eldarj](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/eldarj/32/4365_2.png) [@eldarj](https://forum.keycloak.org/u/eldarj)\
**Post date:** [November 11, 2021, 2:48pm UTC](https://forum.keycloak.org/t/keycloak-spi-logging/12031/3 "2021-11-11T14:48:32Z")

</div>

Actually, I just noticed that when I download the **tar.gz and run keycloak as standalone** , everything works fine. Keycloak as is logs to server.log as well as my event listener.

However previously, I was working with a docker container, and now I see - once I run the container, initially jboss and keycloak log into server.log, but then no more logs appear (from SPI event listener or jboss e.g. login error)

[Here’s the code](https://github.com/eldarj/keycloak-spi-eventlistener) (it should be reproducable by running or following the install.sh)

---

<div class="post-metadata">

**Author:** ![dasniko](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/dasniko/32/2969_2.png) [@dasniko](https://forum.keycloak.org/u/dasniko)\
**Post date:** [November 11, 2021, 3:09pm UTC](https://forum.keycloak.org/t/keycloak-spi-logging/12031/4 "2021-11-11T15:09:32Z")

</div>

In the Docker image, Keycloak is configured to log only to STDOUT, not to a logfile. This is best practice for containers, as logging to files would increase the containersize at some point and this might lead into other issues…

You should be able to gather the logs from your container with the `docker logs ...` command.

---

<div class="post-metadata">

**Author:** ![eldarj](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/eldarj/32/4365_2.png) [@eldarj](https://forum.keycloak.org/u/eldarj)\
**Post date:** [November 15, 2021, 11:18am UTC](https://forum.keycloak.org/t/keycloak-spi-logging/12031/5 "2021-11-15T11:18:49Z")

</div>

awesome - makes sense indeed

thanks a lot @dasniko
