I think it's better to use isDebugEnabled for any debug log, even if it is using parameters for a formatted string. If the debug is not enabled, we don't even want to create the String object.
No need to assign to a final variable. Checking the condition just before logging should be enough. On Thu, Jun 9, 2016 at 3:06 PM, Afkham Azeez <az...@wso2.com> wrote: > No need to do isDebugEnabled ideally for formatted logs. > > On Thu, Jun 9, 2016 at 3:01 PM, Jayanga Kaushalya <jayan...@wso2.com> > wrote: > >> Hi, >> >> Do we need to check whether the isDebugEnabled() for formatted debug logs >> without any string concatenations? For example below code: >> >> if (log.isDebugEnabled) { >> log.debug("Test log with var: {} and var: {}", var1, var2); >> } >> >> If we have to check it is, what is the best way to check it? Assign it to >> a final variable in the class header or check it every time where their is >> a debug log like above code? >> >> Thanks! >> >> *Jayanga Kaushalya* >> Software Engineer >> Mobile: +94777860160 >> WSO2 Inc. | http://wso2.com >> lean.enterprise.middleware >> > > > > -- > *Afkham Azeez* > Director of Architecture; WSO2, Inc.; http://wso2.com > Member; Apache Software Foundation; http://www.apache.org/ > * <http://www.apache.org/>* > *email: **az...@wso2.com* <az...@wso2.com> > * cell: +94 77 3320919 <%2B94%2077%203320919>blog: * > *http://blog.afkham.org* <http://blog.afkham.org> > *twitter: **http://twitter.com/afkham_azeez* > <http://twitter.com/afkham_azeez> > *linked-in: **http://lk.linkedin.com/in/afkhamazeez > <http://lk.linkedin.com/in/afkhamazeez>* > > *Lean . Enterprise . Middleware* > > _______________________________________________ > Dev mailing list > Dev@wso2.org > http://wso2.org/cgi-bin/mailman/listinfo/dev > > -- Isuru Perera Associate Technical Lead | WSO2, Inc. | http://wso2.com/ Lean . Enterprise . Middleware about.me/chrishantha Contact: +IsuruPereraWSO2 <https://www.google.com/+IsuruPereraWSO2/about>
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev