Re: Loging api in JSR-330 component

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: Loging api in JSR-330 component

Matthieu BROUILLARD-3
Issues MNG-7082 <https://issues.apache.org/jira/browse/MNG-7082>, MNG-7083
<https://issues.apache.org/jira/browse/MNG-7083>, MNG-7084
<https://issues.apache.org/jira/browse/MNG-7084> and MNG-7085
<https://issues.apache.org/jira/browse/MNG-7085> created for traceability.

I'll push PRs for the first two.

On Mon, Jan 25, 2021 at 11:57 AM Romain Manni-Bucau <[hidden email]>
wrote:

> For me only 1 and 4 are "strictly required" but this plan works with the
> nice to have additions.
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <https://rmannibucau.metawerx.net/> | Old Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> <
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> >
>
>
> Le lun. 25 janv. 2021 à 11:51, Matthieu Brouillard <[hidden email]
> >
> a écrit :
>
> > In order to go further on this topic, I'd like to create issues for each
> > discussed topic in this thread and probably start working on some:
> >
> > * issue-1: remove depreciation on 'org.apache.maven.plugin.logging.Log'
> > * issue-2: introduce lazy evaluation/message production for each level in
> > 'org.apache.maven.plugin.logging.Log'
> > * issue-3: enable injection of org.apache.maven.plugin.logging.Log
> >   + discuss further in the issue which implementation to inject
> where/when
> >   + document (where ?) usage for extensions & non mojo injectable classes
> > * issue-4: update 'https://maven.apache.org/maven-logging.html' (or
> > elsewhere ?) with latest recommandations
> >   + use #getLog() for mojos
> >   + use injection for other use cases
> >
> > If it is ok then I'll create those issues and start working on the 2
> first.
> > Once created people will be able to provide additional context or
> > information to each ticket.
> >
> > Matthieu
> >
> > On Mon, Jan 25, 2021 at 8:07 AM Guillaume Nodet <[hidden email]>
> wrote:
> >
> > > +1 for giving the logging API a bit of love with Supplier<String>
> and/or
> > > formatter-like api.
> > >
> > > Guillaume Nodet
> > >
> > > Le lun. 25 janv. 2021 à 07:41, Mark Struberg <[hidden email]
> >
> > a
> > > écrit :
> > >
> > > >  +1Technically from a pure ClassLoader point our very own makes more
> > > > sense.We can probably think about Lambda to resolve the String
> > > > lazily.Insofar the SLF4J api is outdated as well.
> > > > And of course internally we might still route to slf4j. But we should
> > not
> > > > expose those classes to the plugins if not necessary. They just
> > > > unnecessarily create classpatch clashes some times (been there done
> > > that).
> > > >
> > > > LieGrue,strub
> > > >
> > > >     On Saturday, 23 January 2021, 18:06:34 CET, Romain Manni-Bucau <
> > > > [hidden email]> wrote:
> > > >
> > > >  Hi Benjamin,
> > > >
> > > > Guess it was unexpectedly deprecated, let's revert that on master.
> > > >
> > > > Romain Manni-Bucau
> > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > <https://rmannibucau.metawerx.net/> | Old Blog
> > > > <http://rmannibucau.wordpress.com> | Github <
> > > > https://github.com/rmannibucau> |
> > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
> > > > <
> > > >
> > >
> >
> https://www.packtpub.com/application-development/java-ee-8-high-performance
> > > > >
> > > >
> > > >
> > > > Le sam. 23 janv. 2021 à 17:58, Benjamin Marwell <[hidden email]
> >
> > a
> > > > écrit :
> > > >
> > > > > Robert, that's deprecated! What to use instead? Or was it
> deprecated
> > in
> > > > > error?
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> https://github.com/apache/maven/blob/master/maven-plugin-api/src/main/java/org/apache/maven/plugin/logging/Log.java
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > On Sat, 23 Jan 2021, 12:10 Robert Scholte, <[hidden email]>
> > > wrote:
> > > > >
> > > > > > See
> > > > > >
> > > > >
> > > >
> > >
> >
> https://maven.apache.org/ref/3.6.3/maven-plugin-api/apidocs/org/apache/maven/plugin/AbstractMojo.html
> > > > > >
> > > > > > You can get the logger by calling getLog(), so don't inject the
> > > logger
> > > > > > here.
> > > > > >
> > > > > > Robert
> > > > > > On 22-1-2021 19:19:47, Slawomir Jaranowski <
> [hidden email]
> > >
> > > > > wrote:
> > > > > > It is not only an extension case.
> > > > > >
> > > > > > For example I can write Mojo like:
> > > > > >
> > > > > > @Mojo(name = "example")
> > > > > > public class ExampleMojo extends AbstractMojo {
> > > > > >
> > > > > > @Inject
> > > > > > private MyService myService;
> > > > > >
> > > > > > @Override
> > > > > > public void execute() {
> > > > > > }
> > > > > > }
> > > > > >
> > > > > > and
> > > > > >
> > > > > > @Named
> > > > > > public class MyService {
> > > > > >
> > > > > > @Inject
> > > > > > private Logger??? logger;
> > > > > > }
> > > > > >
> > > > > > So the question is what logger we should use in the component?
> > > > > >
> > > > > > Another case is that components can be Singleton and their
> instance
> > > > will
> > > > > be
> > > > > > created once.
> > > > > >
> > > > > >
> > > > > > pt., 22 sty 2021 o 12:36 Romain Manni-Bucau
> > > > > > napisał(a):
> > > > > >
> > > > > > > Do it means if we represent our classloading structure, all
> > loaders
> > > > on
> > > > > > top
> > > > > > > of mojo use slf4j and others our maven abstraction.
> > > > > > > Sounds ok to me except for extensions which are not in maven
> land
> > > so
> > > > > > > subject to slf4j api breaking changes and undefined/ambiguous
> > > > context -
> > > > > > > which is never true for maven code itself since we guarantee
> and
> > > own
> > > > > it.
> > > > > > > Should we promote the abstraction for extensions too?
> > > > > > >
> > > > > > > Le ven. 22 janv. 2021 à 11:41, Robert Scholte a
> > > > > > > écrit :
> > > > > > >
> > > > > > > > I'm not so sure about this, it probably depends on the
> context.
> > > > > > > >
> > > > > > > > I think we should assume that JSR330 component are not aware
> of
> > > > their
> > > > > > > > context.
> > > > > > > > They should not require a Maven context, hence in such case
> it
> > > > makes
> > > > > > > sense
> > > > > > > > to use SLF4J API, while the application selects the logger
> > > > > > > implementation.
> > > > > > > > Think of Maven Extensions. I'd say they should be using the
> > SLF4J
> > > > API
> > > > > > > > because their context is not bound to 1 plugin.
> > > > > > > >
> > > > > > > > thanks,
> > > > > > > > Robert
> > > > > > > > On 18-1-2021 09:34:01, Romain Manni-Bucau wrote:
> > > > > > > > Generally you want to propagate the mojo logger to have
> > > consistent
> > > > > logs
> > > > > > > but
> > > > > > > > worse case we should promote mojo logging api as injectable
> at
> > > > > > injection
> > > > > > > > points if needed, avoids all the mess you can get in mojo
> with
> > > > > loggers
> > > > > > to
> > > > > > > > respect that rule of dumb IMHO.
> > > > > > > >
> > > > > > > > Le dim. 17 janv. 2021 à 22:48, Slawomir Jaranowski
> > > > > > > > a écrit :
> > > > > > > >
> > > > > > > > > Hi,
> > > > > > > > >
> > > > > > > > > We can use the JSR-330 component for developing maven
> > plugins -
> > > > > > > > > https://maven.apache.org/maven-jsr330.html
> > > > > > > > >
> > > > > > > > > There is not clear how to access logging api from JSR-330
> > > > > component.
> > > > > > > As I
> > > > > > > > > found out last time, maven plugins should not directly use
> > > > > slf4j-api,
> > > > > > > so
> > > > > > > > > what is recommended in this case.
> > > > > > > > >
> > > > > > > > > --
> > > > > > > > > Sławomir Jaranowski
> > > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Sławomir Jaranowski
> > > > > >
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > ------------------------
> > > Guillaume Nodet
> > >
> >
>