You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by bu...@apache.org on 2005/01/04 17:22:24 UTC

DO NOT REPLY [Bug 32937] New: - Replace commons-logging by UGLI

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=32937>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=32937

           Summary: Replace commons-logging by UGLI
           Product: HttpClient
           Version: 3.0 Beta 1
          Platform: PC
               URL: http://logging.apache.org/log4j/docs/ugli.html
        OS/Version: Windows 2000
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Commons HttpClient
        AssignedTo: httpclient-dev@jakarta.apache.org
        ReportedBy: ortwin.glueck@nose.ch


As soon as Log4J 1.3 is available a move to UGLI is possible.
This would improve Log performance with Log4J and render cleaner logging code at
the same time.

Ceki writes:
Since the org.apache.log4j.Logger class is a direct implementation of
org.apache.ugli.ULogger interface, there is no need to wrap a log4j
Logger to conform to the UGLI interface. Log4j Loggers are already
ULoggers. It follows that the objects returned by
o.a.ugli.LoggerFactory.getLogger("x") are identical to those returned
by o.a.log4j.Logger.getLogger("x").

Thus, using UGLI in conjunction with log4j will not carry any overhead
whatsoever.

As noted in my previous message, UGLI also supports parameterized log
messages obliterating the need to surround log messages with
logger.isXXXEnabled checks.

Instead of writing:

  if(logger.isDebugEnabled()) {
    logger.debug("User with "+id+" entered wrong query string ["+query"]." );
  }

you can just write:

  logger.debug("User with {} entered wrong query string [{}].", id, query);

Give or take a nano-second, when the log statement is disabled, both
forms perform equally well but the second form is easier to read and
to write.

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org