Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get keycloak Server logs

We deployed keycloak server 4.6.0.Final for authentication for our web application How can i configure to get server logs? I cannot find any logs from server.log or Audit.log files. Do I need to configure any place to show the keycloak server log details.

like image 795
Kushani Karunarathne Avatar asked Sep 23 '19 10:09

Kushani Karunarathne


2 Answers

Specify log level

There are two environment variables available to control the log level for Keycloak:

  • KEYCLOAK_LOGLEVEL: Specify log level for Keycloak (optional, default is INFO)
  • ROOT_LOGLEVEL: Specify log level for underlying container (optional, default is INFO)

Supported log levels are ALL, DEBUG, ERROR, FATAL, INFO, OFF, TRACE and WARN.

Log level can also be changed at runtime, for example (assuming docker exec access):

./keycloak/bin/jboss-cli.sh --connect --command='/subsystem=logging/console-handler=CONSOLE:change-log-level(level=DEBUG)'
./keycloak/bin/jboss-cli.sh --connect --command='/subsystem=logging/root-logger=ROOT:change-root-log-level(level=DEBUG)'
./keycloak/bin/jboss-cli.sh --connect --command='/subsystem=logging/logger=org.keycloak:write-attribute(name=level,value=DEBUG)'

The content is taken from jboss/keycloak - Docker Hub.

like image 166
Asad Shakeel Avatar answered Sep 20 '22 06:09

Asad Shakeel


When starting the Keycloak instance you can pass an environment variables to set log level for Keycloak.

docker run -e KEYCLOAK_LOGLEVEL=DEBUG jboss/keycloak

For the Kubernetes Deployment:

Add the following env variable to Kuberenetes deployment manifest.

keycloak:
  extraEnv: |
    - name: KEYCLOAK_LOGLEVEL
      value: DEBUG
    - name: WILDFLY_LOGLEVEL
      value: DEBUG

More informations : https://github.com/devsu/docker-keycloak/blob/master/server/README.md

like image 43
Sanka Sathyaji Avatar answered Sep 21 '22 06:09

Sanka Sathyaji