[slf4j-user] Varargs for Logger methods
Kostis Anagnostopoulos
ankostis at gmail.com
Wed Feb 22 16:54:48 CET 2006
Hi Ceki (as it seems, this conversation has become personal :) )
I'm sorry to come back on this, but i need a final anser. Look at the
end for it.
On 2/17/06, Ceki Gülcü <listid at qos.ch> wrote:
> At 10:40 AM 2/17/2006, Ceki Gülcü wrote:
> >At 12:55 AM 2/17/2006, Kostis Anagnostopoulos wrote:
> >>On 2/16/06, Ceki Gülcü <listid at qos.ch> wrote:
> >> > ...
> I am not keen on adding debug(Throwable, String, Object...) to the logger
> interface for two reasons.
>
> 1) In my opinion the parameterized+exception log can be broken in two two
> separate log messages.
Wel, there is a problem In EJBs, that run in JEE App servers many
instances at the same time, the logs might end up very disperate one
from the other in the log files.
> 2) I would like to avoid adding yet another overloaded printing method to
> the Logger interface. Each new signature means 8 (=4*2) new methods. There
> are 4 levels and for each level there are methods with and without markers.
Indeed.
>
> I generally agree that the current API is not 100% consistent. However,
> that is partially due to the fact that logging systems view exceptions as a
> special parameter meriting special treatment.
>
> In a relatively futuristic scenario where your custom event handling rules
> required you to combine the exception and the parameters in a single event,
> you could write:
>
> logger.error(MyMarkers.EXCETION_AS_PARAM,
> "While fiddling with nose using {} got an exception {}",
> myIndex,
> etiquetteExcetion);
>
> A logging system with marker support could take notice of the
> EXCETION_AS_PARAM marker to print the stack trace for "etiquetteExcetion".
But at the above form it is not obvious whether to include the stack
trace or not.
It would be much better to have the Throwable as the before the msg
and not requiring the '{}' to exists in the message!
-------
Any way, are you absolutely definitive that there can't be, at this
stage, any modification to the API as i proposed (swaping the
Throwable argument BEFORE the msg string agg) ?
Tnakh you for yor answers all this time,
ankostis
> Ceki Gülcü
>
> _______________________________________________
> user mailing list
> user at slf4j.org
> http://slf4j.org/mailman/listinfo/user
>
More information about the slf4j-user
mailing list