[slf4j-user] Java 5 version of SLF4J?

Christopher.White at bbh.com Christopher.White at bbh.com
Thu Apr 24 16:16:20 CEST 2008


I did know that I can parameterize up to 2 parameters, which is nice. But 
I also think that it is annoying to have to remember to change the syntax 
once you hit 3+ parameters. Along with this, it is also annoying to have 
to remember to change syntax when logging errors (cannot use paramatized 
strings). It would be nice if things were more consistent.

-Chris


Thanks,

Christopher White
Sr. Programmer
1-617-772-2403
Christopher.White at bbh.com




Ceki Gulcu <listid at qos.ch> 
Sent by: user-bounces at slf4j.org
04/24/2008 09:51 AM
Please respond to
User list for the slf4j project <user at slf4j.org>


To
User list for the slf4j project <user at slf4j.org>
cc

Subject
Re: [slf4j-user] Java 5 version of SLF4J?







Christopher.White at bbh.com wrote:
> 
> Ceki,
> 
> I do understand your reasoning, and thank you for your quick response.
> 
> And since Logback natively implements SLF4J, its API will also not be 
> changed to include any new JSE 5 features, correct? Nor will new method 
> signatures specific to just Logback be created for this (if I chose to 
> use Logback without SLF4J)?

Correct. As you stated, the logback API sits on top of SLF4J. There are no 
plans 
to change that.

> This is unfortunate for those who have been using JSE 5 for some time 
> now, and still have not been able to fully take advantage of its 
> features (especially when it comes to the work of tedious logging).

You do realize that the SLF4J API already supports parameterized logging 
up to 2 
parameters? With an SLF4J logger you can write:

Logger logger = LoggerFactory.getLogger(Wombat.class);
Integer t;
Integer oldT;
Integer expectedT;

logger.debug("Some message.");
logger.debug("Temperature set to {}", t);
logger.debug("Temperature set to {}. Old temperature was {}.", t, oldT);

However, SLF4J does not support 3 or more parameters. So, you could not 
write:

logger.debug("new={}, old={}, expected={}", t, oldT, expectedT);

You would have to write:

logger.debug("new={}, old={}, expected={}", new Integer[] {t, oldT, 
expectedT});

I believe that compared to the slight inconvenience above, breaking 
compatibility is a more serious concern.


> I was really excited about SLF4J/Logback when this project started, but 
> without these new features (which would simplify and reduce my coding 
> effort) it just doesn't seem worth it to convert to this logging 
> framework (even though I really appreciate the clean Logback 
> implementation). Perhaps Log4J 2.0 will incorporate these considerations 

> since it will be JSE 5 dependent. If it does, I'd have to bet that many 
> people will jump ship on SLF4J/Logback in favor of Log4J. It really is 
> too bad that the Logback API cannot be changed before it reaches version 

> 1.0.

You might also want to check out the slf4j-migrator [1] which may help 
with your 
migration efforts, when and if you decide to migrate to SLF4J.

[1] http://slf4j.org/migrator.html

-- 
Ceki Gülcü
QOS.ch is looking to hire talented developers in Switzerland.  If
interested, please contact c e k i AT q o s . c h

_______________________________________________
user mailing list
user at slf4j.org
http://www.slf4j.org/mailman/listinfo/user



*************************** IMPORTANT
NOTE***************************** The opinions expressed in this
message and/or any attachments are those of the author and not
necessarily those of Brown Brothers Harriman & Co., its
subsidiaries and affiliates ("BBH"). There is no guarantee that
this message is either private or confidential, and it may have
been altered by unauthorized sources without your or our knowledge.
Nothing in the message is capable or intended to create any legally
binding obligations on either party and it is not intended to
provide legal advice. BBH accepts no responsibility for loss or
damage from its use, including damage from virus.
************************************************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/slf4j-user/attachments/20080424/e0e232b9/attachment.htm>


More information about the slf4j-user mailing list