logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pradeep Kanchgar <Pradeep.Kanch...@lntinfotech.com>
Subject RE: Flume Appender
Date Thu, 27 Dec 2012 07:23:49 GMT
Hi Ralph, 

I'm using this log4j2 for the first time. What is this maven? With log4j2 if I use other appenders
like console or rollingfileappender  it works fine.
But in case of this flumeappender, I don't have much clarity.  You mean to say in order to
use flume appender I need all these jar like Jackson,snappy, jetty..etc



-----Original Message-----
From: Ralph Goers [mailto:ralph.goers@dslextreme.com] 
Sent: Thursday, December 27, 2012 11:51 AM
To: Log4J Users List
Subject: Re: Flume Appender

Running mvn dependency:tree in samples/flume-remote yields

[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ flume-remote --- [INFO] org.apache.logging.log4j.samples:flume-remote:war:2.0-beta4-SNAPSHOT
[INFO] +- org.apache.logging.log4j.samples:flume-common:jar:2.0-beta4-SNAPSHOT:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.0-beta4-SNAPSHOT:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.0-beta4-SNAPSHOT:compile
[INFO] +- org.apache.logging.log4j.adapters:log4j-web:jar:2.0-beta4-SNAPSHOT:compile
[INFO] |  +- org.slf4j:slf4j-api:jar:1.7.2:compile
[INFO] |  \- org.slf4j:slf4j-ext:jar:1.7.2:compile
[INFO] |     \- ch.qos.cal10n:cal10n-api:jar:0.7.4:compile
[INFO] +- org.apache.logging.log4j.adapters:log4j-flume-ng:jar:2.0-beta4-SNAPSHOT:compile
[INFO] |  \- org.apache.flume:flume-ng-sdk:jar:1.2.0:compile
[INFO] |     +- org.apache.avro:avro:jar:1.6.3:compile
[INFO] |     |  +- org.codehaus.jackson:jackson-core-asl:jar:1.9.2:compile (version managed
from 1.8.8)
[INFO] |     |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.2:compile (version managed
from 1.8.8)
[INFO] |     |  +- com.thoughtworks.paranamer:paranamer:jar:2.3:compile
[INFO] |     |  \- org.xerial.snappy:snappy-java:jar:1.0.4.1:compile
[INFO] |     +- org.apache.avro:avro-ipc:jar:1.6.3:compile
[INFO] |     |  +- org.mortbay.jetty:jetty:jar:6.1.26:compile
[INFO] |     |  +- org.mortbay.jetty:jetty-util:jar:6.1.26:compile
[INFO] |     |  +- org.jboss.netty:netty:jar:3.2.7.Final:compile
[INFO] |     |  \- org.apache.velocity:velocity:jar:1.7:compile
[INFO] |     |     \- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |     +- commons-io:commons-io:jar:2.1:compile
[INFO] |     \- org.mortbay.jetty:servlet-api:jar:2.5-20110124:compile
[INFO] +- org.springframework:spring-beans:jar:3.1.2.RELEASE:compile
[INFO] +- org.springframework:spring-core:jar:3.1.2.RELEASE:compile
[INFO] |  +- org.springframework:spring-asm:jar:3.1.2.RELEASE:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.1.2.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:3.1.2.RELEASE:compile
[INFO] |  +- org.springframework:spring-context-support:jar:3.1.2.RELEASE:compile
[INFO] |  +- org.springframework:spring-expression:jar:3.1.2.RELEASE:compile
[INFO] |  \- org.springframework:spring-web:jar:3.1.2.RELEASE:compile
[INFO] |     \- aopalliance:aopalliance:jar:1.0:compile
[INFO] +- org.springframework.ws:spring-ws-core:jar:2.1.0.RELEASE:compile
[INFO] |  +- org.springframework.ws:spring-xml:jar:2.1.0.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:3.1.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-oxm:jar:3.1.1.RELEASE:compile
[INFO] |  |  \- commons-lang:commons-lang:jar:2.5:compile
[INFO] |  \- wsdl4j:wsdl4j:jar:1.6.1:compile [INFO] +- javax.servlet:servlet-api:jar:2.4:provided
[INFO] \- junit:junit:jar:4.3.1:test

>From this you can see that avro requires jackson and several other jars.  In addition,
you have included avro 1.4.1 while the above shows avro 1.6.3. In looking at the source for
Avro 1.4.1 it does not define that particular class so you will need a more current version.

Ralph






On Dec 26, 2012, at 8:56 PM, Pradeep Kanchgar wrote:

> 
> 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.createPluginObj
> ect(BaseConfiguration.java:711) at 
> org.apache.logging.log4j.core.config.BaseConfiguration.createConfigura
> tion(BaseConfiguration.java:477) at 
> org.apache.logging.log4j.core.config.BaseConfiguration.createConfigura
> tion(BaseConfiguration.java:469) at 
> org.apache.logging.log4j.core.config.BaseConfiguration.doConfigure(Bas
> eConfiguration.java:156) at 
> org.apache.logging.log4j.core.config.BaseConfiguration.start(BaseConfi
> guration.java:114) at 
> org.apache.logging.log4j.core.LoggerContext.setConfiguration(LoggerCon
> text.java:251) at 
> org.apache.logging.log4j.core.LoggerContext.reconfigure(LoggerContext.
> java:267) at 
> org.apache.logging.log4j.core.LoggerContext.start(LoggerContext.java:1
> 34) at 
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4
> jContextFactory.java:75) at 
> org.apache.logging.log4j.core.impl.Log4jContextFactory.getContext(Log4
> jContextFactory.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(F
> lumeAppender.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"


---------------------------------------------------------------------
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
View raw message