On Thu, Oct 4, 2012 at 10:54 PM, Ralph Goers <rgo...@apache.org> wrote:

> Yup. That is what I would expect.  However, it probably requires a Message
> that has a constructor that accepts a Throwable and an object array, which
> means we would probably want a new interface as a marker.
>

So would reflection be used at runtime to instantiate the message? Wouldn't
that be a performance hit?

We could just provide APIs in AbstractLogger for the built-in message
classes that do the instance creation w/o reflection.

Thoughts?

Gary


> Ralph
>
> Sent from my iPad
>
> On Oct 4, 2012, at 7:18 PM, Paul Benedict <pbened...@apache.org> wrote:
>
> Ooops. I meant this:
>
> logger.debug(Class<? extends Message> m, Throwable t, Object...
> messageParams);
>
> The point was to pass in the Class of the Message so it doesn't get
> instantiated unless logging is going to occur.
>
> Paul
>
> On Thu, Oct 4, 2012 at 9:12 PM, Gary Gregory <garydgreg...@gmail.com>wrote:
>
>> On Thu, Oct 4, 2012 at 10:06 PM, Paul Benedict <pbened...@apache.org>wrote:
>>
>>> On Thu, Oct 4, 2012 at 7:24 PM, Gary Gregory <garydgreg...@gmail.com>wrote:
>>>
>>>> On Thu, Oct 4, 2012 at 5:55 PM, Paul Benedict <pbened...@apache.org>wrote:
>>>>
>>>>> Ralph,
>>>>>
>>>>> This is actually a discussion you and I had a while back when I was
>>>>> trying to figure out how to use String.format(). I like the model now of
>>>>> specifying the message class... however...
>>>>>
>>>>> It does seem a bit unseemly to instantiate an xxxMessage object that
>>>>> may never get used. I'd rather just pass in the Class<?> and let the 
>>>>> logger
>>>>> instantiate it only if it is going to log something. The only downside is
>>>>> then configuring the actual class.
>>>>>
>>>>> Thoughts?
>>>>>
>>>>
>>>> So instead of:
>>>>
>>>> this.logger.debug(new StringFormattedMessage(format, values), t);
>>>>
>>>> I would do:
>>>>
>>>> this.logger.debug(StringFormattedMessage.class, t, format, values);
>>>>
>>>>
>>> I was thinking of adding this signature:
>>> logger.debug(Message m, Throwable t, Object... messageParams);
>>>
>>> Thoughts?
>>>
>>
>> Pardon me for being dense, but how does that help in the case of my
>> examples?
>>
>> Thank you in advance for clarifying,
>> Gary
>>
>>>
>>> Paul
>>>
>>
>>
>>
>> --
>> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
>> JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
>> Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
>> Blog: http://garygregory.wordpress.com
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
>>
>
>


-- 
E-Mail: garydgreg...@gmail.com | ggreg...@apache.org
JUnit in Action, 2nd Ed: <http://goog_1249600977>http://bit.ly/ECvg0
Spring Batch in Action: <http://s.apache.org/HOq>http://bit.ly/bqpbCK
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Reply via email to