struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lukasz Lenart (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4344) Improve Logging layer implementation to avoid additional boilerplate with if (LOG.isDebugEnable)
Date Mon, 12 May 2014 05:21:15 GMT

    [ https://issues.apache.org/jira/browse/WW-4344?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13994818#comment-13994818
] 

Lukasz Lenart commented on WW-4344:
-----------------------------------

The current logging facade is very good, I don't see why we should abandon it and use SLF4J
- it supports parameters substitution and user can decided what logging library to use (SLF4J,
Log4j, JDK, commons-logging). Too often I saw applications where you have SLF4J, Log4j and
commons-logging because each framework had different logging library dependency (Hibernate
4.x based on SLF4J, Hibernate 3.x on Log4j, and so on).

Leaving option which logging library to use is very good idea IMHO. This task is more about
discussing the potential impact of removing that additional check {{isDebugEnabled}} we had
added sometime ago. And as I understand it know, there is no objections and problems with
hurting performance.


> Improve Logging layer implementation to avoid additional boilerplate with if (LOG.isDebugEnable)
> ------------------------------------------------------------------------------------------------
>
>                 Key: WW-4344
>                 URL: https://issues.apache.org/jira/browse/WW-4344
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: "New" API
>    Affects Versions: 2.3.16.3
>            Reporter: Lukasz Lenart
>            Assignee: Lukasz Lenart
>              Labels: logging
>             Fix For: 2.3.18
>
>
> Instead using
> {code:java}
> if (LOG.isDebugEnable()) {
>      LOG.debug("Action name is [#0]', actionName);
> }
> {code}
> can be reduced to 
> {code:java}
> LOG.debug("Action name is [#0]', actionName);
> {code}
> with implementation in {{JdkLogger}} and any other implementation of {{Logger}} interface:
> {code:java}
> public void debug(String message, String... params) {
>     if(isDebugEnable()) {
>          // perform logging
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message