logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Henrik Østerlund Gram <henrik.g...@gmail.com>
Subject Re: plugin-registration failing
Date Fri, 22 Aug 2014 20:30:44 GMT
Thanks a lot for that tip!  It turns out I had to copy the
Log4j2Plugins.dat file (which *was* actually being generated from the
annotations processor) from the jar that contained my logging classes and
other utils, into the jar that contained my ejbs and as that initialized
before any of the actual webapps, that was enough to make it work for all
webapps (probably since I use a single logger.)

I don't really understand why this was changed; it's extremely inconvenient
having to do this and surely it's much better that the framework looks for
it in the entire classpath rather than in just one jar.

Thanks again,
Henrik

On Fri, Aug 22, 2014 at 9:59 PM, Clément Guillaume <cguillaume@hotpads.com>
wrote:

> Hi,
>
> I'm also using some custom plugins and several project and wars. I just
> succeeded to setup a maven build that generate the Log4j2Plugins.dat.
>
> First I enable the annotation processor on the project that content my
> plugins:
>
> <plugin>
> <groupId>org.bsc.maven</groupId>
> <artifactId>maven-processor-plugin</artifactId>
> <version>2.2.1</version>
> <executions>
> <execution>
> <id>process</id>
> <goals>
> <goal>process</goal>
> </goals>
> <phase>process-sources</phase>
> </execution>
> </executions>
> <dependencies>
> <dependency>
> <groupId>org.apache.logging.log4j</groupId>
> <artifactId>log4j-core</artifactId>
> <version>2.0.1</version>
> </dependency>
> </dependencies>
> </plugin>
>
> And after I copy the Log4j2Plugins.dat from the generated archive (a jar in
> my case) to the finals wars:
>
>    - I use unpack of the maven-dependency-plugin
>    - I include the file in my wars.
>
>
> Clément
>
>
> On Fri, Aug 22, 2014 at 12:09 PM, Henrik Østerlund Gram <
> henrik.gram@gmail.com> wrote:
>
> > Hi,
> >
> > I had been using the betas for a couple of years and everything was fine.
> >  But unfortunately I cannot seem to make 2.0.x work.
> >
> > I have couple of plugins (converters) that are annotated properly, but
> the
> > automatic detection of these never did work and I had to use the follow
> > maven step to create the necessary Log4j2Plugins.dat for it to work.
> >
> > <plugin> <groupId>org.codehaus.mojo</groupId>
> > <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version>
> > <executions> <execution> <phase>process-classes</phase>
<goals>
> > <goal>java</goal> </goals> </execution> </executions>
<configuration>
> >
> >
> <mainClass>org.apache.logging.log4j.core.config.plugins.PluginManager</mainClass>
> > <arguments>
> > <argument>${project.build.directory}/../src/main/resources</argument>
> > <argument>my.package</argument> </arguments> </configuration>
</plugin>
> > But since rc2 the PluginManager was disabled, and it's now seemingly
> > impossible to get the plugins registered. The source for PluginManager
> > suggests looking at the configuration page supposedly using the packages
> > attr to tell the framework where to scan for plugins, but again, that
> just
> > doesn't work.  I used that as well in the betas where it also did not
> work.
> >
> > Perhaps in trivial project setups it works fine, I don't know, but I have
> > an ear with multiple .wars and a common single log4j2 (present in the
> ear's
> > lib where the jar for my converters is also present) and I don't know why
> > it cannot pick it up.
> >
> > Any workarounds?  I can't understand why it should be this difficult to
> > register a converter.
> >
> > Regards,
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message