# Trying to get keycloak log to file

**URL:** <https://forum.keycloak.org/t/trying-to-get-keycloak-log-to-file/15981>\
**Category:** Configuring the server\
**Created:** [June 14, 2022, 8:23pm UTC](https://forum.keycloak.org/t/trying-to-get-keycloak-log-to-file/15981 "2022-06-14T20:23:56Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ewok2](https://avatars.discourse-cdn.com/v4/letter/e/8c91f0/32.png) [@ewok2](https://forum.keycloak.org/u/ewok2)\
**Post date:** [June 14, 2022, 8:23pm UTC](https://forum.keycloak.org/t/trying-to-get-keycloak-log-to-file/15981/1 "2022-06-14T20:23:57Z")

</div>

Hello  
I would like to get the log from keycloak in a log file.  
If I try the start command :

> bin/kc.[sh|bat] start --log=console,file --log-file=/\<your-file.log\>

from this documentation :

> **[Configuring logging - Keycloak](https://www.keycloak.org/server/logging)**
>
> Keycloak is an open source identity and access management solution

I get an error with --log-file option not allowed

If I try the following start command in a console :

> sudo -u keycloak /opt/keycloak/bin/kc.sh start --spi-events-listener-jboss-logging-success-level=info --spi-events-listener-jboss-logging-error-level=error

from this documentation :  
[https://www.keycloak.org/docs/latest/server\_admin/index.html#event-listener](https://www.keycloak.org/docs/latest/server_admin/index.html#event-listener)

it is better as I can have the log in the console.  
B

But is there a way to forward this console flow to a file ?

Many thanks

---

<div class="post-metadata">

**Author:** ![Frosty](https://avatars.discourse-cdn.com/v4/letter/f/f475e1/32.png) [@Frosty](https://forum.keycloak.org/u/Frosty)\
**Post date:** [May 2, 2023, 3:32pm UTC](https://forum.keycloak.org/t/trying-to-get-keycloak-log-to-file/15981/2 "2023-05-02T15:32:34Z")

</div>

Hello,

I know it’s an old issue, but since i face the same one recently, for anyone having the same issue i resolve it using :

```auto
bin/kc.sh start --log="console,file" --log-level=INFO --log-file=/opt/keycloak/data/keycloak.log

```

Allowing you to write INFO log in both file and the console, in a file that you define

or in docker/podman just add :  
-e KC\_LOG=file,console -e KC\_LOG\_LEVEL=INFO -e KC\_LOG\_FILE=/opt/keycloak/data/keycloak.log

---

<div class="post-metadata">

**Author:** ![ewok2](https://avatars.discourse-cdn.com/v4/letter/e/8c91f0/32.png) [@ewok2](https://forum.keycloak.org/u/ewok2)\
**Post date:** [May 2, 2023, 6:30pm UTC](https://forum.keycloak.org/t/trying-to-get-keycloak-log-to-file/15981/3 "2023-05-02T18:30:10Z")

</div>

Wondeful I had give up with the log file.  
I just do it and it works  
know I have to remove the warning I can see 😉  
Thanks
