Re: Unable to locate plugin type for Custom log4j2 Appender
Amanda Liu <[email protected]> Mon, 5 Aug 2024 08:35:13 -0700
| Newsgroups | gmane.comp.jakarta.log4j.user |
|---|---|
| Message-ID | <CAEycFyR81Z2S9CvAZFcwiBXTZnTjhGkJHZ1gMk8XN52AbHpSyw@mail.gmail.com> |
--000000000000ebcd59061ef16ccb Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Piotr, Thanks for your response! I am using SBT build tool, and the JDK version is 17. And yes, I do see a `Log4jPlugins.dat` file in my JAR. I see some `log4j.core.appender` objects are included in this .dat file, however my new custom appender I added is not there. Best, Amanda On Mon, Aug 5, 2024 at 7:08=E2=80=AFAM Piotr P. Karwasz <piotr.karwasz@gmai= l.com> wrote: > Hi Amanda, > > On Mon, 5 Aug 2024 at 15:23, Amanda Liu <[email protected]> wrote: > > Wondering if I'm missing some step of the set-up process for custom > > appenders? I thought that adding the appender class and modifying the > > log4j.properties file should be sufficient, as the plug-ins docs say > > "Serialized plugin listing files are generated by an annotation process= or > > contained in the log4j-core artifact which will automatically scan your > > code for Log4j 2 plugins and output a metadata file in your processed > > classes. There is nothing extra that needs to be done to enable this; t= he > > Java compiler will automatically pick up the annotation processor on th= e > > class path unless you explicitly disable it" ( > > https://logging.apache.org/log4j/2.x/manual/plugins.html) > > Can you describe your setup: > > * What build tool (Maven, Gradle, etc.) are you using? > * What JDK are you using? > * Does your JAR file contain a `Log4jPlugins.dat` file? > > The `javac` compiler **usually** detects all the annotation processors > on the classpath (unless an annotation processor path is provided). > Build tools can however modify that and IIRC in future JDK release > annotation processors will need to be activated **explicitly**. > > Piotr > --000000000000ebcd59061ef16ccb--