[slf4j-dev] Why no error(Throwable) on the Logger interface?

Thorbjoern Ravn Andersen ravn at runjva.com
Sun May 31 23:32:05 CEST 2009


Robert Elliot skrev:
> Just curious about this - I often find myself catching an exception 
> and not really having anything to say about it other than that I want 
> to log the exception.  So I end up calling log.error(ex.getMessage(), 
> ex) - which seems a bit redundant as I'll get the message out anyway.
If you don't have anything to say, then why not just use

    log.error("", ex)

?

In my experience though there is usually always SOME information to add 
which will help the person assigned to fix it.  Personally I try to put 
information so the person given only the stack trace will not have to 
open the source to look at it.  I have been in a situation all too often 
where the user reports only the stack trace (because the web page tells 
them to:) and you need to decide where to go from there.  The more 
information the better :)

In _MY_ opinion :)

-- 
  Thorbjørn Ravn Andersen  "...plus... Tubular Bells!"




More information about the slf4j-dev mailing list