logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <ralph.go...@dslextreme.com>
Subject Re: Where is it documented that you can supply a Throwable in a varargs log message?
Date Sat, 30 Jan 2016 03:10:30 GMT
Yes, it is available in SLF4J.

Ralph

> On Jan 29, 2016, at 5:57 PM, Matt Sicker <boards@gmail.com> wrote:
> 
> Is this feature in SLF4J too? Or is it dependent on the logging
> implementation being used?
> 
>> On 29 January 2016 at 18:19, Ralph Goers <ralph.goers@dslextreme.com> wrote:
>> 
>> Yes, it is supposed to work. But like Gary I have on occasion found that
>> it does not. I am not sure why.
>> 
>> Ralph
>> 
>>> On Jan 29, 2016, at 4:57 PM, Matt Sicker <boards@gmail.com> wrote:
>>> 
>>> Remko, that's exactly the method I was thinking of. It almost seems to
>> be a
>>> hidden feature. I was arguing with a co-worker earlier today about it and
>>> he doesn't believe me that you can do this, partly because it's not
>>> documented anywhere as far as I can tell.
>>> 
>>>> On 29 January 2016 at 17:06, Remko Popma <remko.popma@gmail.com> wrote:
>>>> 
>>>> Really? I thought ParameterizedMessage took care of that: it checks that
>>>> the last param is a Throwable.
>>>> 
>>>> 
>> https://logging.apache.org/log4j/2.x/log4j-api/xref/org/apache/logging/log4j/message/ParameterizedMessage.html#L138
>>>> 
>>>> StringFormattedMessage also:
>>>> 
>> https://logging.apache.org/log4j/2.x/log4j-api/xref/org/apache/logging/log4j/message/StringFormattedMessage.html#L45
>>>> 
>>>> Does this not work correctly?
>>>> 
>>>> 
>>>> 
>>>> Sent from my iPhone
>>>> 
>>>>> On 2016/01/30, at 7:22, Gary Gregory <garydgregory@gmail.com> wrote:
>>>>> 
>>>>> That only works when you call an API that is typed with Throwable.
>>>>> 
>>>>> G
>>>>>> On Jan 29, 2016 2:11 PM, "Matt Sicker" <boards@gmail.com> wrote:
>>>>>> 
>>>>>> Why can't it log the stack trace as well? Can't you specify
>>>>>> %throwable{full} in the pattern?
>>>>>> 
>>>>>>> On 29 January 2016 at 16:00, Gary Gregory <garydgregory@gmail.com>
>>>> wrote:
>>>>>>> 
>>>>>>> What is misleading IMO is that the var arg API will NOT log the
stack
>>>>>>> trace.
>>>>>>> 
>>>>>>> There is no way to log with a message template, args, and also
an
>>>>>>> exception.
>>>>>>> 
>>>>>>> This bites me from time to time.
>>>>>>> 
>>>>>>> What I need is an API that looks like this:
>>>>>>> 
>>>>>>> Logger.debug(ex, "blah {} {}", arg1, arg2):
>>>>>>> 
>>>>>>> Gary
>>>>>>>> On Jan 29, 2016 1:28 PM, "Matt Sicker" <boards@gmail.com>
wrote:
>>>>>>>> 
>>>>>>>> Like when you do logger.debug("{}", foo, ex). I know it's
supported,
>>>>>> but
>>>>>>> I
>>>>>>>> can't find anywhere that this is mentioned.
>>>>>>>> 
>>>>>>>> --
>>>>>>>> Matt Sicker <boards@gmail.com>
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> --
>>>>>> Matt Sicker <boards@gmail.com>
>>>>>> 
>>>> 
>>> 
>>> 
>>> 
>>> --
>>> Matt Sicker <boards@gmail.com>
>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-user-help@logging.apache.org
>> 
>> 
> 
> 
> -- 
> Matt Sicker <boards@gmail.com>


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message