[slf4j-dev] [Bug 70] " logging a stack trace along with a parameterized string" solution proposal

bugzilla-daemon at pixie.qos.ch bugzilla-daemon at pixie.qos.ch
Sun Feb 10 14:52:55 CET 2008


http://bugzilla.slf4j.org/show_bug.cgi?id=70





------- Comment #8 from joern at huxhorn.de  2008-02-10 14:52 -------
(In reply to comment #7)
> (In reply to comment #4)
> > Considering that message formatting is just a trick to improve performance,
> > there is no real performance loss in writing:
> > 
> > } catch(Exception e) {
> >  logger.error("Problem saying hello to " + name, e); 
> > }
> > 
> > instead of 
> > 
> > } catch(Exception e) {
> >  logger.error("Problem saying hello to {}", name, e); 
> > }
> 
> I think its more about writability and readability of the code:
> 
> } catch(Exception e) {
>     log.error("No row with id '{}' found", e, id);
> }
> 
> } catch(Exception e) {
>     log.error("No row with id '" + id + "' found", e, id);
> }
> 

Should the above code look like this

} catch(Exception e) {
    log.error("No row with id '{}' found", id, e);
}

} catch(Exception e) {
    log.error("No row with id '" + id + "' found", e);
}

or are you suggesting that the Exception should be put before the parameters? I
wouldn't like that at all, especially because I know people expect it the other
way around...


-- 
Configure bugmail: http://bugzilla.slf4j.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the slf4j-dev mailing list