Could we please make the method above protected (rather than private). This
makes it very simple to do something like this:
@Override
protected IRequestLogger newRequestLogger() {
return new RequestLogger() {
@Override
protected void log(RequestData rd, SessionData sd) {
// do my custom logging HERE
}
};
}
ALSO - it would be real nice if at the same time you extract that creation
of the AppendingStringBuffer to a method, so that the log method now looks
like:
protected void log(RequestData rd, SessionData sd)
{
if (log.isInfoEnabled())
{
log.info(createStringBuffer(rd, sd, true);
}
}
protected final void createStringBuffer(RequestData rd, SessionData sd,
boolean includeRuntimeInfo)
{
... all of the stuff that was taken out of log that creates the ASB
if (includeRuntimeInfo)
{
Runtime runtime = Runtime.getRuntime();
long max = runtime.maxMemory() / 1000000;
long total = runtime.totalMemory() / 1000000;
long used = total - runtime.freeMemory() / 1000000;
asb.append(",maxmem=");
asb.append(max);
asb.append("M,total=");
asb.append(total);
asb.append("M,used=");
asb.append(used);
asb.append("M");
}
return asb;
}
--
Jeremy Thomerson
http://www.wickettraining.com