logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Monecke <simonmone...@gmail.com>
Subject Flume-Appender
Date Tue, 13 Nov 2012 15:32:27 GMT
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

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