【问题标题】:Apache commons httpclient - disable debugging / lower debuglevelApache commons httpclient - 禁用调试/降低调试级别
【发布时间】:2008-10-14 06:10:31
【问题描述】:
我在 Lotus Notes Java 代理中使用 apache commons httpclient,它工作正常。但是在建立代理连接时,日志将包含以下行:
[INFO] AuthChallengeProcessor - basic authentication scheme selected
您知道如何禁用集成日志记录或如何设置较低的调试级别吗?
它是 httpclient 本身的“功能”,因此不需要我这边的代码 :-)
谢谢。
【问题讨论】:
标签:
logging
apache-commons-httpclient
【解决方案1】:
您应该能够将日志记录级别设置为垃圾邮件较少的级别。有几个默认的logging options,所以这取决于你选择的日志记录方法。
听起来您的日志记录级别设置为“调试”或“信息”,应设置为“通知”或更高(以避免信息和低于级别警告)
【解决方案2】:
我查看了身份验证 rfc 并读到这是不使用基本身份验证的警告。所以我想我需要将身份验证更改为不以可读文本提交登录信息。
【解决方案3】:
可以设置 AuthPolicy 优先级:
... 剪辑....
client.getState().setProxyCredentials(
new AuthScope(conParm.getProxyServer(), conParm.getProxyPort()),
new UsernamePasswordCredentials(conParm.getProxyUser(), conParm.getProxyPw()));
**ArrayList authPrefs = new ArrayList(2);
authPrefs.add(AuthPolicy.DIGEST);
authPrefs.add(AuthPolicy.BASIC);
client.getParams().setParameter(AuthPolicy.AUTH_SCHEME_PRIORITY, authPrefs);
client.getParams().setParameter("http.protocol.expect-continue", new Boolean(true));**
..snapp....