How to handle Red Hat build of Keycloak logging ?

Solution Verified - Updated

Environment

  • Red Hat build of Keycloak
    • 22 and later

Issue

How to handle Red Hat build of Keycloak logging ?

Resolution

1. How to use Red Hat build of Keycloak logging

Red Hat build of Keycloak logging is configuration parameter.

It can be provided on the command line or provided as environment variable:

Command line:

bin/kc.sh start-dev --log-level=org.keycloak:TRACE

Environment variable:

File keycloak.conf

log-level=org.keycloak:TRACE

1.1 Red Hat build of Keycloak Operator

CR Keycloak:

spec:
  additionalOptions:
    - name: log-level
      value: 'INFO,org.keycloak:TRACE'

2. verifying log level

It is possible to check the current log level using the command kc.sh show-config

$ kc.sh show-config

Current Mode: development
Current Configuration:
	kc.cache =  local (PersistedConfigSource)
	kc.config.built =  true (SysPropConfigSource)
	kc.db =  dev-file (PersistedConfigSource)
	kc.hostname-strict =  false 
...
...
	kc.log-level =  org.keycloak:TRACE (PropertiesConfigSource[source=file:<rhb-install-dir>/conf/keycloak.conf])
...
...
	kc.version =  22.0.8.redhat-00001 (SysPropConfigSource)

3. Adjusting log level dynamically

It is currently not possible to adjust the Red Hat build of Keycloak log dynamically.

To change Red Hat build of Keycloak log level, you have to update Red Hat build of Keycloak config file, or the command line.

This issue is also tracked in JIRA This content is not included.RHBK-789 - Not possible to adjust log level dynamically

Components
Category
Tags

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.