如何调试 tomcat LDAP 领域查询

How to debug tomcat LDAP realm queries

我有一个 tomcat 领域设置,它可以很好地验证用户身份,但它似乎没有正确提取组成员资格。有什么方法可以将调试信息添加到某些日志中吗?

我假设我可能需要在某处添加一些 log-4-j 配置,但我不确定在哪里查看。

所有文档都说:

Debugging and exception messages logged by a Realm will be recorded by the logging configuration associated with the container for the realm: its surrounding Context, Host, or Engine.

谢谢

来自here

Solution: You have to edit the $CATALINA_HOME/conf/logging.properties file.

  1. Configure debug logging for Realms and Authentication Insert the following lines (in blue):
############################################################
# Facility specific properties.
# Provides extra control for each logger.
############################################################
# This would turn on trace-level for everything
# the possible levels are: SEVERE, WARNING, INFO, CONFIG, FINE, FINER, FINEST or ALL
#org.apache.catalina.level = ALL
#org.apache.catalina.handlers = 2localhost.org.apache.juli.FileHandler
org.apache.catalina.realm.level = ALL
org.apache.catalina.realm.useParentHandlers = true
org.apache.catalina.authenticator.level = ALL
org.apache.catalina.authenticator.useParentHandlers = true

org.apache.catalina.core.ContainerBase.[Catalina].[localhost].level = INFO
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].handlers = 2localhost.org.apache.juli.FileHandler

This will give you debug/trace level logging to console and the file assuming you've kept the default config. But you only see debug in the console, not the catalina.[date yyyy-MM-dd].log file - in fact, the log file empty? The buffering means the file-logging is only written when the buffer is full.