Hi ,
I'm using flume Appender but getting the following error.
2012-12-26 19:08:41,566 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(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
org.apache.logging.log4j.core.config.BaseConfiguration.createPluginObject(BaseConfiguration.java:711)
at
org.apache.logging.log4j.core.config.BaseConfiguration.createConfiguration(BaseConfiguration.java:477)
at
org.apache.logging.log4j.core.config.BaseConfiguration.createConfiguration(BaseConfiguration.java:469)
at
org.apache.logging.log4j.core.config.BaseConfiguration.doConfigure(BaseConfiguration.java:156)
at
org.apache.logging.log4j.core.config.BaseConfiguration.start(BaseConfiguration.java:114)
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:165)
at log4jExample.<clinit>(log4jExample.java:8)
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(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 17 more
2012-12-26 19:08:41,567 ERROR Null object returned for Flume in appenders
2012-12-26 19:08:41,577 ERROR Unable to locate appender eventLogger for logger
my config file : log4j2.xml is
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="warn" name="log4jExample" packages="">
<appenders>
<Flume name="eventLogger" suppressExceptions="false" compress="true">
<Agent host="172.20.104.226" port="41414"/>
<PatternLayout pattern="%m%n"/>
</Flume>
</appenders>
<loggers>
<root level="error">
<appender-ref ref="eventLogger"/>
</root>
</loggers>
</configuration>
my java file is
public class log4jExample{
/* Get actual class name to be printed on */
static Logger log = LogManager.getLogger(
log4jExample.class.getName());
public static void main(String[] args)
throws Exception{
for (int i = 0; i < 100 ; i++) {
log.trace("Entering the Application");
log.debug("Current data unavailalbe, using cached values");
log.info("Hello this is an info message");
log.error("Dabase unavaliable, connetion lost");
log.warn("Attention!! Application running in debugmode");
log.trace("Existing the Application");
}
}
}
I've added all the log4j2 jar files in classpath variable in ~/.bashrc file.
but still getting same error and I've already wasted an entire day in resolving
this, but no solution yet.
And apache avro jar(avro-1.4.1.jar) is also in classpath.
Still the problem persists.
I've these jar files in my classpath : log4j12-api-2.0-beta3.jar,
log4j-core-2.0-beta3.jar, log4j-flume-ng-2.0-beta3.jar,
log4j-jcl-2.0-beta3.jar, log4j-slf4j-impl-2.0-beta3.jar, avro-1.4.1.jar.
Regards,
Pradeep Kanchgar
________________________________
The contents of this e-mail and any attachment(s) may contain confidential or
privileged information for the intended recipient(s). Unintended recipients are
prohibited from taking action on the basis of information in this e-mail and
using or disseminating the information, and must notify the sender and delete
it from their system. L&T Infotech will not accept responsibility or liability
for the accuracy or completeness of, or the presence of any virus or disabling
code in this e-mail"