Re: Problems creating custom appender using JPMS service in 3.0.0-beta3
Gary Gregory <[email protected]> Wed, 4 Dec 2024 10:19:27 -0500
| Newsgroups | gmane.comp.jakarta.log4j.user,gmane.comp.java.wicket.devel |
|---|---|
| Message-ID | <CACZkXPzjiXhctTgiNktqBRMXKN5A9rr-mZQiULFHcAvmSknJhw@mail.gmail.com> |
--0000000000006475d10628734fed Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I had to put some mysterious dot file in the root of my Maven module to get my plugin to work. The only way I found this is by comparison with another module but not all modules have this file. Gary On Wed, Dec 4, 2024, 8:16=E2=80=AFAM Volkan Yaz=C4=B1c=C4=B1 <[email protected]= i> wrote: > I agree with Pavel that users should only be required to > > 1. Provide the interface implementation > 2. Create the associated `META-INF/services` file entry > 3. [For Java 9 and above] Update their `module-info.java` accordingly > > Anything more than this is non-idiomatic. Telling users "but processors a= re > helpful", "you can manually create the Java file registering your plugin"= , > etc. is beating around the bush. > > On Fri, Nov 29, 2024 at 10:26=E2=80=AFAM PavelTurk <[email protected]= om> > wrote: > > > Hi Piotr, > > > > On 11/29/24 10:07, Piotr P. Karwasz wrote: > > > Hi Pavel, > > > > > > On 28.11.2024 19:26, PavelTurk wrote: > > >> Thank you very much for your detailed and quick help. > > >> > > >> However, to tell the truth, I=E2=80=99m a bit confused. I=E2=80=99ve= been waiting for > a > > long time for Log4j to finally work according to the JPMS rules. But in > > your message, you talk about compile-time and, as I understood, the use > of > > some plugin-processor (from your project pom): > > >> > > >> <annotationProcessorPaths> > > >> <path> > > >> <groupId>org.apache.logging.log4j</groupId> > > >> <artifactId>log4j-plugin-processor</artifactId> > > >> <version>3.0.0-beta3</version> > > >> </path> > > >> </annotationProcessorPaths> > > >> > > >> Doesn=E2=80=99t all this completely contradict JPMS? > > > > (...) > > >> By the way, I noticed something seemed off when I saw code duplicati= on > > in your project: > > >> > > >> @Configurable(elementType =3D Appender.ELEMENT_TYPE, printObject =3D= true) > > >> @Plugin(ConsoleAppender.PLUGIN_NAME) > > >> public final class ConsoleAppender... > > >> > > >> and > > >> > > >> PluginEntry.builder() > > >> .setKey("console") > > >> > .setClassName("org.apache.logging.log4j.core.appender.ConsoleAppender") > > >> .setName("Console") > > >> .setNamespace("Core") > > >> .setElementType("appender") > > >> .setPrintable(true) > > >> .get(), > > >> > > >> Or am I mistaken (which is always possible) and misunderstood > > everything? > > > > > > We have an annotation processor that automatically generates the > > required `PluginService` implementation, I don't see how that contradic= ts > > the principles behind JPMS. > > ... > > > > Let me explain my point of view. But first of all, I want to emphasize > > that I=E2=80=99m not claiming to be right=E2=80=94I could very well be = wrong. I=E2=80=99m simply > > saying that using a processor seems incorrect to me. > > > > In the world of JPMS, there=E2=80=99s a service, we implement it, and w= e add it. > I > > haven=E2=80=99t heard of a service + PROCESSOR that needs to be used. C= an you > point > > out any other projects that involve a service + processor? The reasonin= g > is > > that we should only need to know the INTERFACE, and we=E2=80=99ll handl= e the > > IMPLEMENTATION ourselves. After all, it=E2=80=99s possible to do withou= t it=E2=80=94for > > example, by writing a PluginService manually, which would scan the modu= le > > itself and return the necessary classes or just data(entries) about the= m. > > That=E2=80=99s why I said that using a processor here seems odd to me. = In > general, > > I think code generation should only be used as a last resort=E2=80=94fo= r example, > > for JPA metamodels=E2=80=94but that=E2=80=99s just my opinion. > > > > I assume module-info was also generated automatically. The problem is > that > > it=E2=80=99s not present in log4j-core-3.0.0-beta3-sources.jar see [1],= but it > does > > exist in log4j-core-3.0.0-beta3.jar see [2]. Additionally, it=E2=80=99s= not in > the > > repository see [3]. So, it is not possible to see what is in this file. > Or > > was I looking in the wrong place? > > > > [1] > > > https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/3.0.0-= beta3/log4j-core-3.0.0-beta3-sources.jar > > [2] > > > https://repo1.maven.org/maven2/org/apache/logging/log4j/log4j-core/3.0.0-= beta3/log4j-core-3.0.0-beta3.jar > > [3] > > > https://github.com/apache/logging-log4j2/tree/rel/3.0.0-beta3/log4j-core/= src/main/java > > > > Best regards, Pavel > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [email protected] > > For additional commands, e-mail: [email protected] > > > > > --0000000000006475d10628734fed--