You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openwebbeans.apache.org by Mark Struberg <st...@yahoo.de> on 2010/09/23 16:14:44 UTC

[DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"

hoi!

Just for cleaning this up finally.

Our InterceptorHandler contains a log.trace with the following wording:
> logger.trace("Calling method on proxy is restricted except Object.toString(), but current method is Object. [{0}]", methodName);

Is this really a problematic situation?

I mean this ALWAYS happens if a bean gets stored in a Map or any other situation where equals() or hashCode() is being invoked.

I'd strongly favour to remove this logging.

LieGrue,
strub


      

Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"

Posted by Mark Struberg <st...@yahoo.de>.
Yes, exactly! The isLogEnabled might also cause a slowdown if called millions of times. This effect gets worse if some logging-bridge is involved. In geronimo where pax-logging is used it degrades mentionable. And when used with a JavaUtilLoggingToCommonsLogging bridge, the effect is even worse. 

I think before we log something, we should make sure that we all have the same understanding about _why_ the invoked call is problematic.

LieGrue,
strub

--- On Thu, 9/23/10, Gurkan Erdogdu <gu...@yahoo.com> wrote:

> From: Gurkan Erdogdu <gu...@yahoo.com>
> Subject: Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"
> To: dev@openwebbeans.apache.org
> Date: Thursday, September 23, 2010, 3:08 PM
> Hello Mark,
> 
> Point is that if we do not log the call (as trace level),
> if any problem occurs 
> how a developer could find an issue related with calling
> hashCode or equals on 
> proxy! Log level is trace, therefore it will not log if the
> level is not trace. 
> 
> 
> Do you think that just calling if(logger.wblWillLogTrace())
> will decrease 
> performance as visible ? Do you evaulate the performance
> with/without this 
> statement?
> 
> Situation is the same for all proxy based techonlogies.
> Then, don't we use 
> loggers on proxy based frameworks?
> 
> Thanks;
> 
> 
> Gurkan
> 
> 
> 
> ----- Original Message ----
> From: Mark Struberg <st...@yahoo.de>
> To: dev@openwebbeans.apache.org
> Sent: Thu, September 23, 2010 5:14:44 PM
> Subject: [DISCUSS] remove logging for "Calling method on
> proxy is restricted 
> except Object.toString()"
> 
> hoi!
> 
> Just for cleaning this up finally.
> 
> Our InterceptorHandler contains a log.trace with the
> following wording:
> > logger.trace("Calling method on proxy is restricted
> except Object.toString(), 
> >but current method is Object. [{0}]", methodName);
> 
> Is this really a problematic situation?
> 
> I mean this ALWAYS happens if a bean gets stored in a Map
> or any other situation 
> where equals() or hashCode() is being invoked.
> 
> I'd strongly favour to remove this logging.
> 
> LieGrue,
> strub
> 
> 
> 


      

Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"

Posted by Gurkan Erdogdu <gu...@yahoo.com>.
Hello Mark,

Point is that if we do not log the call (as trace level), if any problem occurs 
how a developer could find an issue related with calling hashCode or equals on 
proxy! Log level is trace, therefore it will not log if the level is not trace. 


Do you think that just calling if(logger.wblWillLogTrace()) will decrease 
performance as visible ? Do you evaulate the performance with/without this 
statement?

Situation is the same for all proxy based techonlogies. Then, don't we use 
loggers on proxy based frameworks?

Thanks;


Gurkan



----- Original Message ----
From: Mark Struberg <st...@yahoo.de>
To: dev@openwebbeans.apache.org
Sent: Thu, September 23, 2010 5:14:44 PM
Subject: [DISCUSS] remove logging for "Calling method on proxy is restricted 
except Object.toString()"

hoi!

Just for cleaning this up finally.

Our InterceptorHandler contains a log.trace with the following wording:
> logger.trace("Calling method on proxy is restricted except Object.toString(), 
>but current method is Object. [{0}]", methodName);

Is this really a problematic situation?

I mean this ALWAYS happens if a bean gets stored in a Map or any other situation 
where equals() or hashCode() is being invoked.

I'd strongly favour to remove this logging.

LieGrue,
strub



Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"

Posted by Mark Struberg <st...@yahoo.de>.
Oki, talked with Marius and Pete. Weld invokes Object.class methods 1:1 on the underlying instance, exactly as we do. So I'd really just remove the log here.

What we _could_ do is to log a WARN if someone puts an InterceptorBinding annotation on a Object.class method like toString() or hashCode()!

wdyt?

LieGrue,
strub

--- On Thu, 9/23/10, Mark Struberg <st...@yahoo.de> wrote:

> From: Mark Struberg <st...@yahoo.de>
> Subject: Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"
> To: dev@openwebbeans.apache.org
> Date: Thursday, September 23, 2010, 3:38 PM
> Guess then I'll need to ask Pete or
> Gavin about what they meant with it. Because I don't think
> that it will do any harm for hashCode() and equals().
> Of course, the resolved contextual instance may change. But
> hashCode and equals may change also if the instances get
> changed by another thread...
> 
> LieGrue,
> strub
> 
> --- On Thu, 9/23/10, Joseph Bergmark <be...@apache.org>
> wrote:
> 
> > From: Joseph Bergmark <be...@apache.org>
> > Subject: Re: [DISCUSS] remove logging for "Calling
> method on proxy is restricted except Object.toString()"
> > To: dev@openwebbeans.apache.org
> > Date: Thursday, September 23, 2010, 3:09 PM
> > I don't interpret that sentence in
> > quite the same way.
> > 
> > When it says "portable applications should not invoke
> any
> > method
> > declared by java.lang.Object, except for toString(),
> on a
> > client
> > proxy", I read that to say that this is behavior that
> the
> > spec decided
> > it couldn't define, so they are basically telling the
> user
> > not to do
> > it because they risk being broken.
> > 
> > It does appear to leave the behavior up to the
> > implementation though.
> > 
> > Sincerely,
> > 
> > Joe
> > 
> > On Thu, Sep 23, 2010 at 10:43 AM, Mark Struberg <st...@yahoo.de>
> > wrote:
> > >> The behavior of all methods declared by
> > java.lang.Object,
> > >> except for
> > >> toString(), is undefined for a client proxy.
> > Portable
> > >> applications
> > >> should not invoke any method declared by
> > java.lang.Object,
> > >> except for
> > >> toString(), on a client proxy.
> > >
> > > I'm reading this as "we should not allow the
> > interception of Object methods", because equals() and
> > hashCode() are really important to use.
> > >
> > > LieGrue,
> > > strub
> > >
> > > --- On Thu, 9/23/10, Eric Covener <co...@gmail.com>
> > wrote:
> > >
> > >> From: Eric Covener <co...@gmail.com>
> > >> Subject: Re: [DISCUSS] remove logging for
> "Calling
> > method on proxy is restricted except
> Object.toString()"
> > >> To: dev@openwebbeans.apache.org
> > >> Date: Thursday, September 23, 2010, 2:34 PM
> > >> On Thu, Sep 23, 2010 at 10:31 AM,
> > >> Mark Struberg <st...@yahoo.de>
> > >> wrote:
> > >> > I generally doubt that this is
> > undefined/unintended!
> > >> >
> > >>
> > >> I thought this trace message and thread were
> in
> > regards to
> > >> this rule
> > >> on contextual references:
> > >>
> > >>
> > >> 5.4.2. Client proxy invocation
> > >>
> > >> Every time a method of the bean is invoked
> upon a
> > client
> > >> proxy, the
> > >> client proxy must:
> > >>
> > >> obtain a contextual instance of the bean, as
> > defined in
> > >> Section 6.5.2,
> > >> “Contextual instance of a bean”, and
> > >>
> > >> invoke the method upon this instance.
> > >>
> > >> If the scope is not active, as specified in
> > Section 6.5.1,
> > >> “The active
> > >> context object for a scope”, the client
> proxy
> > rethrows
> > >> the
> > >> ContextNotActiveException or
> > IllegalStateException.
> > >>
> > >> The behavior of all methods declared by
> > java.lang.Object,
> > >> except for
> > >> toString(), is undefined for a client proxy.
> > Portable
> > >> applications
> > >> should not invoke any method declared by
> > java.lang.Object,
> > >> except for
> > >> toString(), on a client proxy.
> > >>
> > >>
> > >>
> > >> --
> > >> Eric Covener
> > >> covener@gmail.com
> > >>
> > >
> > >
> > >
> > >
> > 
> 
> 
> 
> 


      

Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"

Posted by Mark Struberg <st...@yahoo.de>.
Guess then I'll need to ask Pete or Gavin about what they meant with it. Because I don't think that it will do any harm for hashCode() and equals().
Of course, the resolved contextual instance may change. But hashCode and equals may change also if the instances get changed by another thread...

LieGrue,
strub

--- On Thu, 9/23/10, Joseph Bergmark <be...@apache.org> wrote:

> From: Joseph Bergmark <be...@apache.org>
> Subject: Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"
> To: dev@openwebbeans.apache.org
> Date: Thursday, September 23, 2010, 3:09 PM
> I don't interpret that sentence in
> quite the same way.
> 
> When it says "portable applications should not invoke any
> method
> declared by java.lang.Object, except for toString(), on a
> client
> proxy", I read that to say that this is behavior that the
> spec decided
> it couldn't define, so they are basically telling the user
> not to do
> it because they risk being broken.
> 
> It does appear to leave the behavior up to the
> implementation though.
> 
> Sincerely,
> 
> Joe
> 
> On Thu, Sep 23, 2010 at 10:43 AM, Mark Struberg <st...@yahoo.de>
> wrote:
> >> The behavior of all methods declared by
> java.lang.Object,
> >> except for
> >> toString(), is undefined for a client proxy.
> Portable
> >> applications
> >> should not invoke any method declared by
> java.lang.Object,
> >> except for
> >> toString(), on a client proxy.
> >
> > I'm reading this as "we should not allow the
> interception of Object methods", because equals() and
> hashCode() are really important to use.
> >
> > LieGrue,
> > strub
> >
> > --- On Thu, 9/23/10, Eric Covener <co...@gmail.com>
> wrote:
> >
> >> From: Eric Covener <co...@gmail.com>
> >> Subject: Re: [DISCUSS] remove logging for "Calling
> method on proxy is restricted except Object.toString()"
> >> To: dev@openwebbeans.apache.org
> >> Date: Thursday, September 23, 2010, 2:34 PM
> >> On Thu, Sep 23, 2010 at 10:31 AM,
> >> Mark Struberg <st...@yahoo.de>
> >> wrote:
> >> > I generally doubt that this is
> undefined/unintended!
> >> >
> >>
> >> I thought this trace message and thread were in
> regards to
> >> this rule
> >> on contextual references:
> >>
> >>
> >> 5.4.2. Client proxy invocation
> >>
> >> Every time a method of the bean is invoked upon a
> client
> >> proxy, the
> >> client proxy must:
> >>
> >> obtain a contextual instance of the bean, as
> defined in
> >> Section 6.5.2,
> >> “Contextual instance of a bean”, and
> >>
> >> invoke the method upon this instance.
> >>
> >> If the scope is not active, as specified in
> Section 6.5.1,
> >> “The active
> >> context object for a scope”, the client proxy
> rethrows
> >> the
> >> ContextNotActiveException or
> IllegalStateException.
> >>
> >> The behavior of all methods declared by
> java.lang.Object,
> >> except for
> >> toString(), is undefined for a client proxy.
> Portable
> >> applications
> >> should not invoke any method declared by
> java.lang.Object,
> >> except for
> >> toString(), on a client proxy.
> >>
> >>
> >>
> >> --
> >> Eric Covener
> >> covener@gmail.com
> >>
> >
> >
> >
> >
> 


      

Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"

Posted by Joseph Bergmark <be...@apache.org>.
I don't interpret that sentence in quite the same way.

When it says "portable applications should not invoke any method
declared by java.lang.Object, except for toString(), on a client
proxy", I read that to say that this is behavior that the spec decided
it couldn't define, so they are basically telling the user not to do
it because they risk being broken.

It does appear to leave the behavior up to the implementation though.

Sincerely,

Joe

On Thu, Sep 23, 2010 at 10:43 AM, Mark Struberg <st...@yahoo.de> wrote:
>> The behavior of all methods declared by java.lang.Object,
>> except for
>> toString(), is undefined for a client proxy. Portable
>> applications
>> should not invoke any method declared by java.lang.Object,
>> except for
>> toString(), on a client proxy.
>
> I'm reading this as "we should not allow the interception of Object methods", because equals() and hashCode() are really important to use.
>
> LieGrue,
> strub
>
> --- On Thu, 9/23/10, Eric Covener <co...@gmail.com> wrote:
>
>> From: Eric Covener <co...@gmail.com>
>> Subject: Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"
>> To: dev@openwebbeans.apache.org
>> Date: Thursday, September 23, 2010, 2:34 PM
>> On Thu, Sep 23, 2010 at 10:31 AM,
>> Mark Struberg <st...@yahoo.de>
>> wrote:
>> > I generally doubt that this is undefined/unintended!
>> >
>>
>> I thought this trace message and thread were in regards to
>> this rule
>> on contextual references:
>>
>>
>> 5.4.2. Client proxy invocation
>>
>> Every time a method of the bean is invoked upon a client
>> proxy, the
>> client proxy must:
>>
>> obtain a contextual instance of the bean, as defined in
>> Section 6.5.2,
>> “Contextual instance of a bean”, and
>>
>> invoke the method upon this instance.
>>
>> If the scope is not active, as specified in Section 6.5.1,
>> “The active
>> context object for a scope”, the client proxy rethrows
>> the
>> ContextNotActiveException or IllegalStateException.
>>
>> The behavior of all methods declared by java.lang.Object,
>> except for
>> toString(), is undefined for a client proxy. Portable
>> applications
>> should not invoke any method declared by java.lang.Object,
>> except for
>> toString(), on a client proxy.
>>
>>
>>
>> --
>> Eric Covener
>> covener@gmail.com
>>
>
>
>
>

Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"

Posted by Mark Struberg <st...@yahoo.de>.
> The behavior of all methods declared by java.lang.Object,
> except for
> toString(), is undefined for a client proxy. Portable
> applications
> should not invoke any method declared by java.lang.Object,
> except for
> toString(), on a client proxy.

I'm reading this as "we should not allow the interception of Object methods", because equals() and hashCode() are really important to use.

LieGrue,
strub

--- On Thu, 9/23/10, Eric Covener <co...@gmail.com> wrote:

> From: Eric Covener <co...@gmail.com>
> Subject: Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"
> To: dev@openwebbeans.apache.org
> Date: Thursday, September 23, 2010, 2:34 PM
> On Thu, Sep 23, 2010 at 10:31 AM,
> Mark Struberg <st...@yahoo.de>
> wrote:
> > I generally doubt that this is undefined/unintended!
> >
> 
> I thought this trace message and thread were in regards to
> this rule
> on contextual references:
> 
> 
> 5.4.2. Client proxy invocation
> 
> Every time a method of the bean is invoked upon a client
> proxy, the
> client proxy must:
> 
> obtain a contextual instance of the bean, as defined in
> Section 6.5.2,
> “Contextual instance of a bean”, and
> 
> invoke the method upon this instance.
> 
> If the scope is not active, as specified in Section 6.5.1,
> “The active
> context object for a scope”, the client proxy rethrows
> the
> ContextNotActiveException or IllegalStateException.
> 
> The behavior of all methods declared by java.lang.Object,
> except for
> toString(), is undefined for a client proxy. Portable
> applications
> should not invoke any method declared by java.lang.Object,
> except for
> toString(), on a client proxy.
> 
> 
> 
> -- 
> Eric Covener
> covener@gmail.com
> 


      

Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"

Posted by Eric Covener <co...@gmail.com>.
On Thu, Sep 23, 2010 at 10:31 AM, Mark Struberg <st...@yahoo.de> wrote:
> I generally doubt that this is undefined/unintended!
>

I thought this trace message and thread were in regards to this rule
on contextual references:


5.4.2. Client proxy invocation

Every time a method of the bean is invoked upon a client proxy, the
client proxy must:

obtain a contextual instance of the bean, as defined in Section 6.5.2,
“Contextual instance of a bean”, and

invoke the method upon this instance.

If the scope is not active, as specified in Section 6.5.1, “The active
context object for a scope”, the client proxy rethrows the
ContextNotActiveException or IllegalStateException.

The behavior of all methods declared by java.lang.Object, except for
toString(), is undefined for a client proxy. Portable applications
should not invoke any method declared by java.lang.Object, except for
toString(), on a client proxy.



-- 
Eric Covener
covener@gmail.com

Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"

Posted by Mark Struberg <st...@yahoo.de>.
I generally doubt that this is undefined/unintended!

Of course Object methods cannot get intercepted, but they must be delegated 1:1 through to the underlying instance. And that's exactly where this log statement sits.

LieGrue,
strub

--- On Thu, 9/23/10, Eric Covener <co...@gmail.com> wrote:

> From: Eric Covener <co...@gmail.com>
> Subject: Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"
> To: dev@openwebbeans.apache.org
> Date: Thursday, September 23, 2010, 2:25 PM
> On Thu, Sep 23, 2010 at 10:14 AM,
> Mark Struberg <st...@yahoo.de>
> wrote:
> > hoi!
> >
> > Just for cleaning this up finally.
> >
> > Our InterceptorHandler contains a log.trace with the
> following wording:
> >> logger.trace("Calling method on proxy is
> restricted except Object.toString(), but current method is
> Object. [{0}]", methodName);
> >
> > Is this really a problematic situation?
> >
> > I mean this ALWAYS happens if a bean gets stored in a
> Map or any other situation where equals() or hashCode() is
> being invoked.
> >
> > I'd strongly favour to remove this logging.
> >
> 
> I wonder if we could note it in the log once per Bean type,
> so we know
> that the app is using the undefined behavior Object
> methods.
> 
> -- 
> Eric Covener
> covener@gmail.com
> 


      

Re: [DISCUSS] remove logging for "Calling method on proxy is restricted except Object.toString()"

Posted by Eric Covener <co...@gmail.com>.
On Thu, Sep 23, 2010 at 10:14 AM, Mark Struberg <st...@yahoo.de> wrote:
> hoi!
>
> Just for cleaning this up finally.
>
> Our InterceptorHandler contains a log.trace with the following wording:
>> logger.trace("Calling method on proxy is restricted except Object.toString(), but current method is Object. [{0}]", methodName);
>
> Is this really a problematic situation?
>
> I mean this ALWAYS happens if a bean gets stored in a Map or any other situation where equals() or hashCode() is being invoked.
>
> I'd strongly favour to remove this logging.
>

I wonder if we could note it in the log once per Bean type, so we know
that the app is using the undefined behavior Object methods.

-- 
Eric Covener
covener@gmail.com