You appear to be using log4j 1.x. log4j 1.x does not come with a Flume Appender. The Flume project does provide one and if you are having problems with it you would need to raise it it them. log4j 2 does have a Flume Appender however.
Ralph > On Oct 23, 2013, at 3:37 AM, Praveen Sripati <praveensrip...@gmail.com> wrote: > > Hi, > > I am trying to get the events from Log4J into HDFS through Flume using the > Log4J appender. Created two appenders FILE and flume. It works for the FILE > appender, but with the flume appender the program just hangs in Eclipse. I > don't see any exception, except the below in the log.out. > > Batch size string = null > Using Netty bootstrap options: {tcpNoDelay=true, connectTimeoutMillis=20000} > Connecting to localhost/127.0.0.1:41414 > [id: 0x52a00770] OPEN > > Flume works properly, I am able to send messages to the avro source using > the avro client and see the messages in HDFS. But, it's not getting > integrated with Log4J. How to get around this problem? > > ----- > > Here is the Java program > > import java.io.IOException; > import java.sql.SQLException; > import org.apache.log4j.Logger; > > public class log4jExample { > > static Logger log = Logger.getRootLogger(); > public static void main(String[] args) throws IOException, SQLException > { > log.debug("Hello this is an debug message"); > } > } > > ----- > > Here is the log4j.properties > > # Define the root logger with appender file > log = /home/vm4learning/WorkSpace/BigData/Log4J-Example/log > log4j.rootLogger = DEBUG, FILE, flume > > # Define the file appender > log4j.appender.FILE=org.apache.log4j.FileAppender > log4j.appender.FILE.File=${log}/log.out > log4j.appender.FILE.layout=org.apache.log4j.PatternLayout > log4j.appender.FILE.layout.conversionPattern=%m%n > > # Define the flume appender > log4j.appender.flume = org.apache.flume.clients.log4jappender.Log4jAppender > log4j.appender.flume.Hostname = localhost > log4j.appender.flume.Port = 41414 > log4j.appender.flume.UnsafeMode = false > log4j.appender.flume.layout=org.apache.log4j.PatternLayout > log4j.appender.flume.layout.ConversionPattern=%m%n > > ----- > > Here are the dependencies > > <classpathentry kind="lib" path="flume-ng-log4jappender-1.4.0.jar"/> > <classpathentry kind="lib" path="log4j-1.2.17.jar"/> > <classpathentry kind="lib" path="flume-ng-sdk-1.4.0.jar"/> > <classpathentry kind="lib" path="avro-1.7.3.jar"/> > <classpathentry kind="lib" path="netty-3.4.0.Final.jar"/> > <classpathentry kind="lib" path="avro-ipc-1.7.3.jar"/> > <classpathentry kind="lib" path="slf4j-api-1.6.1.jar"/> > <classpathentry kind="lib" path="slf4j-log4j12-1.6.1.jar"/> > > Thanks, > Praveen --------------------------------------------------------------------- To unsubscribe, e-mail: log4j-user-unsubscr...@logging.apache.org For additional commands, e-mail: log4j-user-h...@logging.apache.org