[logback-user] commons-logging -> sl4j -> logback

Kristian Lind klpcrap at gmail.com
Thu Feb 7 22:49:43 CET 2013


Thanks. I thought so.. Was just sure when using jcl-over-sl4j -> sl4j..
I will get rid of all commons-logging :)

On Thu, Feb 7, 2013 at 1:45 PM, Richard Sand <rsand at idfoundry.com> wrote:

> Hi Kristian – yes, when adding two strings together, java does that
> automatically because the new concatenated string is the actual parameter
> you are passing, so it happens before you enter the log method. By using
> the varargs calling convention, the concatenation is postponed until after
> the method is entered.
>
>
>
> Best regards,
>
>
>
> Richard Sand | Managing Director
> PO Box 91824 | Austin | Texas 78709-1824 | USA
> Office: +1 888 612 8820 ext 02 | Fax: +1 866 304 3754
> Mobile: +1 267 984 3651
>
> [image: logo - small]
>
>
>
> *From:* logback-user-bounces at qos.ch [mailto:logback-user-bounces at qos.ch] *On
> Behalf Of *Kristian Lind
> *Sent:* Thursday, February 07, 2013 4:36 PM
> *To:* logback users list
> *Subject:* Re: [logback-user] commons-logging -> sl4j -> logback
>
>
>
> And that is of cause no matter if there is sl4j behind the commons-logging
> I guess ?
>
> On Thu, Feb 7, 2013 at 1:11 PM, Brett Walker <brett.walker at geometryit.com>
> wrote:
>
> With log.debug("The object is " + object), it will always call .toString()
> on object because the string argument needs to be constructed before the
> call to .debug().
>
>
>
> To avoid this use either
>
>
>
>   If (log.isDebugEnabled()) {
>
>     Log.debug("The object is " + object);
>
>   }
>
>
>
> Or the slf/logback usage
>
>
>
>   Log.debug("The object is {0}", object);
>
>
>
> Which will delay the call to .toString() until it has determined that
> debug logging is needed.
>
>
>
> Brett
>
> Sent from my iPad
>
>
> On 08/02/2013, at 7:43 AM, "Kristian Lind" <klpcrap at gmail.com> wrote:
>
> In a previous project I switched from commons-logging -> log4j to sl4j ->
> logback.
> One of the reasons I did that was the overhead in log4j when providing a
> object in the log...
> log.debug("This is a object" + object);
> would cause the object.toString to be called even debug was not enabled.
>
> Now I work on a new project that uses commons-logging -> sl4j -> logback
> (jcl-over-slf4j)
>
> My question is now, will this still call object.toString.. even debug is
> not enabled
>
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> ....
> log.debug("This is a object" + object);
>
> I would like to get rid of commons-logging and jcl-over.sl4j and only have
> sl4j and logback.
>
>
>
>
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>
>
>
>
>
> --
> Med venlig hilsen / Best regards
>
> Kristian Lind
>
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
>



-- 
Med venlig hilsen / Best regards

Kristian Lind
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130207/c25a8fcb/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 12356 bytes
Desc: not available
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130207/c25a8fcb/attachment-0001.jpg>


More information about the Logback-user mailing list