logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Monecke <simonmone...@gmail.com>
Subject Re: Flume-Appender
Date Fri, 16 Nov 2012 11:07:44 GMT
okay, now my logger can connect to the flume agent. But it cant send a
message:

"ERROR Could not search jar file '' for classes matching criteria:
annotated with @Plugin file not found"

Has anybody an idea?

Regards,
Simon




2012/11/16 Simon Monecke <simonmonecke@gmail.com>

> Hi,
>
> i solved the problem.
>
> The Error:
>
> "
> "Exception in thread "main" java.lang.NullPointerException
>     at org.apache.logging.log4j.core.
> config.plugins.PluginManager.collectPlugins(PluginManager.java:154)
>     at
> org.apache.logging.log4j.core.config.plugins.PluginManager.collectPlugins(PluginManager.java:125)
>     at
> org.apache.logging.log4j.core.pattern.PatternParser.<init>(PatternParser.java:107)
>     at
> org.apache.logging.log4j.core.layout.PatternLayout.createPatternParser(PatternLayout.java:156)
>     at
> org.apache.logging.log4j.core.layout.PatternLayout.<init>(PatternLayout.java:109)
>     at
> org.apache.logging.log4j.core.layout.PatternLayout.createLayout(PatternLayout.java:193)
>     at
> org.apache.logging.log4j.core.config.DefaultConfiguration.<init>(DefaultConfiguration.java:48)
>     at
> org.apache.logging.log4j.core.LoggerContext.<init>(LoggerContext.java:49)
>     at
> org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:161)
>     at
> org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:104)
>     at
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:73)
>
>     at
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:30)
>     at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:138)
>     at de.simo.Log4j2FlumeEmbedded.main(Log4j2FlumeEmbedded.java:22)
> "
>
> The problem: I import the dependencies log4j-core and log4j-flume-ng. Both
> have their own
> /org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat. And i
> exported my project to run it on another system (eclipse,
> file->export->runnable jar). Then i chose the wrong library handling. You
> have to choose "Package required libraries into generated JAR". Otherwise
> ("Extract required...") eclipse found two Log4j2Plugins.dat and ignore the
> other one, but you need both of them. One required for core-appender and
> the other for flume-ng-appender.
>
> Sooo, it was my fault ;)
>
> Regards,
> Simon
>
>
>
> 2012/11/14 Ralph Goers <ralph.goers@dslextreme.com>
>
>> This doesn't look like it has anything to do with the Flume Appender. Can
>> you attach the jar, configuration and instructions and the source to a new
>> Jira issue?
>>
>> Thanks.
>> Ralph
>>
>> On Nov 14, 2012, at 2:54 AM, Simon Monecke wrote:
>>
>> > Hi Ralph,
>> >
>> > thank you for your response, but now i have another problem.
>> >
>> > i have these dependencies:
>> > <dependency>
>> >            <groupId>org.apache.logging.log4j</groupId>
>> >            <artifactId>log4j-api</artifactId>
>> >            <version>2.0-beta2</version>
>> >        </dependency>
>> >        <dependency>
>> >            <groupId>org.apache.logging.log4j</groupId>
>> >            <artifactId>log4j-core</artifactId>
>> >            <version>2.0-beta2</version>
>> >        </dependency>
>> >        <dependency>
>> >            <groupId>org.apache.logging.log4j</groupId>
>> >            <artifactId>log4j-flume-ng</artifactId>
>> >            <version>2.0-alpha2</version>
>> >            <exclusions>
>> >                <exclusion>
>> >                    <artifactId>slf4j-impl</artifactId>
>> >                    <groupId>org.apache.logging.log4j</groupId>
>> >                </exclusion>
>> >            </exclusions>
>> >        </dependency>
>> >        <dependency>
>> >            <groupId>org.apache.logging.log4j.adapters</groupId>
>> >            <artifactId>slf4j-impl</artifactId>
>> >            <version>2.0-beta2</version>
>> >        </dependency>
>> >        <dependency>
>> >            <groupId>org.apache.logging.log4j.adapters</groupId>
>> >            <artifactId>log4j12-api</artifactId>
>> >            <version>2.0-beta2</version>
>> >        </dependency>
>> >        <dependency>
>> >            <groupId>org.apache.flume</groupId>
>> >            <artifactId>flume-ng-core</artifactId>
>> >            <version>${flumeVersion}</version>
>> >            <exclusions>
>> >                <exclusion>
>> >                    <groupId>org.slf4j</groupId>
>> >                    <artifactId>slf4j-log4j12</artifactId>
>> >                </exclusion>
>> >                <exclusion>
>> >                    <groupId>log4j</groupId>
>> >                    <artifactId>log4j</artifactId>
>> >                </exclusion>
>> >            </exclusions>
>> >        </dependency>
>> >        <dependency>
>> >            <groupId>org.apache.flume</groupId>
>> >            <artifactId>flume-ng-node</artifactId>
>> >            <version>${flumeVersion}</version>
>> >            <exclusions>
>> >                <exclusion>
>> >                    <groupId>org.slf4j</groupId>
>> >                    <artifactId>slf4j-log4j12</artifactId>
>> >                </exclusion>
>> >                <exclusion>
>> >                    <groupId>log4j</groupId>
>> >                    <artifactId>log4j</artifactId>
>> >                </exclusion>
>> >            </exclusions>
>> >        </dependency>
>> >        <dependency>
>> >            <groupId>org.apache.flume.flume-ng-channels</groupId>
>> >            <artifactId>flume-file-channel</artifactId>
>> >            <version>${flumeVersion}</version>
>> >        </dependency>
>> >        <dependency>
>> >            <groupId>org.apache.hadoop</groupId>
>> >            <artifactId>hadoop-core</artifactId>
>> >            <version>1.0.1</version>
>> >        </dependency>
>> >        <dependency>
>> >            <groupId>junit</groupId>
>> >            <artifactId>junit</artifactId>
>> >            <version>4.10</version>
>> >        </dependency>
>> >
>> > In Eclipse i can run a little test:
>> >        Logger logger = LogManager.getLogger(Log4j2FlumeEmbedded.class);
>> >
>> >        String text = "Test";
>> >        long timeOfFirstLog = System.nanoTime();
>> >        for (int i = 0; i < countOfLogs; i++) {
>> >            logger.error(text);
>> >        }
>> >
>> > So i get no errors, but i see nothing. I use "export as runnable jar" to
>> > pack all dependencies in one jar. Then i copy it to my virtualbox
>> (linux),
>> > start a flume-agent and get a error:
>> >
>> > "Exception in thread "main" java.lang.NullPointerException
>> >    at
>> >
>> org.apache.logging.log4j.core.config.plugins.PluginManager.collectPlugins(PluginManager.java:154)
>> >    at
>> >
>> org.apache.logging.log4j.core.config.plugins.PluginManager.collectPlugins(PluginManager.java:125)
>> >    at
>> >
>> org.apache.logging.log4j.core.pattern.PatternParser.<init>(PatternParser.java:107)
>> >    at
>> >
>> org.apache.logging.log4j.core.layout.PatternLayout.createPatternParser(PatternLayout.java:156)
>> >    at
>> >
>> org.apache.logging.log4j.core.layout.PatternLayout.<init>(PatternLayout.java:109)
>> >    at
>> >
>> org.apache.logging.log4j.core.layout.PatternLayout.createLayout(PatternLayout.java:193)
>> >    at
>> >
>> org.apache.logging.log4j.core.config.DefaultConfiguration.<init>(DefaultConfiguration.java:48)
>> >    at
>> >
>> org.apache.logging.log4j.core.LoggerContext.<init>(LoggerContext.java:49)
>> >    at
>> >
>> org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.locateContext(ClassLoaderContextSelector.java:161)
>> >    at
>> >
>> org.apache.logging.log4j.core.selector.ClassLoaderContextSelector.getContext(ClassLoaderContextSelector.java:104)
>> >    at
>> >
>> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:73)
>> >    at
>> >
>> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:30)
>> >    at org.apache.logging.log4j.LogManager.getLogger(LogManager.java:138)
>> >    at de.simo.Log4j2FlumeEmbedded.main(Log4j2FlumeEmbedded.java:22)
>> > "
>> >
>> > Can anybody create a very small project (just 1 message with a embedded
>> > agent) to show me what i have to do? :/
>> > To use other appender is very easy, but the flume appender...
>> > thank you
>> >
>> >
>> >
>> > 2012/11/13 Ralph Goers <ralph.goers@dslextreme.com>
>> >
>> >> It looks like you are missing the dependency for avro.  I haven't done
>> the
>> >> best job at listing the exact dependencies needed for both the Remote
>> and
>> >> embedded appenders.  I will try to add that to the wiki but I won't be
>> able
>> >> to get to it until tonight at the earliest.
>> >>
>> >> Ralph
>> >>
>> >> On Nov 13, 2012, at 7:32 AM, Simon Monecke wrote:
>> >>
>> >>> Hi,
>> >>>
>> >>> i want to use the flume-appender, but it doesn't work.
>> >>>
>> >>> my config:
>> >>> "
>> >>> <?xml version="1.0" encoding="UTF-8"?>
>> >>> <configuration status="warn" verbose="true">
>> >>> <appenders>
>> >>>   <Flume name="eventLogger" suppressExceptions="false"
>> compress="true">
>> >>>     <Agent host="localhost" port="44444"/>
>> >>>     <PatternLayout pattern="%m%n"/>
>> >>>   </Flume>
>> >>> </appenders>
>> >>> <loggers>
>> >>>   <root level="error">
>> >>>     <appender-ref ref="eventLogger"/>
>> >>>   </root>
>> >>> </loggers>
>> >>> </configuration>
>> >>> "
>> >>>
>> >>> my pom:
>> >>> "
>> >>> ...
>> >>>   <dependencies>
>> >>>       <dependency>
>> >>>           <groupId>org.apache.logging.log4j</groupId>
>> >>>           <artifactId>log4j-api</artifactId>
>> >>>           <version>2.0-beta2</version>
>> >>>       </dependency>
>> >>>       <dependency>
>> >>>           <groupId>org.apache.logging.log4j</groupId>
>> >>>           <artifactId>log4j-core</artifactId>
>> >>>           <version>2.0-beta2</version>
>> >>>       </dependency>
>> >>>       <dependency>
>> >>>           <groupId>org.apache.logging.log4j</groupId>
>> >>>           <artifactId>log4j-flume-ng</artifactId>
>> >>>           <version>2.0-alpha2</version>
>> >>>       </dependency>
>> >>>   </dependencies>
>> >>> ...
>> >>> "
>> >>> my Log4j2FlumeEmbedded.java:
>> >>> "
>> >>> ...
>> >>>       Logger logger = LogManager.getLogger(Log4j2FlumeEmbedded.class);
>> >>>
>> >>>       String text = "Test";
>> >>>       long timeOfFirstLog = System.nanoTime();
>> >>>       for (int i = 0; i < countOfLogs; i++) {
>> >>>           logger.error(text);
>> >>> ...
>> >>> "
>> >>>
>> >>> i try
>> >>> "java -cp
>> >>>
>> >>
>> ./log4j2flumeembedded-0.0.1-SNAPSHOT.jar:./lib/log4j-api-2.0-beta2.jar:./lib/log4j-core-2.0-beta2.jar:./lib/log4j-flume-ng-2.0-beta2.jar:./apache-flume-1.2.0/lib/flume-ng-sdk-1.2.0.jar
>> >>> de.simo.Log4j2FlumeEmbedded 10"
>> >>>
>> >>> and i got many errors:
>> >>> "
>> >>> 2012-11-13 16:17:08,270 ERROR Unable to invoke method createAppender
>> in
>> >>> class org.apache.logging.log4j.flume.appender.FlumeAppender for
>> element
>> >>> Flume java.lang.reflect.InvocationTargetException
>> >>>   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> >>>   at
>> >>>
>> >>
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
>> >>>   at
>> >>>
>> >>
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>> >>>   at java.lang.reflect.Method.invoke(Method.java:616)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.config.BaseConfiguration.createPluginObject(BaseConfiguration.java:686)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.config.BaseConfiguration.createConfiguration(BaseConfiguration.java:454)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.config.BaseConfiguration.createConfiguration(BaseConfiguration.java:446)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.config.BaseConfiguration.doConfigure(BaseConfiguration.java:152)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.config.BaseConfiguration.start(BaseConfiguration.java:110)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:251)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:267)
>> >>>   at
>> >>>
>> org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:134)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:75)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:30)
>> >>>   at
>> org.apache.logging.log4j.LogManager.getLogger(LogManager.java:138)
>> >>>   at de.simo.Log4j2FlumeEmbedded.main(Log4j2FlumeEmbedded.java:19)
>> >>> Caused by: java.lang.NoClassDefFoundError:
>> >>> org/apache/avro/AvroRemoteException
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.flume.appender.FlumeAppender.createAppender(FlumeAppender.java:173)
>> >>>   ... 16 more
>> >>> Caused by: java.lang.ClassNotFoundException:
>> >>> org.apache.avro.AvroRemoteException
>> >>>   at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
>> >>>   at java.security.AccessController.doPrivileged(Native Method)
>> >>>   at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
>> >>>   at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
>> >>>   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
>> >>>   at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
>> >>>   ... 17 more
>> >>>
>> >>> Null object returned for Flume
>> >>> Exception in thread "main" java.lang.NullPointerException
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.config.BaseConfiguration.createPluginObject(BaseConfiguration.java:591)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.config.BaseConfiguration.createConfiguration(BaseConfiguration.java:454)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.config.BaseConfiguration.doConfigure(BaseConfiguration.java:152)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.config.BaseConfiguration.start(BaseConfiguration.java:110)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerContext.java:251)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.java:267)
>> >>>   at
>> >>>
>> org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:134)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:75)
>> >>>   at
>> >>>
>> >>
>> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4jContextFactory.java:30)
>> >>>   at
>> org.apache.logging.log4j.LogManager.getLogger(LogManager.java:138)
>> >>>   at de.simo.Log4j2FlumeEmbedded.main(Log4j2FlumeEmbedded.java:19)
>> >>> "
>> >>>
>> >>> What can i do? :/ The user guide is a little bit to short.
>> >>>
>> >>> Regards,
>> >>> Simon
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>>
>>
>

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