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 Chris Veal <cm...@gmail.com> on 2014/02/07 23:35:57 UTC

Fwd: Overlapping Classes

I'm using the maven shade plugin with apache-log4j-extras-1.2.17
and log4j-1.2.17. That plugin takes the project artifacts and all its
dependencies and puts them in a single jar. During compilation, the plugin
states:

[WARNING] apache-log4j-extras-1.2.17.jar, log4j-1.2.17.jar define 126
overlappping classes:
[WARNING]   - org.apache.log4j.xml.DOMConfigurator$2
[WARNING]   - org.apache.log4j.xml.DOMConfigurator$5
[WARNING]   - org.apache.log4j.NDC$DiagnosticContext
[WARNING]   - org.apache.log4j.spi.AppenderAttachable
[WARNING]   - org.apache.log4j.spi.ErrorHandler
[WARNING]   - org.apache.log4j.spi.RootCategory
[WARNING]   - org.apache.log4j.pattern.PatternConverter
[WARNING]   - org.apache.log4j.TTCCLayout
[WARNING]   - org.apache.log4j.RollingCalendar
[WARNING]   - org.apache.log4j.spi.Configurator
[WARNING]   - 116 more...
[WARNING] maven-shade-plugin has detected that some .class files
[WARNING] are present in two or more JARs. When this happens, only
[WARNING] one single version of the class is copied in the uberjar.
[WARNING] Usually this is not harmful and you can skeep these
[WARNING] warnings, otherwise try to manually exclude artifacts
[WARNING] based on mvn dependency:tree -Ddetail=true and the above
[WARNING] output
[WARNING] See http://docs.codehaus.org/display/MAVENUSER/Shade+Plugin

If I exclude apache-log4j-extras-1.2.17, then my code complains about not
having the updated RollingAppender.

If I exclude log4j-1.2.17, then my code complains that it can't find
RendererMap.

Any ideas on how to get this code to work properly with the overlapping
classes?

Thanks,

Chris

Re: Overlapping Classes

Posted by Remko Popma <re...@gmail.com>.
Hi Chris,

Log4j-1.2 is not actively maintained anymore. On the other hand, log4j-2.0
is under active development/maintenance and IMHO stable enough for
production use.
We are in the middle of rolling out a 2.0-RC1 release, which should be
available for download in a couple of days.
Would it be an option for you to use log4j-2.0 instead of log4j-1.2 +
extras? If there is some feature in extras that is not in 2.0, please let
us know!

-Remko

On Sunday, February 9, 2014, Chris Veal <cm...@gmail.com> wrote:

> I'm using apache-log4j-extras-1.2.17 and log4j-1.2.17.
>
> The maven shade plugin provides the ability to relocate these jars into
> separate packages so that they wouldn't overlap. I could assign each jar
> its own package name. Would that be recommended? Or, does the extras code
> purposefully overlap the log4j code in an attempt to override that code?
>
> Thanks,
>
> Chris
>
>
>
>
> On Sat, Feb 8, 2014 at 3:18 PM, Matt Sicker <boards@gmail.com<javascript:;>>
> wrote:
>
> > Actually, let me follow that up with a further question: is this in a
> log4j
> > 1.2.17 environment only, or is this when paired with log4j 2.0?
> >
> >
> > On 7 February 2014 20:25, Matt Sicker <boards@gmail.com <javascript:;>>
> wrote:
> >
> > > Using an OSGi framework would help. It has separate class loaders for
> > each
> > > bundle you install. Check out Apache Felix or Eclipse Equinox or some
> > other
> > > implementation.
> > >
> > > Matt Sicker
> > >
> > > > On Feb 7, 2014, at 16:35, Chris Veal <cmveal@gmail.com<javascript:;>>
> wrote:
> > > >
> > > > I'm using the maven shade plugin with apache-log4j-extras-1.2.17
> > > > and log4j-1.2.17. That plugin takes the project artifacts and all its
> > > > dependencies and puts them in a single jar. During compilation, the
> > > plugin
> > > > states:
> > > >
> > > > [WARNING] apache-log4j-extras-1.2.17.jar, log4j-1.2.17.jar define 126
> > > > overlappping classes:
> > > > [WARNING]   - org.apache.log4j.xml.DOMConfigurator$2
> > > > [WARNING]   - org.apache.log4j.xml.DOMConfigurator$5
> > > > [WARNING]   - org.apache.log4j.NDC$DiagnosticContext
> > > > [WARNING]   - org.apache.log4j.spi.AppenderAttachable
> > > > [WARNING]   - org.apache.log4j.spi.ErrorHandler
> > > > [WARNING]   - org.apache.log4j.spi.RootCategory
> > > > [WARNING]   - org.apache.log4j.pattern.PatternConverter
> > > > [WARNING]   - org.apache.log4j.TTCCLayout
> > > > [WARNING]   - org.apache.log4j.RollingCalendar
> > > > [WARNING]   - org.apache.log4j.spi.Configurator
> > > > [WARNING]   - 116 more...
> > > > [WARNING] maven-shade-plugin has detected that some .class files
> > > > [WARNING] are present in two or more JARs. When this happens, only
> > > > [WARNING] one single version of the class is copied in the uberjar.
> > > > [WARNING] Usually this is not harmful and you can skeep these
> > > > [WARNING] warnings, otherwise try to manually exclude artifacts
> > > > [WARNING] based on mvn dependency:tree -Ddetail=true and the above
> > > > [WARNING] output
> > > > [WARNING] See
> http://docs.codehaus.org/display/MAVENUSER/Shade+Plugin
> > > >
> > > > If I exclude apache-log4j-extras-1.2.17, then my code complains about
> > not
> > > > having the updated RollingAppender.
> > > >
> > > > If I exclude log4j-1.2.17, then my code complains that it can't find
> > > > RendererMap.
> > > >
> > > > Any ideas on how to get this code to work properly with the
> overlapping
> > > > classes?
> > > >
> > > > Thanks,
> > > >
> > > > Chris
> > >
> >
> >
> >
> > --
> > Matt Sicker <boards@gmail.com <javascript:;>>
> >
>

Re: Overlapping Classes

Posted by Chris Veal <cm...@gmail.com>.
I'm using apache-log4j-extras-1.2.17 and log4j-1.2.17.

The maven shade plugin provides the ability to relocate these jars into
separate packages so that they wouldn't overlap. I could assign each jar
its own package name. Would that be recommended? Or, does the extras code
purposefully overlap the log4j code in an attempt to override that code?

Thanks,

Chris




On Sat, Feb 8, 2014 at 3:18 PM, Matt Sicker <bo...@gmail.com> wrote:

> Actually, let me follow that up with a further question: is this in a log4j
> 1.2.17 environment only, or is this when paired with log4j 2.0?
>
>
> On 7 February 2014 20:25, Matt Sicker <bo...@gmail.com> wrote:
>
> > Using an OSGi framework would help. It has separate class loaders for
> each
> > bundle you install. Check out Apache Felix or Eclipse Equinox or some
> other
> > implementation.
> >
> > Matt Sicker
> >
> > > On Feb 7, 2014, at 16:35, Chris Veal <cm...@gmail.com> wrote:
> > >
> > > I'm using the maven shade plugin with apache-log4j-extras-1.2.17
> > > and log4j-1.2.17. That plugin takes the project artifacts and all its
> > > dependencies and puts them in a single jar. During compilation, the
> > plugin
> > > states:
> > >
> > > [WARNING] apache-log4j-extras-1.2.17.jar, log4j-1.2.17.jar define 126
> > > overlappping classes:
> > > [WARNING]   - org.apache.log4j.xml.DOMConfigurator$2
> > > [WARNING]   - org.apache.log4j.xml.DOMConfigurator$5
> > > [WARNING]   - org.apache.log4j.NDC$DiagnosticContext
> > > [WARNING]   - org.apache.log4j.spi.AppenderAttachable
> > > [WARNING]   - org.apache.log4j.spi.ErrorHandler
> > > [WARNING]   - org.apache.log4j.spi.RootCategory
> > > [WARNING]   - org.apache.log4j.pattern.PatternConverter
> > > [WARNING]   - org.apache.log4j.TTCCLayout
> > > [WARNING]   - org.apache.log4j.RollingCalendar
> > > [WARNING]   - org.apache.log4j.spi.Configurator
> > > [WARNING]   - 116 more...
> > > [WARNING] maven-shade-plugin has detected that some .class files
> > > [WARNING] are present in two or more JARs. When this happens, only
> > > [WARNING] one single version of the class is copied in the uberjar.
> > > [WARNING] Usually this is not harmful and you can skeep these
> > > [WARNING] warnings, otherwise try to manually exclude artifacts
> > > [WARNING] based on mvn dependency:tree -Ddetail=true and the above
> > > [WARNING] output
> > > [WARNING] See http://docs.codehaus.org/display/MAVENUSER/Shade+Plugin
> > >
> > > If I exclude apache-log4j-extras-1.2.17, then my code complains about
> not
> > > having the updated RollingAppender.
> > >
> > > If I exclude log4j-1.2.17, then my code complains that it can't find
> > > RendererMap.
> > >
> > > Any ideas on how to get this code to work properly with the overlapping
> > > classes?
> > >
> > > Thanks,
> > >
> > > Chris
> >
>
>
>
> --
> Matt Sicker <bo...@gmail.com>
>

Re: Overlapping Classes

Posted by Matt Sicker <bo...@gmail.com>.
Actually, let me follow that up with a further question: is this in a log4j
1.2.17 environment only, or is this when paired with log4j 2.0?


On 7 February 2014 20:25, Matt Sicker <bo...@gmail.com> wrote:

> Using an OSGi framework would help. It has separate class loaders for each
> bundle you install. Check out Apache Felix or Eclipse Equinox or some other
> implementation.
>
> Matt Sicker
>
> > On Feb 7, 2014, at 16:35, Chris Veal <cm...@gmail.com> wrote:
> >
> > I'm using the maven shade plugin with apache-log4j-extras-1.2.17
> > and log4j-1.2.17. That plugin takes the project artifacts and all its
> > dependencies and puts them in a single jar. During compilation, the
> plugin
> > states:
> >
> > [WARNING] apache-log4j-extras-1.2.17.jar, log4j-1.2.17.jar define 126
> > overlappping classes:
> > [WARNING]   - org.apache.log4j.xml.DOMConfigurator$2
> > [WARNING]   - org.apache.log4j.xml.DOMConfigurator$5
> > [WARNING]   - org.apache.log4j.NDC$DiagnosticContext
> > [WARNING]   - org.apache.log4j.spi.AppenderAttachable
> > [WARNING]   - org.apache.log4j.spi.ErrorHandler
> > [WARNING]   - org.apache.log4j.spi.RootCategory
> > [WARNING]   - org.apache.log4j.pattern.PatternConverter
> > [WARNING]   - org.apache.log4j.TTCCLayout
> > [WARNING]   - org.apache.log4j.RollingCalendar
> > [WARNING]   - org.apache.log4j.spi.Configurator
> > [WARNING]   - 116 more...
> > [WARNING] maven-shade-plugin has detected that some .class files
> > [WARNING] are present in two or more JARs. When this happens, only
> > [WARNING] one single version of the class is copied in the uberjar.
> > [WARNING] Usually this is not harmful and you can skeep these
> > [WARNING] warnings, otherwise try to manually exclude artifacts
> > [WARNING] based on mvn dependency:tree -Ddetail=true and the above
> > [WARNING] output
> > [WARNING] See http://docs.codehaus.org/display/MAVENUSER/Shade+Plugin
> >
> > If I exclude apache-log4j-extras-1.2.17, then my code complains about not
> > having the updated RollingAppender.
> >
> > If I exclude log4j-1.2.17, then my code complains that it can't find
> > RendererMap.
> >
> > Any ideas on how to get this code to work properly with the overlapping
> > classes?
> >
> > Thanks,
> >
> > Chris
>



-- 
Matt Sicker <bo...@gmail.com>

Re: Overlapping Classes

Posted by Matt Sicker <bo...@gmail.com>.
Using an OSGi framework would help. It has separate class loaders for each bundle you install. Check out Apache Felix or Eclipse Equinox or some other implementation.

Matt Sicker

> On Feb 7, 2014, at 16:35, Chris Veal <cm...@gmail.com> wrote:
> 
> I'm using the maven shade plugin with apache-log4j-extras-1.2.17
> and log4j-1.2.17. That plugin takes the project artifacts and all its
> dependencies and puts them in a single jar. During compilation, the plugin
> states:
> 
> [WARNING] apache-log4j-extras-1.2.17.jar, log4j-1.2.17.jar define 126
> overlappping classes:
> [WARNING]   - org.apache.log4j.xml.DOMConfigurator$2
> [WARNING]   - org.apache.log4j.xml.DOMConfigurator$5
> [WARNING]   - org.apache.log4j.NDC$DiagnosticContext
> [WARNING]   - org.apache.log4j.spi.AppenderAttachable
> [WARNING]   - org.apache.log4j.spi.ErrorHandler
> [WARNING]   - org.apache.log4j.spi.RootCategory
> [WARNING]   - org.apache.log4j.pattern.PatternConverter
> [WARNING]   - org.apache.log4j.TTCCLayout
> [WARNING]   - org.apache.log4j.RollingCalendar
> [WARNING]   - org.apache.log4j.spi.Configurator
> [WARNING]   - 116 more...
> [WARNING] maven-shade-plugin has detected that some .class files
> [WARNING] are present in two or more JARs. When this happens, only
> [WARNING] one single version of the class is copied in the uberjar.
> [WARNING] Usually this is not harmful and you can skeep these
> [WARNING] warnings, otherwise try to manually exclude artifacts
> [WARNING] based on mvn dependency:tree -Ddetail=true and the above
> [WARNING] output
> [WARNING] See http://docs.codehaus.org/display/MAVENUSER/Shade+Plugin
> 
> If I exclude apache-log4j-extras-1.2.17, then my code complains about not
> having the updated RollingAppender.
> 
> If I exclude log4j-1.2.17, then my code complains that it can't find
> RendererMap.
> 
> Any ideas on how to get this code to work properly with the overlapping
> classes?
> 
> Thanks,
> 
> Chris

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