uschindler commented on pull request #536:
URL: https://github.com/apache/solr/pull/536#issuecomment-1015287079
For the record this is how to use log4j (just some debugging example
copypasted):
```
static final class LoggingAccessLog extends AbstractLifeCycle
implements RequestLog {
private final org.apache.logging.log4j.Logger log;
public LoggingAccessLog(String logname) {
this.log =
org.apache.logging.log4j.LogManager.getLogger(logname);
}
@Override
public void log(Request req, Response resp) {
final StringBuilder line=new StringBuilder("From: ")
.append(req.getRemoteHost())
.append("; Req:
\"").append(req.getMethod()).append(' ').append(req.getRequestURI());
final String query = req.getQueryString();
if (query != null) {
line.append('?').append(query);
}
line.append(' ').append(req.getProtocol()).append("\";
Status: ").append(resp.getStatus()).append("; Bytes:
").append(resp.getContentCount());
final String
referer=req.getHeader(HttpHeader.REFERER.asString());
if (referer!=null) line.append("; Referer:
\"").append(referer).append('"');
final String
userAgent=req.getHeader(HttpHeader.USER_AGENT.asString());
if (userAgent!=null) line.append("; User-Agent:
\"").append(userAgent).append('"');
if (req.isSecure()) line.append("; secure");
log.info(line.toString());
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]