logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ralph Goers <rgo...@apache.org>
Subject Re: What's the point of logger.catching(e)?
Date Tue, 07 Jan 2014 13:21:16 GMT
I take it back. In your example I probably would have used logger.error("message", ex) and
not used the catching method.

Ralph

> On Jan 7, 2014, at 5:18 AM, Ralph Goers <rgoers@apache.org> wrote:
> 
> The way you are using it is the way it would be expected to be used.  I would only use
it to log an exception that is caught and not rethrown, but even then that usually happens
because the exception can be handled and logging it is pretty much just noise - which is why
it would be at level trace.
> 
> Ralph
> 
>> On Jan 6, 2014, at 3:40 PM, Matt Sicker <boards@gmail.com> wrote:
>> 
>> In my own projects, I was using it manually to log exactly what I thought
>> it was for. However, the method with no specified level uses Level.TRACE if
>> I recall correctly, and that level is usually disabled.
>> 
>> Anyway, is this provided more so as a method to be automatically injected
>> via bytecode manipulation (along with logger.entry(), logger.exit(),
>> logger.throwing(), etc.)? Or done manually? If done manually, you can get
>> some rather amusingly messy methods. For example, from some code I've
>> written like that:
>> 
>> <
>> https://raw.github.com/jvz/dynunit/master/src/main/java/atg/tools/dynunit/DynUnit.java
>> 
>> Anyway, I'm asking now because I don't see log4j2 even using it internally
>> where appropriate. Is this more of a personal preference thing?
>> 
>> -- 
>> 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