Adopt SLF4J to avoid expensive logging
--------------------------------------
Key: JBSEAM-3748
URL:
https://jira.jboss.org/jira/browse/JBSEAM-3748
Project: Seam
Issue Type: Feature Request
Components: Core
Affects Versions: 2.1.1.CR1
Reporter: Anthony Whitford
Please consider adopting SLF4J as the core logging facade over Apache Commons Logging.
When used properly, SLF4J provides improved performance and readability:
Using ACL, evaluation of the logging messages still occur unless they are wrapped using
code guards. For example, the following statement:
log.debug("found in method context: " + name);
still fragments memory by constructing the debug message even if debug is not enabled.
The developer must use a code guard like:
if ( log.isDebugEnabled() ) log.debug("found in method context: " + name);
The guard will help circumvent the evaluation of the debug message, but the developer
needs to take the initiative to add the code guard and this adds cyclomatic complexity.
See:
http://commons.apache.org/logging/commons-logging-1.1.1/guide.html#JCL%20...
With SLF4J, the above can be simplified to:
log.debug("found in method context: {}", name);
The framework will delay evaluation of the debug message until after it checks if debug is
enabled. If it is not, the message is not constructed, saving memory, and with limited
hassle on the developer.
Lazy programmers tend to avoid adding the code guards, especially when there is limited
logging. SLF4J provides an opportunity to be efficient with less hassle. I would really
like to see Seam adopt it as their core logging framework. (With the emphasis on
performance, the 2.1 branch seems like a good opportunity.)
Note that Hibernate has already adopted SLF4J.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira