You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4j-user@logging.apache.org by Zhu Wayne <zh...@gmail.com> on 2012/10/19 17:50:36 UTC

log4j2 integration with Hadoop using log4j

Greetings!
I am trying to use Log4j2 Flume Embedded Agent in PIG UDF code to send UDF
logs from Data Nodes. However, Hadoop is on log4j 1.2.x version.  How could
I use both log4j and log4j2 on the same JVM? PIG UDF using log4j2 will be
called in Hadoop MapReduce using log4j 1.2.x.

Regards,
Wayne

Re: log4j2 integration with Hadoop using log4j

Posted by Ralph Goers <ra...@dslextreme.com>.
No.  I personally don't like the properties format so I've not implemented it. Others are welcome to, of course.  Even so the format would not be identical as you no longer specify fully qualified class names in the configuration and many of the components have different configuration parameters than Log4j 1.x.


On Oct 19, 2012, at 1:18 PM, Zhu Wayne wrote:

> That is a good news. Could I still use log4.properties instead of JSON or
> XML format?
> 
> On Fri, Oct 19, 2012 at 3:14 PM, Ralph Goers <ra...@dslextreme.com>wrote:
> 
>> The log4j 1.x adapter should allow an application that logs using log4j
>> 1.x to run unchanged but log via log4j 2.  However, the adapter has been
>> updated since the beta2 release to contain more methods and classes that an
>> application might use to configure log4j 1.x. Most of these will be no-ops.
>> 
>> With the various adapters that are available you should be able to route
>> all logging that uses SLF4J, Log4j 1.x or Commons Logging into Log4j 2.
>> Integration with java.util.logging has not been done yet, primarily because
>> both ways to do it kind of suck.  That said, if you were to use the jul to
>> SLF4J bridge even those would flow to Log4j 2 via the SLF4J binding.
>> 
>> Ralph
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: log4j2 integration with Hadoop using log4j

Posted by Zhu Wayne <zh...@gmail.com>.
That is a good news. Could I still use log4.properties instead of JSON or
XML format?

On Fri, Oct 19, 2012 at 3:14 PM, Ralph Goers <ra...@dslextreme.com>wrote:

> The log4j 1.x adapter should allow an application that logs using log4j
> 1.x to run unchanged but log via log4j 2.  However, the adapter has been
> updated since the beta2 release to contain more methods and classes that an
> application might use to configure log4j 1.x. Most of these will be no-ops.
>
> With the various adapters that are available you should be able to route
> all logging that uses SLF4J, Log4j 1.x or Commons Logging into Log4j 2.
> Integration with java.util.logging has not been done yet, primarily because
> both ways to do it kind of suck.  That said, if you were to use the jul to
> SLF4J bridge even those would flow to Log4j 2 via the SLF4J binding.
>
> Ralph
>

Re: log4j2 integration with Hadoop using log4j

Posted by Ralph Goers <ra...@dslextreme.com>.
The log4j 1.x adapter should allow an application that logs using log4j 1.x to run unchanged but log via log4j 2.  However, the adapter has been updated since the beta2 release to contain more methods and classes that an application might use to configure log4j 1.x. Most of these will be no-ops.

With the various adapters that are available you should be able to route all logging that uses SLF4J, Log4j 1.x or Commons Logging into Log4j 2. Integration with java.util.logging has not been done yet, primarily because both ways to do it kind of suck.  That said, if you were to use the jul to SLF4J bridge even those would flow to Log4j 2 via the SLF4J binding.

Ralph

On Oct 19, 2012, at 1:05 PM, Zhu Wayne wrote:

> Thanks for the clarification. Does the adapter enable  no code change on
> the existing application code using log4j 1.2.x logging? Moreover, does it
> mean that I can use both log4j and log4j2 to log via log4j2 implementation
> in my application code?
> 
> On Fri, Oct 19, 2012 at 11:52 AM, Ralph Goers <ra...@dslextreme.com>wrote:
> 
>> As shown below, the log4j12-api jar replaces log4j.jar and passes all the
>> Log4j 1.x logging calls to Log4j 2. This is usually what is wanted.
>> 
>> If you still want the "real" log4j 1.x then leave log4j.jar and remove
>> log4j12-api.jar.
>> 
>> Ralph
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: log4j2 integration with Hadoop using log4j

Posted by Zhu Wayne <zh...@gmail.com>.
Thanks for the clarification. Does the adapter enable  no code change on
the existing application code using log4j 1.2.x logging? Moreover, does it
mean that I can use both log4j and log4j2 to log via log4j2 implementation
in my application code?

On Fri, Oct 19, 2012 at 11:52 AM, Ralph Goers <ra...@dslextreme.com>wrote:

> As shown below, the log4j12-api jar replaces log4j.jar and passes all the
> Log4j 1.x logging calls to Log4j 2. This is usually what is wanted.
>
> If you still want the "real" log4j 1.x then leave log4j.jar and remove
> log4j12-api.jar.
>
> Ralph
>

Re: log4j2 integration with Hadoop using log4j

Posted by Ralph Goers <ra...@dslextreme.com>.
As shown below, the log4j12-api jar replaces log4j.jar and passes all the Log4j 1.x logging calls to Log4j 2. This is usually what is wanted.

If you still want the "real" log4j 1.x then leave log4j.jar and remove log4j12-api.jar.

Ralph

On Oct 19, 2012, at 9:19 AM, Zhu Wayne wrote:

> Thanks Ralph. I looked at POM but could not find how to use both log4j1.2.x
> and log4j2 together. I can run embedded agent code with log4j2 alone fine.
> The issue is that Hadoop Mapreduce code using log4j call my PIG UDF(user
> defined function) which uses log4j2. Somehow, I have to make these two
> co-exist.
> 
> On Fri, Oct 19, 2012 at 11:02 AM, Ralph Goers <ra...@dslextreme.com>wrote:
> 
>> I've gotten the embedded agent working. It is a bit messy with dependency
>> management. Here is a sample pom.  I will add this to the documentation.
>> 
>> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
>> http://www.w3.org/2001/XMLSchema-instance"
>>      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
>> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>>    <modelVersion>4.0.0</modelVersion>
>>    <groupId>com.myapp</groupId>
>>    <artifactId>myapp</artifactId>
>>    <version>0.0.1-SNAPSHOT</version>
>>    <name>My App</name>
>>    <description>App to test log4j appender</description>
>> 
>>    <properties>
>>        <log4j.version>2.0-beta1</log4j.version>
>>        <slf4j.version>1.6.6</slf4j.version>
>>        <jackson.version>1.9.3</jackson.version>
>>    </properties>
>> 
>>    <dependencyManagement>
>>        <dependencies>
>>            <dependency>
>>                <groupId>org.slf4j</groupId>
>>                <artifactId>slf4j-api</artifactId>
>>                <version>${slf4j.version}</version>
>>            </dependency>
>>            <dependency>
>>                <groupId>org.slf4j</groupId>
>>                <artifactId>slf4j-ext</artifactId>
>>                <version>${slf4j.version></version>
>>            </dependency>
>>            <dependency>
>>                <groupId>org.apache.logging.log4j</groupId>
>>                <artifactId>log4j-api</artifactId>
>>                <version>${log4j2_version}</version>
>>            </dependency>
>>            <dependency>
>>                <groupId>org.apache.logging.log4j.adapters</groupId>
>>                <artifactId>log4j12-api</artifactId>
>>                <version>${log4j2_version}</version>
>>            </dependency>
>>            <dependency>
>>                <groupId>org.apache.logging.log4j</groupId>
>>                <artifactId>log4j-core</artifactId>
>>                <version>${log4j2_version}</version>
>>            </dependency>
>>            <dependency>
>>                <groupId>org.apache.logging.log4j.adapters</groupId>
>>                <artifactId>log4j-flume-ng</artifactId>
>>                <version>${log4j2_version}</version>
>>            </dependency>
>>            <dependency>
>>                <groupId>org.apache.logging.log4j.adapters</groupId>
>>                <artifactId>slf4j-impl</artifactId>
>>                <version>${log4j2_version}</version>
>>            </dependency>
>>            <dependency>
>>                <groupId>org.apache.logging.log4j.adapters</groupId>
>>                <artifactId>log4j-jcl</artifactId>
>>                <version>${log4j2_version}</version>
>>            </dependency>
>>            <dependency>
>>                <groupId>org.apache.logging.log4j.adapters</groupId>
>>                <artifactId>log4j-web</artifactId>
>>                <version>${log4j2_version}</version>
>>            </dependency>
>>            <dependency>
>>                <groupId>org.codehaus.jackson</groupId>
>>                <artifactId>jackson-core-asl</artifactId>
>>                <version>${jackson.version}</version>
>>            </dependency>
>>            <dependency>
>>                <groupId>org.codehaus.jackson</groupId>
>>                <artifactId>jackson-mapper-asl</artifactId>
>>                <version>${jackson.version}</version>
>>            </dependency>
>>            <dependency>
>>                <groupId>org.codehaus.jackson</groupId>
>>                <artifactId>jackson-jaxrs</artifactId>
>>                <version>${jackson.version}</version>
>>            </dependency>
>>            <dependency>
>>                <groupId>org.codehaus.jackson</groupId>
>>                <artifactId>jackson-xc</artifactId>
>>                <version>${jackson.version}</version>
>>            </dependency>
>>        </dependencies>
>>    </dependencyManagement>
>> 
>>    <dependencies>
>>        <!-- Log4j 2 API -->
>>        <dependency>
>>            <groupId>org.apache.logging.log4j</groupId>
>>            <artifactId>log4j-api</artifactId>
>>        </dependency>
>>        <!-- Log4j 1.x API -->
>>        <dependency>
>>            <groupId>org.apache.logging.log4j.adapters</groupId>
>>            <artifactId>log4j12-api</artifactId>
>>        </dependency>
>>        <!-- Log4j 2 implementation -->
>>        <dependency>
>>            <groupId>org.apache.logging.log4j</groupId>
>>            <artifactId>log4j-core</artifactId>
>>        </dependency>
>>        <!-- SLF4J to Log4j 2 binding -->
>>        <dependency>
>>            <groupId>org.apache.logging.log4j.adapters</groupId>
>>            <artifactId>slf4j-impl</artifactId>
>>        </dependency>
>>        <!-- SLF4J API -->
>>        <dependency>
>>            <groupId>org.slf4j</groupId>
>>            <artifactId>slf4j-api</artifactId>
>>        </dependency>
>>        <!-- SLF4J extensions -->
>>        <dependency>
>>            <groupId>org.slf4j</groupId>
>>            <artifactId>slf4j-ext</artifactId>
>>        </dependency>
>>        <!-- Commson Logging to Log4j 2 binding -->
>>        <dependency>
>>            <groupId>org.apache.logging.log4j.adapters</groupId>
>>            <artifactId>log4j-jcl</artifactId>
>>        </dependency>
>>        <!-- Log4j 2 Servlet Context Listener -->
>>        <dependency>
>>            <groupId>org.apache.logging.log4j.adapters</groupId>
>>            <artifactId>log4j-web</artifactId>
>>        </dependency>
>>        <!-- Avro transport protocol - required for Flume -->
>>        <dependency>
>>            <groupId>org.apache.avro</groupId>
>>            <artifactId>avro</artifactId>
>>            <version>1.6.3</version>
>>        </dependency>
>>        <!-- Hadoop core - required by embedded Flume Agent -->
>>        <dependency>
>>            <groupId>org.apache.hadoop</groupId>
>>            <artifactId>hadoop-core</artifactId>
>>            <version>1.0.3</version>
>>            <exclusions>
>>                <exclusion>
>>                    <groupId>org.mortbay.jetty</groupId>
>>                    <artifactId>servlet-api</artifactId>
>>                </exclusion>
>>                <exclusion>
>>                    <groupId>org.mortbay.jetty</groupId>
>>                    <artifactId>servlet-api-2.5</artifactId>
>>                </exclusion>
>>                <exclusion>
>>                    <groupId>junit</groupId>
>>                    <artifactId>junit</artifactId>
>>                </exclusion>
>>            </exclusions>
>>        </dependency>
>>        <!-- Flume File Channel - required by embedded Flume agent -->
>>        <dependency>
>>            <groupId>org.apache.flume.flume-ng-channels</groupId>
>>            <artifactId>flume-file-channel</artifactId>
>>            <version>1.2.0</version>
>>            <exclusions>
>>                <exclusion>
>>                    <groupId>log4j</groupId>
>>                    <artifactId>log4j</artifactId>
>>                </exclusion>
>>                <exclusion>
>>                    <groupId>org.slf4j</groupId>
>>                    <artifactId>slf4j-log4j12</artifactId>
>>                </exclusion>
>>            </exclusions>
>>        </dependency>
>>    </dependencies>
>> </project>
>> 
>> 
>> On Oct 19, 2012, at 8:50 AM, Zhu Wayne wrote:
>> 
>>> Greetings!
>>> I am trying to use Log4j2 Flume Embedded Agent in PIG UDF code to send
>> UDF
>>> logs from Data Nodes. However, Hadoop is on log4j 1.2.x version.  How
>> could
>>> I use both log4j and log4j2 on the same JVM? PIG UDF using log4j2 will be
>>> called in Hadoop MapReduce using log4j 1.2.x.
>>> 
>>> Regards,
>>> Wayne
>> 
>> 


---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Re: log4j2 integration with Hadoop using log4j

Posted by Zhu Wayne <zh...@gmail.com>.
Thanks Ralph. I looked at POM but could not find how to use both log4j1.2.x
and log4j2 together. I can run embedded agent code with log4j2 alone fine.
The issue is that Hadoop Mapreduce code using log4j call my PIG UDF(user
defined function) which uses log4j2. Somehow, I have to make these two
co-exist.

On Fri, Oct 19, 2012 at 11:02 AM, Ralph Goers <ra...@dslextreme.com>wrote:

> I've gotten the embedded agent working. It is a bit messy with dependency
> management. Here is a sample pom.  I will add this to the documentation.
>
> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="
> http://www.w3.org/2001/XMLSchema-instance"
>       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
> http://maven.apache.org/xsd/maven-4.0.0.xsd">
>     <modelVersion>4.0.0</modelVersion>
>     <groupId>com.myapp</groupId>
>     <artifactId>myapp</artifactId>
>     <version>0.0.1-SNAPSHOT</version>
>     <name>My App</name>
>     <description>App to test log4j appender</description>
>
>     <properties>
>         <log4j.version>2.0-beta1</log4j.version>
>         <slf4j.version>1.6.6</slf4j.version>
>         <jackson.version>1.9.3</jackson.version>
>     </properties>
>
>     <dependencyManagement>
>         <dependencies>
>             <dependency>
>                 <groupId>org.slf4j</groupId>
>                 <artifactId>slf4j-api</artifactId>
>                 <version>${slf4j.version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.slf4j</groupId>
>                 <artifactId>slf4j-ext</artifactId>
>                 <version>${slf4j.version></version>
>             </dependency>
>             <dependency>
>                 <groupId>org.apache.logging.log4j</groupId>
>                 <artifactId>log4j-api</artifactId>
>                 <version>${log4j2_version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.apache.logging.log4j.adapters</groupId>
>                 <artifactId>log4j12-api</artifactId>
>                 <version>${log4j2_version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.apache.logging.log4j</groupId>
>                 <artifactId>log4j-core</artifactId>
>                 <version>${log4j2_version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.apache.logging.log4j.adapters</groupId>
>                 <artifactId>log4j-flume-ng</artifactId>
>                 <version>${log4j2_version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.apache.logging.log4j.adapters</groupId>
>                 <artifactId>slf4j-impl</artifactId>
>                 <version>${log4j2_version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.apache.logging.log4j.adapters</groupId>
>                 <artifactId>log4j-jcl</artifactId>
>                 <version>${log4j2_version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.apache.logging.log4j.adapters</groupId>
>                 <artifactId>log4j-web</artifactId>
>                 <version>${log4j2_version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.codehaus.jackson</groupId>
>                 <artifactId>jackson-core-asl</artifactId>
>                 <version>${jackson.version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.codehaus.jackson</groupId>
>                 <artifactId>jackson-mapper-asl</artifactId>
>                 <version>${jackson.version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.codehaus.jackson</groupId>
>                 <artifactId>jackson-jaxrs</artifactId>
>                 <version>${jackson.version}</version>
>             </dependency>
>             <dependency>
>                 <groupId>org.codehaus.jackson</groupId>
>                 <artifactId>jackson-xc</artifactId>
>                 <version>${jackson.version}</version>
>             </dependency>
>         </dependencies>
>     </dependencyManagement>
>
>     <dependencies>
>         <!-- Log4j 2 API -->
>         <dependency>
>             <groupId>org.apache.logging.log4j</groupId>
>             <artifactId>log4j-api</artifactId>
>         </dependency>
>         <!-- Log4j 1.x API -->
>         <dependency>
>             <groupId>org.apache.logging.log4j.adapters</groupId>
>             <artifactId>log4j12-api</artifactId>
>         </dependency>
>         <!-- Log4j 2 implementation -->
>         <dependency>
>             <groupId>org.apache.logging.log4j</groupId>
>             <artifactId>log4j-core</artifactId>
>         </dependency>
>         <!-- SLF4J to Log4j 2 binding -->
>         <dependency>
>             <groupId>org.apache.logging.log4j.adapters</groupId>
>             <artifactId>slf4j-impl</artifactId>
>         </dependency>
>         <!-- SLF4J API -->
>         <dependency>
>             <groupId>org.slf4j</groupId>
>             <artifactId>slf4j-api</artifactId>
>         </dependency>
>         <!-- SLF4J extensions -->
>         <dependency>
>             <groupId>org.slf4j</groupId>
>             <artifactId>slf4j-ext</artifactId>
>         </dependency>
>         <!-- Commson Logging to Log4j 2 binding -->
>         <dependency>
>             <groupId>org.apache.logging.log4j.adapters</groupId>
>             <artifactId>log4j-jcl</artifactId>
>         </dependency>
>         <!-- Log4j 2 Servlet Context Listener -->
>         <dependency>
>             <groupId>org.apache.logging.log4j.adapters</groupId>
>             <artifactId>log4j-web</artifactId>
>         </dependency>
>         <!-- Avro transport protocol - required for Flume -->
>         <dependency>
>             <groupId>org.apache.avro</groupId>
>             <artifactId>avro</artifactId>
>             <version>1.6.3</version>
>         </dependency>
>         <!-- Hadoop core - required by embedded Flume Agent -->
>         <dependency>
>             <groupId>org.apache.hadoop</groupId>
>             <artifactId>hadoop-core</artifactId>
>             <version>1.0.3</version>
>             <exclusions>
>                 <exclusion>
>                     <groupId>org.mortbay.jetty</groupId>
>                     <artifactId>servlet-api</artifactId>
>                 </exclusion>
>                 <exclusion>
>                     <groupId>org.mortbay.jetty</groupId>
>                     <artifactId>servlet-api-2.5</artifactId>
>                 </exclusion>
>                 <exclusion>
>                     <groupId>junit</groupId>
>                     <artifactId>junit</artifactId>
>                 </exclusion>
>             </exclusions>
>         </dependency>
>         <!-- Flume File Channel - required by embedded Flume agent -->
>         <dependency>
>             <groupId>org.apache.flume.flume-ng-channels</groupId>
>             <artifactId>flume-file-channel</artifactId>
>             <version>1.2.0</version>
>             <exclusions>
>                 <exclusion>
>                     <groupId>log4j</groupId>
>                     <artifactId>log4j</artifactId>
>                 </exclusion>
>                 <exclusion>
>                     <groupId>org.slf4j</groupId>
>                     <artifactId>slf4j-log4j12</artifactId>
>                 </exclusion>
>             </exclusions>
>         </dependency>
>     </dependencies>
> </project>
>
>
> On Oct 19, 2012, at 8:50 AM, Zhu Wayne wrote:
>
> > Greetings!
> > I am trying to use Log4j2 Flume Embedded Agent in PIG UDF code to send
> UDF
> > logs from Data Nodes. However, Hadoop is on log4j 1.2.x version.  How
> could
> > I use both log4j and log4j2 on the same JVM? PIG UDF using log4j2 will be
> > called in Hadoop MapReduce using log4j 1.2.x.
> >
> > Regards,
> > Wayne
>
>

Re: log4j2 integration with Hadoop using log4j

Posted by Ralph Goers <ra...@dslextreme.com>.
I've gotten the embedded agent working. It is a bit messy with dependency management. Here is a sample pom.  I will add this to the documentation.

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.myapp</groupId>
    <artifactId>myapp</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>My App</name>
    <description>App to test log4j appender</description>

    <properties>
        <log4j.version>2.0-beta1</log4j.version>
        <slf4j.version>1.6.6</slf4j.version>
        <jackson.version>1.9.3</jackson.version>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-api</artifactId>
                <version>${slf4j.version}</version>
            </dependency>
            <dependency>
                <groupId>org.slf4j</groupId>
                <artifactId>slf4j-ext</artifactId>
                <version>${slf4j.version></version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-api</artifactId>
                <version>${log4j2_version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j.adapters</groupId>
                <artifactId>log4j12-api</artifactId>
                <version>${log4j2_version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j</groupId>
                <artifactId>log4j-core</artifactId>
                <version>${log4j2_version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j.adapters</groupId>
                <artifactId>log4j-flume-ng</artifactId>
                <version>${log4j2_version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j.adapters</groupId>
                <artifactId>slf4j-impl</artifactId>
                <version>${log4j2_version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j.adapters</groupId>
                <artifactId>log4j-jcl</artifactId>
                <version>${log4j2_version}</version>
            </dependency>
            <dependency>
                <groupId>org.apache.logging.log4j.adapters</groupId>
                <artifactId>log4j-web</artifactId>
                <version>${log4j2_version}</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-core-asl</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-mapper-asl</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-jaxrs</artifactId>
                <version>${jackson.version}</version>
            </dependency>
            <dependency>
                <groupId>org.codehaus.jackson</groupId>
                <artifactId>jackson-xc</artifactId>
                <version>${jackson.version}</version>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <!-- Log4j 2 API -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
        </dependency>
        <!-- Log4j 1.x API -->
        <dependency>
            <groupId>org.apache.logging.log4j.adapters</groupId>
            <artifactId>log4j12-api</artifactId>
        </dependency>
        <!-- Log4j 2 implementation -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>
        <!-- SLF4J to Log4j 2 binding -->
        <dependency>
            <groupId>org.apache.logging.log4j.adapters</groupId>
            <artifactId>slf4j-impl</artifactId>
        </dependency>
        <!-- SLF4J API -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
        </dependency>
        <!-- SLF4J extensions -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-ext</artifactId>
        </dependency>
        <!-- Commson Logging to Log4j 2 binding -->
        <dependency>
            <groupId>org.apache.logging.log4j.adapters</groupId>
            <artifactId>log4j-jcl</artifactId>
        </dependency>
        <!-- Log4j 2 Servlet Context Listener -->
        <dependency>
            <groupId>org.apache.logging.log4j.adapters</groupId>
            <artifactId>log4j-web</artifactId>
        </dependency>
        <!-- Avro transport protocol - required for Flume -->
        <dependency>
            <groupId>org.apache.avro</groupId>
            <artifactId>avro</artifactId>
            <version>1.6.3</version>
        </dependency>
        <!-- Hadoop core - required by embedded Flume Agent -->
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-core</artifactId>
            <version>1.0.3</version>
            <exclusions>
                <exclusion>
                    <groupId>org.mortbay.jetty</groupId>
                    <artifactId>servlet-api</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.mortbay.jetty</groupId>
                    <artifactId>servlet-api-2.5</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- Flume File Channel - required by embedded Flume agent -->
        <dependency>
            <groupId>org.apache.flume.flume-ng-channels</groupId>
            <artifactId>flume-file-channel</artifactId>
            <version>1.2.0</version>
            <exclusions>
                <exclusion>
                    <groupId>log4j</groupId>
                    <artifactId>log4j</artifactId>
                </exclusion>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
    </dependencies>
</project>


On Oct 19, 2012, at 8:50 AM, Zhu Wayne wrote:

> Greetings!
> I am trying to use Log4j2 Flume Embedded Agent in PIG UDF code to send UDF
> logs from Data Nodes. However, Hadoop is on log4j 1.2.x version.  How could
> I use both log4j and log4j2 on the same JVM? PIG UDF using log4j2 will be
> called in Hadoop MapReduce using log4j 1.2.x.
> 
> Regards,
> Wayne