You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@wicket.apache.org by Jeremy Thomerson <je...@wickettraining.com> on 2008/11/20 00:31:54 UTC
please make RequestLogger.log(RequestData, SessionData) protected
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
Re: please make RequestLogger.log(RequestData, SessionData) protected
Posted by Jeremy Thomerson <je...@wickettraining.com>.
https://issues.apache.org/jira/browse/WICKET-1946
Patch is attached - just needs to be reviewed / applied.
Thanks!
--
Jeremy Thomerson
http://www.wickettraining.com
On Thu, Nov 20, 2008 at 9:24 AM, Johan Compagner <jc...@gmail.com>wrote:
> Please make a case then i will do this when i am home (and dont forget it)
>
> On 11/20/08, Jeremy Thomerson <je...@wickettraining.com> wrote:
> > 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
> >
>
Re: please make RequestLogger.log(RequestData, SessionData) protected
Posted by Johan Compagner <jc...@gmail.com>.
Please make a case then i will do this when i am home (and dont forget it)
On 11/20/08, Jeremy Thomerson <je...@wickettraining.com> wrote:
> 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
>