Can you look at the context of where you like to write logger.error(Throwable) and see if it is at all possible to do something with annotations there? For example, in a catch statement could you do
catch (@log UnsupportedOperationException ex) This kind of use of annotations is something I've thought about and why I created LOG4J2-33. Ralph On Sep 24, 2012, at 7:50 PM, Gary Gregory wrote: > The issue is closed so I'll comment here. > > Over all, my port to 2.0 went well, aside from some 1.2 compat issue I JIRA'd. > > Let's make a difference between binary compat and source compat. BC is no > problem, calling error(), info(), and so on with a Throwable is the same as > with 1.2. > > For SC, since you are recompiling, IMO, it is OK for a MAJOR release to be > different and print the stack trace. > > It is just so nice to say debug(Throwable) and have the right thing (IMO > again) happen. > > Having code say debug(throwable.toString(), throwable) is just... well lame :( > > The catching/throwing methods are so horribly named -- despite whatever > history of inheriting genes from other logging frameworks -- that I shiver at > the thought of using them. I had to read the Javadocs /carefully/. No big > deal, I'll just ignore them. Then I am immediately wondering how these goofy > APIs fit in with the other nicely named ones, error, warn, and so on. It's > baffling to me. Must be my tired brain and body, I just moved ;) > > Gary > > On Mon, Sep 24, 2012 at 8:38 PM, Ralph Goers <ralph.go...@dslextreme.com> > wrote: > See Log4j2-86 and Paul's concerns. > > Ralph > > On Sep 24, 2012, at 4:38 PM, Gary Gregory wrote: > >> Hi All, >> >> Most of the time, I now do: >> >> logger.error(throwable.toString(), throwable); >> >> I do this instead of >> >> logger.error(throwable.getMessage(), throwable) >> >> in case the message is null. >> >> But I'd rather simply say: >> >> logger.error(throwable) >> >> Same idea for other levels. >> >> Thoughts? >> >> Gary >> >> -- >> E-Mail: garydgreg...@gmail.com | ggreg...@apache.org >> JUnit in Action, 2nd Ed: http://bit.ly/ECvg0 >> Spring Batch in Action: 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://bit.ly/ECvg0 > Spring Batch in Action: http://bit.ly/bqpbCK > Blog: http://garygregory.wordpress.com > Home: http://garygregory.com/ > Tweet! http://twitter.com/GaryGregory