[MNG-7083] - introduce lazy Log message evaluation#438
[MNG-7083] - introduce lazy Log message evaluation#438McFoggy wants to merge 6 commits intoapache:masterfrom
Conversation
Enhance org.apache.maven.plugin.logging.Log by adding lazy java.util.function.Supplier for each log level. For each level the supplier will be called only if the corresponding log level is active. Using java 8 interface default method ensures backward compatibility with other potential implementations.
|
Initially I did not wanted to pollute |
rmannibucau
left a comment
There was a problem hiding this comment.
Two comments about the testing and default usage, otherwise looks good to me.
|
I really can't believe we are reinventing the wheel by implementing SLF4J Light. |
…Supplier and a Throwable
that's not what I understood from the different discussions. |
…em.out & System.err
|
@McFoggy it is the outcome of the discussions because slf4j is 1. unstable, 2. has no correct binding impl (it is a singleton leading to a bunch of issues in mojo when transparently exposed) 3. does not enable to switch the binding until you reimpl slf4j by design 4. is not contextual with most available impl and 5. we already reimplement slf4j and just inherit from a small API part but not the rest. I fully understand it can be surprising but it is the outcome of most vendors in most projects caring of the context and to have a pluggable logging impl so it is not that shocking after some thoughts as seen in the discussion. |
I would expect such discussions to be held with @ceki instead with just us. |
…face introduction of an AbstractLog clas sto share default methods implementations
|
FYI ICLA received & handled by Apache secretary, signed CLAs list updated (https://people.apache.org/unlistedclas.html) |
|
If asked for, I will squash the commits. |
|
I'd like to see how much we can improve our core code with these changes |
|
I really don't think we want to invent new logging API. Let me explain:
Still, as plugin realms are "self first", I think plugin developers are able to solve Mojo (and their component, rolled by own or imported from foreign projects a dependencies) using any logging API they want. Considering all this above, I'd rather expect to make Mojo Logger "closer" to slf4j-api, not only to simplify our work (to adapt slf4j logger to Mojo Logger), but also as sl4j logger is lazy as well, without any extra code. As in case of Mojo Logger, our wrapper will protect users of Mojo logger from sl4j-api incompatibilities (is provided at runtime by Maven Core). |
|
Proposal to supersede this #565 |
|
This pull request is stale because it has been waiting for feedback for 60 days. Remove the stale label or comment on this PR, or it will be automatically closed in 30 days. |
|
This pull request has been closed because no response was received within 90 days. |
|
Resolve #8370 |
as discussed in the dev mailing list [1][2] this PR enhances org.apache.maven.plugin.logging.Log by adding a lazy log method with a
java.util.function.Supplierfor each log level.For each level the supplier will be called only if the corresponding log level is active.
Using java 8 interface default method ensures backward compatibility with other potential existing implementations.
Following this checklist to help us incorporate your
contribution quickly and easily:
for the change (usually before you start working on it). Trivial changes like typos do not
require a JIRA issue. Your pull request should address just this issue, without
pulling in other changes.
[MNG-XXX] - Fixes bug in ApproximateQuantiles,where you replace
MNG-XXXwith the appropriate JIRA issue. Best practiceis to use the JIRA issue title in the pull request title and in the first line of the
commit message.
mvn clean verifyto make sure basic checks pass. A more thorough check willbe performed on your pull request automatically.
Still two unrelatd ITs tests are failing locally
If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.
To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.
I hereby declare this contribution to be licenced under the Apache License Version 2.0, January 2004
In any other case, please file an Apache Individual Contributor License Agreement.