jboss 的 Keycloak 调试级别日志杂乱无章
Keycloak debug level logs with jboss are cluttered
我正在使用 jboss/keycloak:15.0.2
。为了符合安全要求,我需要启用 DEBUG 级别的日志来记录用户登录的成功消息。 docker 撰写配置看起来像
loginservice:
image: my-image
environment:
- KEYCLOAK_IMPORT=/tmp/realm-export-deploy.json
- KEYCLOAK_USER=admin
- KEYCLOAK_LOGLEVEL=DEBUG
- KEYCLOAK_PASSWORD_FILE=/run/secrets/loginadmin
- SYS_PROPS=-Dkeycloak.migration.strategy=IGNORE_EXISTING
- PROXY_ADDRESS_FORWARDING=true
- KEYCLOAK_FRONTEND_URL=https://servername.net/keycloak/auth
ports:
- 7070:8080
但是,一旦服务启动,日志就会因
的重复消息而变得混乱
08:00:30,986 DEBUG [org.keycloak.services.scheduled.ScheduledTaskRunner] (Timer-2) Executed scheduled task AbstractLastSessionRefreshStoreFactory$$Lambda97/0x0000000841707840
08:00:35,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) new JtaTransactionWrapper
08:00:35,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) was existing? false
08:00:35,985 DEBUG [org.keycloak.models.sessions.infinispan.changes.sessions.PersisterLastSessionRefreshStore] (Timer-2) Updating 0 userSessions with lastSessionRefresh: 1639123175
08:00:35,986 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper commit
08:00:35,986 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper end
08:00:35,986 DEBUG [org.keycloak.services.scheduled.ScheduledTaskRunner] (Timer-2) Executed scheduled task AbstractLastSessionRefreshStoreFactory$$Lambda97/0x0000000841707840
08:00:40,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) new JtaTransactionWrapper
08:00:40,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) was existing? false
08:00:40,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper commit
08:00:40,986 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper end
08:00:40,986 DEBUG [org.keycloak.services.scheduled.ScheduledTaskRunner] (Timer-2) Executed scheduled task AbstractLastSessionRefreshStoreFactory$$Lambda97/0x0000000841707840
08:00:45,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) new JtaTransactionWrapper
08:00:45,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) was existing? false
08:00:45,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper commit
08:00:45,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper end
我从keycloak启用的事件UI:
知道混乱是怎么回事吗?如何禁用它?
您不需要为所有 Keycloak 包启用 DEBUG 日志。只需为 org.keycloak.events
启用它就足够了。这可以通过将此 JBOSS 启动脚本添加到 Keycloak 容器来完成:
embed-server --server-config=standalone-ha.xml
/subsystem=logging/logger=org.keycloak.events/:add(category=org.keycloak.events,level=DEBUG)
stop-embedded-server
这将捕获日志中的大部分相关事件。
我正在使用 jboss/keycloak:15.0.2
。为了符合安全要求,我需要启用 DEBUG 级别的日志来记录用户登录的成功消息。 docker 撰写配置看起来像
loginservice:
image: my-image
environment:
- KEYCLOAK_IMPORT=/tmp/realm-export-deploy.json
- KEYCLOAK_USER=admin
- KEYCLOAK_LOGLEVEL=DEBUG
- KEYCLOAK_PASSWORD_FILE=/run/secrets/loginadmin
- SYS_PROPS=-Dkeycloak.migration.strategy=IGNORE_EXISTING
- PROXY_ADDRESS_FORWARDING=true
- KEYCLOAK_FRONTEND_URL=https://servername.net/keycloak/auth
ports:
- 7070:8080
但是,一旦服务启动,日志就会因
的重复消息而变得混乱08:00:30,986 DEBUG [org.keycloak.services.scheduled.ScheduledTaskRunner] (Timer-2) Executed scheduled task AbstractLastSessionRefreshStoreFactory$$Lambda97/0x0000000841707840
08:00:35,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) new JtaTransactionWrapper
08:00:35,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) was existing? false
08:00:35,985 DEBUG [org.keycloak.models.sessions.infinispan.changes.sessions.PersisterLastSessionRefreshStore] (Timer-2) Updating 0 userSessions with lastSessionRefresh: 1639123175
08:00:35,986 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper commit
08:00:35,986 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper end
08:00:35,986 DEBUG [org.keycloak.services.scheduled.ScheduledTaskRunner] (Timer-2) Executed scheduled task AbstractLastSessionRefreshStoreFactory$$Lambda97/0x0000000841707840
08:00:40,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) new JtaTransactionWrapper
08:00:40,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) was existing? false
08:00:40,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper commit
08:00:40,986 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper end
08:00:40,986 DEBUG [org.keycloak.services.scheduled.ScheduledTaskRunner] (Timer-2) Executed scheduled task AbstractLastSessionRefreshStoreFactory$$Lambda97/0x0000000841707840
08:00:45,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) new JtaTransactionWrapper
08:00:45,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) was existing? false
08:00:45,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper commit
08:00:45,985 DEBUG [org.keycloak.transaction.JtaTransactionWrapper] (Timer-2) JtaTransactionWrapper end
我从keycloak启用的事件UI:
知道混乱是怎么回事吗?如何禁用它?
您不需要为所有 Keycloak 包启用 DEBUG 日志。只需为 org.keycloak.events
启用它就足够了。这可以通过将此 JBOSS 启动脚本添加到 Keycloak 容器来完成:
embed-server --server-config=standalone-ha.xml
/subsystem=logging/logger=org.keycloak.events/:add(category=org.keycloak.events,level=DEBUG)
stop-embedded-server
这将捕获日志中的大部分相关事件。