commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <>
Subject [jira] [Commented] (LOGGING-136) API Enhancements: 'String.format(String, Object...)' Functionality & Delegate Convenience Methods
Date Wed, 13 Jul 2016 15:14:20 GMT


Gary Gregory commented on LOGGING-136:

I think Commons Logging should be deprecated in favor of Apache's own Log4j 2 logging API,
which supports Java 8 lambda calls (but only requires Java 7): I would use Log4j 2's {{log4-api}}
module and pick an suitable implementation (like Log4j's own {{log4j-core}}). Log4j 2 provides
separation between the API and different plugin implementations. Please see

With Log4j 2, you can say:
logger.trace("Some long-running operation returned {}", () -> expensiveOperation());

See and

If you want to try it, use the following in your POM instead of Commons Logging:


> API Enhancements: 'String.format(String, Object...)' Functionality & Delegate Convenience
> -------------------------------------------------------------------------------------------------
>                 Key: LOGGING-136
>                 URL:
>             Project: Commons Logging
>          Issue Type: Improvement
>    Affects Versions: 1.1.1
>         Environment: N/A
>            Reporter: Daniel Siviter
>              Labels: api, api-addition
>             Fix For: 2.0
>         Attachments: commons-logging-1.1.1-src.rar, commons-logging-1.1.1.jar, site.rar
>   Original Estimate: 4h
>  Remaining Estimate: 4h
> Improvements to the API to allow convenience methods for performing {{String.format(String,
Object...)}} and allow access to the internal logging delegate.
> Firstly, to add the {{String#format(String, Object...)}} functionality modify the methods
(note: only {{#trace(...)}} shown):
> {{void trace(Object message, Object... args);}}
> {{void trace(Object message, Throwable t, Object... args);}}
> This would allow compatiblity with previous versions of the API (although I believe they
would still require a re-compile) and help tidy up code.
> Secondly, to obtain access to the internal instance of a logger the addition of a {{#getDeletegate()}}
> I can supply the code if required.

This message was sent by Atlassian JIRA

View raw message