# Setting log level in Keycloak docker container

**URL:** <https://forum.keycloak.org/t/setting-log-level-in-keycloak-docker-container/24299>\
**Category:** Configuring the server\
**Created:** [January 30, 2024, 3:59pm UTC](https://forum.keycloak.org/t/setting-log-level-in-keycloak-docker-container/24299 "2024-01-30T15:59:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![tsr2](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@tsr2](https://forum.keycloak.org/u/tsr2)\
**Post date:** [January 30, 2024, 3:59pm UTC](https://forum.keycloak.org/t/setting-log-level-in-keycloak-docker-container/24299/1 "2024-01-30T15:59:36Z")

</div>

I want to change the log level in a Docker container to see if it can shed any light on an issue I am seeing. This does not appear to be obviously documented in the Keycloak documentation, but Google suggests environment variable KEYCLOAK\_LOGLEVEL. I have also tried KC\_LOGLEVEL.  
The environment variable in this docker compose snippet does not appear to make any difference to the log output. Is it incorrect?

> ```
> keycloak:
> image: quay.io/keycloak/keycloak:23.0.1
> command: start-dev
> container_name: keycloak
> networks:
> - ztg_net
> ports:
> - 8080:8080
> environment:
> - KEYCLOAK_ADMIN=admin
> - KEYCLOAK_ADMIN_PASSWORD= ****
> - KEYCLOAK_LOGLEVEL=DEBUG
> 
> ```

---

<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:** [January 30, 2024, 4:04pm UTC](https://forum.keycloak.org/t/setting-log-level-in-keycloak-docker-container/24299/2 "2024-01-30T16:04:37Z")

</div>

The docs are pretty clear about that: [Configuring logging - Keycloak](https://www.keycloak.org/server/logging)  
e.g. `KC_LOG_LEVEL=DEBUG`

---

<div class="post-metadata">

**Author:** ![tsr2](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@tsr2](https://forum.keycloak.org/u/tsr2)\
**Post date:** [January 30, 2024, 5:38pm UTC](https://forum.keycloak.org/t/setting-log-level-in-keycloak-docker-container/24299/3 "2024-01-30T17:38:09Z")

</div>

That page doesn’t mention KC\_LOGLEVEL, or any environment variables, that I can see? KC\_LOGLEVEL had no obvious effect when I tried it, but I will try again.  
I kind of expected the environment variables to be documented in the container documentation, but I couldn’t see a log level variable there either.

---

<div class="post-metadata">

**Author:** ![embesozzi](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/embesozzi/32/12390_2.png) [@embesozzi](https://forum.keycloak.org/u/embesozzi)\
**Post date:** [January 30, 2024, 5:46pm UTC](https://forum.keycloak.org/t/setting-log-level-in-keycloak-docker-container/24299/4 "2024-01-30T17:46:51Z")

</div>

My little friend, you are missing the `_` between the words LOG and LEVEL. This is why Dasniko was mentioning `KC_LOG_LEVEL` and not `KC_LOGLEVEL`

---

<div class="post-metadata">

**Author:** ![ThoreKr](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/thorekr/32/7713_2.png) [@ThoreKr](https://forum.keycloak.org/u/ThoreKr)\
**Post date:** [January 30, 2024, 5:46pm UTC](https://forum.keycloak.org/t/setting-log-level-in-keycloak-docker-container/24299/5 "2024-01-30T17:46:54Z")

</div>

All config options (and their corresponding environment variables) are documented here: [All configuration - Keycloak](https://www.keycloak.org/server/all-config)

And - as nico pointed out - it is KC\_LOG\_LEVEL.

---

<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:** [January 30, 2024, 5:53pm UTC](https://forum.keycloak.org/t/setting-log-level-in-keycloak-docker-container/24299/6 "2024-01-30T17:53:30Z")

</div>

Thanks, guys! 🍻  
@embesozzi @ThoreKr

@tsr2:  
If you expand the various log config options, you will find the exact spelling of the environment variables. For how Keycloak can be configured, see [Configuring Keycloak - Keycloak](https://www.keycloak.org/server/configuration)  
As Keycloak can be configured independently from how it is deployed/operated, you won’t find a deployment-specific config document. No matter how Keycloak is deployed, one can use all options to configure Keycloak.  
Don’t ask Google, RTFM!

---

<div class="post-metadata">

**Author:** ![tsr2](https://avatars.discourse-cdn.com/v4/letter/t/b77776/32.png) [@tsr2](https://forum.keycloak.org/u/tsr2)\
**Post date:** [January 31, 2024, 8:36am UTC](https://forum.keycloak.org/t/setting-log-level-in-keycloak-docker-container/24299/7 "2024-01-31T08:36:27Z")

</div>

RTFM is good advice, but it’s not always easy to find the right page, I looked at the pages I expected to document it and didn’t find it in those pages. Obviously I didn’t find that page with the full list of options.  
Thank you

---

<div class="post-metadata">

**Author:** ![charden-daxicen](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/charden-daxicen/32/10974_2.png) [@charden-daxicen](https://forum.keycloak.org/u/charden-daxicen)\
**Post date:** [July 27, 2024, 2:54pm UTC](https://forum.keycloak.org/t/setting-log-level-in-keycloak-docker-container/24299/9 "2024-07-27T14:54:50Z")

</div>

This one worked for me.  
(On Docker Desktop, macOs Sonoma m2 Pro)

```auto
version: "3.8"

services:
  keycloak:
    image: quay.io/keycloak/keycloak:25.0.2
    container_name: keycloack
    command: start-dev

    ports:
      - "6001:8080"
      - "4200:4200"
     
    environment:
      KEYCLOAK_ADMIN: admin
      KEYCLOAK_ADMIN_PASSWORD: admin
      KC_LOG_LEVEL: TRACE

```

---

<div class="post-metadata">

**Author:** ![rhaycock](https://avatars.discourse-cdn.com/v4/letter/r/9de0a6/32.png) [@rhaycock](https://forum.keycloak.org/u/rhaycock)\
**Post date:** [November 27, 2024, 2:39pm UTC](https://forum.keycloak.org/t/setting-log-level-in-keycloak-docker-container/24299/10 "2024-11-27T14:39:23Z")

</div>

Hi,  
I came across this post, double clicked “KC\_LOG\_LEVEL” and copied, followed the link yet I was unable to find KC\_LOG\_LEVEL. Do the docs need updating?
