On Wed, Feb 2, 2011 at 9:35 PM, Kathiravelu Pradeeban <[email protected]>wrote:

>
>
> On Wed, Feb 2, 2011 at 9:28 PM, Tharindu Mathew <[email protected]> wrote:
>
>> These sort of logs should be at the debug level. Please pay attention to
>> the level of your log:
>>
>> if (log.isInfoEnabled()) {
>>                 log.info("BAM Core bundle is activated");
>>
>
> +1.
>
> Moreover
> if (log.isInfoEnabled()) check above is pretty redundant and overdoing,
> which should better be followed only for the log.isDebugEnabled(), I feel.
>

Actually, here is what it is for.

if (log.isInfoEnabled()) {
    log.info("Blah Blah");
}

is redundant. But, it is correct in the following scenario.

if (log.isInfoEnabled()) {
    String result = fooBar();
    log.info("Blah Blah: " + result);
}

And, the following is wrong.

String result = fooBarUsedOnlyForLog();
 log.info("Blah Blah: " + result);

 In other words, if you have to do some processing before you log, you need
to check with the logger to see whether the log-level is correct, before
going ahead and doing something un-wanted.

Thanks,
Senaka.

>
>
> Thank you.
> Regards,
> Pradeeban.
>
>  }
>>
>> --
>> Regards,
>>
>> Tharindu
>>
>> _______________________________________________
>> Carbon-dev mailing list
>> [email protected]
>> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>>
>>
>
>
> --
> Kathiravelu Pradeeban.
> Software Engineer.
> WSO2 Inc.
>
> Blog: [Llovizna] http://kkpradeeban.blogspot.com/
>
>
> _______________________________________________
> Carbon-dev mailing list
> [email protected]
> http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev
>
>


-- 
*Senaka Fernando*
Product Manager - WSO2 Governance Registry;
Associate Technical Lead; WSO2, Inc.; http://wso2.com*
Member; Apache Software Foundation; http://apache.org

E-mail: senaka AT wso2.com
**P: +1 408 754 7388; ext: 51736*; *M: +94 77 322 1818
Linked-In: http://www.linkedin.com/in/senakafernando

*Lean . Enterprise . Middleware
_______________________________________________
Carbon-dev mailing list
[email protected]
http://mail.wso2.org/cgi-bin/mailman/listinfo/carbon-dev

Reply via email to