}
// 如果失败,记录日志
if (attrs.isEmpty() && encoderExceptions != null) {
if (log.isWarnEnabled()) {
ToStringBuilder buf = new ToStringBuilder();
buf.append("Failed to decode cookie value: ").append(cookieValue);
int i = 0;
for (Exception e : encoderExceptions) {
buf.format("\n Encoder #%d - %s threw %s", i + 1, encoders[i].getClass().getSimpleName(), e);
}
log.warn(buf.toString());
}
} else {
if (log.isDebugEnabled()) {
int attrCount = attrs.size();
ToStringBuilder buf = new ToStringBuilder();
buf.format("Found %d attributes:", attrCount);
if (!attrs.isEmpty()) {
buf.append(new MapBuilder().setPrintCount(true).setSortKeys(true).appendAll(attrs));
}
log.debug(buf.toString());
}
}
return attrs;
}