logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yair Ogen (yaogen)" <yao...@cisco.com>
Subject RE: Converter Plugin not loaded
Date Thu, 17 Jul 2014 14:15:35 GMT
How does it work? This class doesn't have a main?

My mvn package run fails on:

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default) on
project logging-log4j2: An exception occured while executing the Java class. The specified
mainClass doesn't contain a main method with appropriate signature. org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor.main([Ljava.lang.String;)
-> [Help 1]

Best Regards,
 
Yair Ogen
W: (+972) (0) 2-589-4919
M: (+972) (0) 54-566-4919

-----Original Message-----
From: Jaime Sastre [mailto:jsastre@globalavl.com] 
Sent: Thursday, July 17, 2014 17:12
To: Log4J Users List
Subject: RE: Converter Plugin not loaded

You are ritght, It Works with 					
				<configuration>
						<mainClass>org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor</mainClass>
						<arguments>
							<argument>${project.build.outputDirectory}</argument>
							<argument>com.globalavl.commons.log4j</argument>
						</arguments>
					</configuration>
And generates the dat file in META-INF

-----Mensaje original-----
De: Yair Ogen (yaogen) [mailto:yaogen@cisco.com] Enviado el: jueves, 17 de julio de 2014 16:09
Para: Log4J Users List
Asunto: RE: Converter Plugin not loaded

I now see that the documentation is not up to date. The main class should be:

org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor

as indicated in PluginManager:

   /**
     * Process annotated plugins.
     * @deprecated Use {@link org.apache.logging.log4j.core.config.plugins.processor.PluginProcessor}
instead. To do
     * so, simply include {@code log4j-core} in your dependencies and make sure annotation
processing is not disabled.
     * By default, supported Java compilers will automatically use that plugin processor provided
{@code log4j-core}
     * is on the classpath.
     */
    @Deprecated // use PluginProcessor instead
    public static void main(final String[] args) {
        System.err.println("WARNING: this tool is superseded by the annotation processor included
in log4j-core.");
        System.exit(-1);
    }

However, PluginProcessor doesn't contain a main...

Catch 22?

Best Regards,
 
Yair Ogen

-----Original Message-----
From: Yair Ogen (yaogen)
Sent: Thursday, July 17, 2014 16:55
To: 'Log4J Users List'
Subject: RE: Converter Plugin not loaded

I missed that.

Added to my pom - should running mvn package be enough to generate the file?

It looks like it doesn't.

I see this warning:

WARNING: this tool is superseded by the annotation processor included in log4j-core.

And in the file system I have an empty directory:

\target\generated-sources\annotations

Best Regards,
 
Yair Ogen

-----Original Message-----
From: Remko Popma [mailto:remko.popma@gmail.com]
Sent: Thursday, July 17, 2014 16:30
To: Log4J Users List
Subject: Re: Converter Plugin not loaded

On Thu, Jul 17, 2014 at 10:24 PM, Yair Ogen (yaogen) <yaogen@cisco.com>
wrote:

> In my case it find the *.dat file from core jar. Not clear how can we 
> add more custom plugins.
>

Do you build with maven? The Plugin Preloading section <http://logging.apache.org/log4j/2.x/manual/plugins.html#Plugin_Preloading>
on the Plugins page gives a sample snippet to add to your pom.xml to make Maven generate the
*.dat file for your plugins.



> The same applies to my configuration plugin. I had to also use a 
> ContextFactory and call start(new MyNewConfiguration()) manually for 
> the custom configuration to work.
>
> Something in the plugin mechanism is not extension friendly.
>
> Best Regards,
>
> Yair Ogen
>
> -----Original Message-----
> From: Jaime Sastre [mailto:jsastre@globalavl.com]
> Sent: Thursday, July 17, 2014 16:20
> To: Log4J Users List
> Subject: RE: Converter Plugin not loaded
>
> I will try to do it bw today and tomorrow.
> From what I see in code in pluginmanager:
>
>     private static PluginRegistry<PluginType<?>> decode(final 
> ResourceLoader loader) {
>         final Enumeration<URL> resources;
>         try {
>             resources =
> loader.getResources(PluginProcessor.PLUGIN_CACHE_FILE);
>             if (resources == null) {
>                 return null;
>             }
>         } catch (final IOException ioe) {
>             LOGGER.warn("Unable to preload plugins", ioe);
>             return null;
>         }
>         final PluginRegistry<PluginType<?>> map = new 
> PluginRegistry<PluginType<?>>();
>         while (resources.hasMoreElements()) {
>
> It cannot load PluginProcessor.PLUGIN_CACHE_FILE
> resources.hasMoreElements() == false
>
> Probably a classloading issue since PluginProcessor.PLUGIN_CACHE_FILE 
> exists on the jar file
>
>
> -----Mensaje original-----
> De: Remko Popma [mailto:remko.popma@gmail.com] Enviado el: jueves, 17 
> de julio de 2014 15:03
> Para: Log4J Users List
> Asunto: Re: Converter Plugin not loaded
>
> Would it be possible to provide a small sample project that 
> demonstrates the problem?
> You may want to create a Jira ticket to attach files to (the mailing 
> list software does not like attachments).
>
> Remko
>
>
> On Thu, Jul 17, 2014 at 10:00 PM, Yair Ogen (yaogen) 
> <yaogen@cisco.com>
> wrote:
>
> > Just recently joined the mailing list - can you please share?
> >
> > Yair
> >
> > -----Original Message-----
> > From: Jaime Sastre [mailto:jsastre@globalavl.com]
> > Sent: Thursday, July 17, 2014 15:59
> > To: Log4J Users List
> > Subject: RE: Converter Plugin not loaded
> >
> > I think it is related to my issue (previous email)
> >
> > -----Mensaje original-----
> > De: Yair Ogen (yaogen) [mailto:yaogen@cisco.com] Enviado el: jueves,
> > 17 de julio de 2014 14:43
> > Para: log4j-user@logging.apache.org
> > Asunto: Converter Plugin not loaded
> >
> > I am trying to extend log4j2.
> >
> > I created my own configuration factory that is loaded just fine. In 
> > there I give it a default pattern with some new converters.
> >
> > I created a converter with the needed annotations. However, seems 
> > that the plugin manager is not picking these up. Only plugins that 
> > exists in "" are actually loaded.
> >
> > What am I missing?
> >
> > Yair
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
> > --------------------------------------------------------------------
> > - To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> > For additional commands, e-mail: log4j-user-help@logging.apache.org
> >
> >
>
B KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB  [  X  ܚX KK[XZ[
    ]\ \ ][  X  ܚX P   [ ˘\X K ܙ B  ܈Y][ۘ[  [X[  K[XZ[
    ]\ \ Z[   [ ˘\X K ܙ B 
Mime
View raw message